Skip to content

Commit

Permalink
Adding (varying degrees of) conventional tags for Create mod.
Browse files Browse the repository at this point in the history
- Improve Create mod compatibility.
  • Loading branch information
gniftygnome committed Jun 10, 2023
1 parent da76cf0 commit 9821d52
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ protected void generateTags() {
addWood(TerrestriaBlockTags.YUCCA_PALM_LOGS, TerrestriaBlocks.YUCCA_PALM);

this.getOrCreateTagBuilder(BlockTags.LOGS_THAT_BURN)
.addTag(TerrestriaBlockTags.CYPRESS_LOGS)
.addTag(TerrestriaBlockTags.HEMLOCK_LOGS)
.addTag(TerrestriaBlockTags.JAPANESE_MAPLE_LOGS)
.addTag(TerrestriaBlockTags.RAINBOW_EUCALYPTUS_LOGS)
.addTag(TerrestriaBlockTags.REDWOOD_LOGS)
.addTag(TerrestriaBlockTags.RUBBER_LOGS)
.addTag(TerrestriaBlockTags.SAKURA_LOGS)
.addTag(TerrestriaBlockTags.SMALL_OAK_LOGS)
.addTag(TerrestriaBlockTags.WILLOW_LOGS)
.addTag(TerrestriaBlockTags.YUCCA_PALM_LOGS);
.addTag(TerrestriaBlockTags.SMALL_OAK_LOGS);
}

private void addDirt(DirtBlocks dirtBlock) {
getOrCreateTagBuilder(BlockTags.ANIMALS_SPAWNABLE_ON)
.add(dirtBlock.getGrassBlock());

getOrCreateTagBuilder(BlockTags.BIG_DRIPLEAF_PLACEABLE)
.add(dirtBlock.getFarmland());

getOrCreateTagBuilder(BlockTags.CONVERTABLE_TO_MUD)
.add(dirtBlock.getDirt());

getOrCreateTagBuilder(BlockTags.DIRT)
.add(dirtBlock.getDirt())
.add(dirtBlock.getGrassBlock())
Expand Down Expand Up @@ -174,24 +174,30 @@ private void addSand(SandBlock sandBlock) {
getOrCreateTagBuilder(BlockTags.SHOVEL_MINEABLE).add(sandBlock);
}

@SuppressWarnings("SameParameterValue")
private void addStone(TagKey<Block> stoneTag, StoneBlocks stoneBlock) {
FabricTagBuilder<Block> stoneBuilder = getOrCreateTagBuilder(stoneTag);
if (stoneBlock.bricks != null) {
stoneBuilder.add(stoneBlock.bricks.full);
addStoneVariant(stoneBlock.bricks);
getOrCreateTagBuilder(BlockTags.STONE_BRICKS).add(stoneBlock.bricks.full);

stoneBuilder.add(stoneBlock.chiseledBricks);
getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE).add(stoneBlock.chiseledBricks);
getOrCreateTagBuilder(BlockTags.STONE_BRICKS).add(stoneBlock.chiseledBricks);

stoneBuilder.add(stoneBlock.crackedBricks);
getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE).add(stoneBlock.crackedBricks);
getOrCreateTagBuilder(BlockTags.STONE_BRICKS).add(stoneBlock.crackedBricks);
}
if (stoneBlock.cobblestone != null) {
stoneBuilder.add(stoneBlock.cobblestone.full);
addStoneVariant(stoneBlock.cobblestone);
getOrCreateTagBuilder(TerrestriaBlockTags.COBBLESTONE).add(stoneBlock.cobblestone.full);
}
if (stoneBlock.mossyBricks != null) {
stoneBuilder.add(stoneBlock.mossyBricks.full);
getOrCreateTagBuilder(BlockTags.STONE_BRICKS).add(stoneBlock.mossyBricks.full);
addStoneVariant(stoneBlock.mossyBricks);
}
if (stoneBlock.mossyCobblestone != null) {
Expand All @@ -201,10 +207,12 @@ private void addStone(TagKey<Block> stoneTag, StoneBlocks stoneBlock) {
if (stoneBlock.plain != null) {
stoneBuilder.add(stoneBlock.plain.full);
addStoneVariant(stoneBlock.plain);
getOrCreateTagBuilder(TerrestriaBlockTags.STONE).add(stoneBlock.plain.full);
}
if (stoneBlock.smooth != null) {
stoneBuilder.add(stoneBlock.smooth.full);
addStoneVariant(stoneBlock.smooth);
getOrCreateTagBuilder(TerrestriaBlockTags.STONE).add(stoneBlock.smooth.full);
}

getOrCreateTagBuilder(BlockTags.BUTTONS).add(stoneBlock.button);
Expand All @@ -217,27 +225,31 @@ private void addStoneVariant(StoneVariantBlocks stoneVariantBlock) {
getOrCreateTagBuilder(BlockTags.WALLS).add(stoneVariantBlock.wall);

getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE)
.add(stoneVariantBlock.full)
.add(stoneVariantBlock.slab)
.add(stoneVariantBlock.stairs);
// Adding to WALLS does this for PICKAXE_MINEABLE.
.add(stoneVariantBlock.full)
.add(stoneVariantBlock.slab)
.add(stoneVariantBlock.stairs);
// Adding to WALLS does this for PICKAXE_MINEABLE.
}

private void addWood(TagKey<Block> logTag, WoodBlocks woodBlock) {
FabricTagBuilder<Block> woodBuilder = getOrCreateTagBuilder(logTag);
woodBuilder
.add(woodBlock.log)
.add(woodBlock.strippedLog);
getOrCreateTagBuilder(TerrestriaBlockTags.STRIPPED_LOGS).add(woodBlock.strippedLog);

if (woodBlock.strippedWood != null) {
woodBuilder.add(woodBlock.strippedWood);
getOrCreateTagBuilder(TerrestriaBlockTags.STRIPPED_WOOD).add(woodBlock.strippedWood);
}
if (woodBlock.wood != null) {
woodBuilder.add(woodBlock.wood);
}
if(woodBlock instanceof QuarteredWoodBlocks) {
if (woodBlock instanceof QuarteredWoodBlocks quarteredWoodBlocks) {
woodBuilder
.add(((QuarteredWoodBlocks) woodBlock).quarterLog)
.add(((QuarteredWoodBlocks) woodBlock).strippedQuarterLog);
.add(quarteredWoodBlocks.quarterLog)
.add(quarteredWoodBlocks.strippedQuarterLog);
getOrCreateTagBuilder(TerrestriaBlockTags.STRIPPED_LOGS).add(quarteredWoodBlocks.strippedQuarterLog);
}

getOrCreateTagBuilder(BlockTags.FENCE_GATES).add(woodBlock.fenceGate);
Expand All @@ -257,5 +269,10 @@ private void addWood(TagKey<Block> logTag, WoodBlocks woodBlock) {

// Adding to FENCE_GATES or any WOODEN tag does this for AXE_MINEABLE.
getOrCreateTagBuilder(BlockTags.HOE_MINEABLE).add(woodBlock.leaves);

// There is no way in this version of Minecraft to query whether a block burns.
// So, all the logs and planks burn. It's true, but also we've solved this in 1.19.4+.
getOrCreateTagBuilder(BlockTags.LOGS_THAT_BURN).addTag(logTag);
getOrCreateTagBuilder(TerrestriaBlockTags.PLANKS_THAT_BURN).add(woodBlock.planks);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private void addSand(BlockItem sandItem) {
getOrCreateTagBuilder(ItemTags.SAND).add(sandItem);
}

@SuppressWarnings("SameParameterValue")
private void addStone(TagKey<Item> stoneTag, StoneItems stoneItem) {
FabricTagBuilder<Item> stoneBuilder = getOrCreateTagBuilder(stoneTag);
if (stoneItem.bricks != null) {
Expand All @@ -126,6 +127,9 @@ private void addStone(TagKey<Item> stoneTag, StoneItems stoneItem) {
.add(stoneItem.crackedBricks);

addStoneVariant(stoneItem.bricks);
getOrCreateTagBuilder(ItemTags.STONE_BRICKS).add(stoneItem.bricks.full);
getOrCreateTagBuilder(ItemTags.STONE_BRICKS).add(stoneItem.chiseledBricks);
getOrCreateTagBuilder(ItemTags.STONE_BRICKS).add(stoneItem.crackedBricks);
}
if (stoneItem.cobblestone != null) {
stoneBuilder.add(stoneItem.cobblestone.full);
Expand All @@ -134,10 +138,12 @@ private void addStone(TagKey<Item> stoneTag, StoneItems stoneItem) {
// Add any cobble variant to vanilla crafting tags.
getOrCreateTagBuilder(ItemTags.STONE_CRAFTING_MATERIALS).add(stoneItem.cobblestone.full);
getOrCreateTagBuilder(ItemTags.STONE_TOOL_MATERIALS).add(stoneItem.cobblestone.full);
getOrCreateTagBuilder(TerrestriaItemTags.COBBLESTONE).add(stoneItem.cobblestone.full);
}
if (stoneItem.mossyBricks != null) {
stoneBuilder.add(stoneItem.mossyBricks.full);
addStoneVariant(stoneItem.mossyBricks);
getOrCreateTagBuilder(ItemTags.STONE_BRICKS).add(stoneItem.mossyBricks.full);
}
if (stoneItem.mossyCobblestone != null) {
stoneBuilder.add(stoneItem.mossyCobblestone.full);
Expand All @@ -146,10 +152,12 @@ private void addStone(TagKey<Item> stoneTag, StoneItems stoneItem) {
if (stoneItem.plain != null) {
stoneBuilder.add(stoneItem.plain.full);
addStoneVariant(stoneItem.plain);
getOrCreateTagBuilder(TerrestriaItemTags.STONE).add(stoneItem.plain.full);
}
if (stoneItem.smooth != null) {
stoneBuilder.add(stoneItem.smooth.full);
addStoneVariant(stoneItem.smooth);
getOrCreateTagBuilder(TerrestriaItemTags.STONE).add(stoneItem.smooth.full);
}

getOrCreateTagBuilder(ItemTags.BUTTONS).add(stoneItem.button);
Expand All @@ -162,23 +170,26 @@ private void addStoneVariant(StoneVariantItems stoneVariantItem) {
getOrCreateTagBuilder(ItemTags.WALLS).add(stoneVariantItem.wall);
}

private FabricTagBuilder<Item> addWood(TagKey<Item> logTag, WoodItems woodItem) {
private void addWood(TagKey<Item> logTag, WoodItems woodItem) {
FabricTagBuilder<Item> woodBuilder = getOrCreateTagBuilder(logTag);
woodBuilder
.add(woodItem.log)
.add(woodItem.strippedLog);
getOrCreateTagBuilder(TerrestriaItemTags.STRIPPED_LOGS).add(woodItem.strippedLog);

if (woodItem.strippedWood != null) {
woodBuilder.add(woodItem.strippedWood);
getOrCreateTagBuilder(TerrestriaItemTags.STRIPPED_WOOD).add(woodItem.strippedWood);
}
if (woodItem.wood != null) {
woodBuilder.add(woodItem.wood);
}

if (woodItem instanceof QuarteredWoodItems) {
if (woodItem instanceof QuarteredWoodItems quarteredWoodItems) {
woodBuilder
.add(((QuarteredWoodItems) woodItem).quarterLog)
.add(((QuarteredWoodItems) woodItem).strippedQuarterLog);
.add(quarteredWoodItems.quarterLog)
.add(quarteredWoodItems.strippedQuarterLog);
getOrCreateTagBuilder(TerrestriaItemTags.STRIPPED_LOGS).add(quarteredWoodItems.strippedQuarterLog);
}

// Add boats if they exist via the WoodItem.
Expand All @@ -202,7 +213,5 @@ private FabricTagBuilder<Item> addWood(TagKey<Item> logTag, WoodItems woodItem)
getOrCreateTagBuilder(ItemTags.WOODEN_SLABS).add(woodItem.slab);
getOrCreateTagBuilder(ItemTags.WOODEN_STAIRS).add(woodItem.stairs);
getOrCreateTagBuilder(ItemTags.WOODEN_TRAPDOORS).add(woodItem.trapdoor);

return(woodBuilder);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
public final class TerrestriaBlockTags {
public static final TagKey<Block> BASALT = TerrestriaBlockTags.of(new Identifier("c", "basalt"));
public static final TagKey<Block> BLACK_SAND = TerrestriaBlockTags.of(new Identifier("c", "black_sand"));
public static final TagKey<Block> COBBLESTONE = TerrestriaBlockTags.of(new Identifier("c", "cobblestone"));
public static final TagKey<Block> PLANKS_THAT_BURN = TerrestriaBlockTags.of(Identifier.of("c", "planks_that_burn"));
public static final TagKey<Block> STONE = TerrestriaBlockTags.of(new Identifier("c", "stone"));
public static final TagKey<Block> STRIPPED_LOGS = TerrestriaBlockTags.of(new Identifier("c", "stripped_logs"));
public static final TagKey<Block> STRIPPED_WOOD = TerrestriaBlockTags.of(new Identifier("c", "stripped_wood"));

public static final TagKey<Block> FARMLAND = TerrestriaBlockTags.of(new Identifier("terraform", "farmland"));
public static final TagKey<Block> GRASS_BLOCKS = TerrestriaBlockTags.of(new Identifier("terraform", "grass_blocks"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
import net.minecraft.util.registry.Registry;

public final class TerrestriaItemTags {
public static final TagKey<Item> BASALT = TerrestriaItemTags.of(Identifier.of("c", "basalt"));
public static final TagKey<Item> BLACK_SAND = TerrestriaItemTags.of(Identifier.of("c", "black_sand"));
public static final TagKey<Item> COBBLESTONE = TerrestriaItemTags.of(Identifier.of("c", "cobblestone"));
public static final TagKey<Item> PLANKS_THAT_BURN = TerrestriaItemTags.of(Identifier.of("c", "planks_that_burn"));
public static final TagKey<Item> STONE = TerrestriaItemTags.of(Identifier.of("c", "stone"));
public static final TagKey<Item> STRIPPED_LOGS = TerrestriaItemTags.of(Identifier.of("c", "stripped_logs"));
public static final TagKey<Item> STRIPPED_WOOD = TerrestriaItemTags.of(Identifier.of("c", "stripped_wood"));

public static final TagKey<Item> CYPRESS_LOGS = TerrestriaItemTags.of("cypress_logs");
public static final TagKey<Item> HEMLOCK_LOGS = TerrestriaItemTags.of("hemlock_logs");
public static final TagKey<Item> JAPANESE_MAPLE_LOGS = TerrestriaItemTags.of("japanese_maple_logs");
Expand All @@ -19,10 +27,7 @@ public final class TerrestriaItemTags {
public static final TagKey<Item> WILLOW_LOGS = TerrestriaItemTags.of("willow_logs");
public static final TagKey<Item> YUCCA_PALM_LOGS = TerrestriaItemTags.of("yucca_palm_logs");

public static final TagKey<Item> BASALT = TerrestriaItemTags.of(new Identifier("c", "basalt"));
public static final TagKey<Item> BLACK_SAND = TerrestriaItemTags.of(new Identifier("c", "black_sand"));
public static final TagKey<Item> PLANKS_THAT_BURN = TerrestriaItemTags.of(new Identifier("c", "planks_that_burn"));

@SuppressWarnings("UnnecessaryReturnStatement")
private TerrestriaItemTags() {
return;
}
Expand Down

0 comments on commit 9821d52

Please sign in to comment.