-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add common tags, update build.gradle
- Loading branch information
Showing
16 changed files
with
238 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/io/github/cottonmc/cotton/registry/CommonTags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package io.github.cottonmc.cotton.registry; | ||
|
||
import io.github.cottonmc.cotton.Cotton; | ||
import io.github.cottonmc.cotton.datapack.tags.TagEntryManager; | ||
import io.github.cottonmc.cotton.datapack.tags.TagType; | ||
import net.fabricmc.fabric.api.tag.TagRegistry; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.block.BlockItem; | ||
import net.minecraft.tag.Tag; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.registry.Registry; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
||
public class CommonTags { | ||
//auto-fillable tags for common decorative/functional blocks | ||
public static final Tag<Item> GLASS_BLOCKS = register("glass_blocks"); | ||
public static final Tag<Item> GLASS_PANES = register("glass_panes"); | ||
public static final Tag<Item> TERRACOTTA = register("terracotta"); | ||
public static final Tag<Item> CARPET = register("carpet"); | ||
public static final Tag<Item> PRESSURE_PLATES = register("pressure_plates"); | ||
|
||
//tags for common item categories | ||
public static final Tag<Item> MUSHROOMS = register("mushrooms"); | ||
public static final Tag<Item> RAW_MEAT = register("raw_meat"); | ||
public static final Tag<Item> COOKED_MEAT = register("cooked_meat"); | ||
|
||
public static void init() { | ||
if (Cotton.config.fillCommonTags) { | ||
Cotton.logger.info("Generating common tags!"); | ||
List<String> glass_blocks = new ArrayList<>(); | ||
List<String> glass_panes = new ArrayList<>(); | ||
List<String> terracotta = new ArrayList<>(); | ||
List<String> carpets = new ArrayList<>(); | ||
List<String> pressure_plates = new ArrayList<>(); | ||
|
||
for (Identifier id : Registry.ITEM.getIds()) { | ||
//vanilla entries are pre-loaded | ||
if (id.getNamespace().equals("minecraft")) continue; | ||
if (id.getPath().contains("glass") && Registry.ITEM.get(id) instanceof BlockItem) { | ||
if (id.getPath().contains("pane")) glass_panes.add(id.toString()); | ||
else glass_blocks.add(id.toString()); | ||
} | ||
if (id.getPath().contains("terracotta")) terracotta.add(id.toString()); | ||
if (id.getPath().contains("carpet")) carpets.add(id.toString()); | ||
if (id.getPath().contains("pressure_plate")) pressure_plates.add(id.toString()); | ||
} | ||
|
||
if (!glass_blocks.isEmpty()) TagEntryManager.registerToTag(TagType.ITEM, GLASS_BLOCKS.getId(), glass_blocks.toArray(new String[0])); | ||
if (!glass_panes.isEmpty()) TagEntryManager.registerToTag(TagType.ITEM, GLASS_PANES.getId(), glass_panes.toArray(new String[0])); | ||
if (!terracotta.isEmpty()) TagEntryManager.registerToTag(TagType.ITEM, TERRACOTTA.getId(), terracotta.toArray(new String[0])); | ||
if (!carpets.isEmpty()) TagEntryManager.registerToTag(TagType.ITEM, CARPET.getId(), carpets.toArray(new String[0])); | ||
if (!pressure_plates.isEmpty()) TagEntryManager.registerToTag(TagType.ITEM, PRESSURE_PLATES.getId(), pressure_plates.toArray(new String[0])); | ||
} | ||
} | ||
|
||
private static Tag<Item> register(String id) { | ||
return TagRegistry.item(new Identifier(Cotton.SHARED_NAMESPACE, id)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"itemGroup.cotton:common_tab": "Common" | ||
"itemGroup.cotton.common_tab": "Common" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:white_carpet", | ||
"minecraft:orange_carpet", | ||
"minecraft:magenta_carpet", | ||
"minecraft:light_blue_carpet", | ||
"minecraft:yellow_carpet", | ||
"minecraft:lime_carpet", | ||
"minecraft:pink_carpet", | ||
"minecraft:gray_carpet", | ||
"minecraft:light_gray_carpet", | ||
"minecraft:cyan_carpet", | ||
"minecraft:purple_carpet", | ||
"minecraft:blue_carpet", | ||
"minecraft:brown_carpet", | ||
"minecraft:green_carpet", | ||
"minecraft:red_carpet", | ||
"minecraft:black_carpet" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:cooked_beef", | ||
"minecraft:cooked_chicken", | ||
"minecraft:cooked_cod", | ||
"minecraft:cooked_mutton", | ||
"minecraft:cooked_porkchop", | ||
"minecraft:cooked_rabbit", | ||
"minecraft:cooked_salmon" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:glass", | ||
"minecraft:white_stained_glass", | ||
"minecraft:orange_stained_glass", | ||
"minecraft:magenta_stained_glass", | ||
"minecraft:light_blue_stained_glass", | ||
"minecraft:yellow_stained_glass", | ||
"minecraft:lime_stained_glass", | ||
"minecraft:pink_stained_glass", | ||
"minecraft:gray_stained_glass", | ||
"minecraft:light_gray_stained_glass", | ||
"minecraft:cyan_stained_glass", | ||
"minecraft:purple_stained_glass", | ||
"minecraft:blue_stained_glass", | ||
"minecraft:brown_stained_glass", | ||
"minecraft:green_stained_glass", | ||
"minecraft:red_stained_glass", | ||
"minecraft:black_stained_glass" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:glass_pane", | ||
"minecraft:white_stained_glass_pane", | ||
"minecraft:orange_stained_glass_pane", | ||
"minecraft:magenta_stained_glass_pane", | ||
"minecraft:light_blue_stained_glass_pane", | ||
"minecraft:yellow_stained_glass_pane", | ||
"minecraft:lime_stained_glass_pane", | ||
"minecraft:pink_stained_glass_pane", | ||
"minecraft:gray_stained_glass_pane", | ||
"minecraft:light_gray_stained_glass_pane", | ||
"minecraft:cyan_stained_glass_pane", | ||
"minecraft:purple_stained_glass_pane", | ||
"minecraft:blue_stained_glass_pane", | ||
"minecraft:brown_stained_glass_pane", | ||
"minecraft:green_stained_glass_pane", | ||
"minecraft:red_stained_glass_pane", | ||
"minecraft:black_stained_glass_pane" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:brown_mushroom", | ||
"minecraft:red_mushroom" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:stone_pressure_plate", | ||
"minecraft:oak_pressure_plate", | ||
"minecraft:spruce_pressure_plate", | ||
"minecraft:birch_pressure_plate", | ||
"minecraft:jungle_pressure_plate", | ||
"minecraft:acacia_pressure_plate", | ||
"minecraft:dark_oak_pressure_plate", | ||
"minecraft:light_weighted_pressure_plate", | ||
"minecraft:heavy_weighted_pressure_plate" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:beef", | ||
"minecraft:chicken", | ||
"minecraft:cod", | ||
"minecraft:mutton", | ||
"minecraft:porkchop", | ||
"minecraft:rabbit", | ||
"minecraft:salmon" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"minecraft:white_terracotta", | ||
"minecraft:orange_terracotta", | ||
"minecraft:magenta_terracotta", | ||
"minecraft:light_blue_terracotta", | ||
"minecraft:yellow_terracotta", | ||
"minecraft:lime_terracotta", | ||
"minecraft:pink_terracotta", | ||
"minecraft:gray_terracotta", | ||
"minecraft:light_gray_terracotta", | ||
"minecraft:cyan_terracotta", | ||
"minecraft:purple_terracotta", | ||
"minecraft:blue_terracotta", | ||
"minecraft:brown_terracotta", | ||
"minecraft:green_terracotta", | ||
"minecraft:red_terracotta", | ||
"minecraft:black_terracotta", | ||
"minecraft:terracotta", | ||
"minecraft:white_glazed_terracotta", | ||
"minecraft:orange_glazed_terracotta", | ||
"minecraft:magenta_glazed_terracotta", | ||
"minecraft:light_blue_glazed_terracotta", | ||
"minecraft:yellow_glazed_terracotta", | ||
"minecraft:lime_glazed_terracotta", | ||
"minecraft:pink_glazed_terracotta", | ||
"minecraft:gray_glazed_terracotta", | ||
"minecraft:light_gray_glazed_terracotta", | ||
"minecraft:cyan_glazed_terracotta", | ||
"minecraft:purple_glazed_terracotta", | ||
"minecraft:blue_glazed_terracotta", | ||
"minecraft:brown_glazed_terracotta", | ||
"minecraft:green_glazed_terracotta", | ||
"minecraft:red_glazed_terracotta", | ||
"minecraft:black_glazed_terracotta" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters