From b5afa41152e500bbbceec3ecc1bc25eae9a94246 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Fri, 19 Jun 2020 22:59:38 +0200 Subject: [PATCH] simplify duplicate tagging --- src/generated/resources/.cache/cache | 5 +++-- .../data/create/tags/items/create_ingots.json | 8 ++++++++ .../data/forge/tags/items/beacon_payment.json | 4 +--- .../data/forge/tags/items/ingots.json | 4 +--- .../java/com/simibubi/create/AllItems.java | 9 +++------ .../java/com/simibubi/create/AllTags.java | 19 ++++++++++++++++++- src/main/java/com/simibubi/create/Create.java | 1 + 7 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 src/generated/resources/data/create/tags/items/create_ingots.json diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index b43cf1fa1..f4f3cea87 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -2410,6 +2410,7 @@ d3fdb8ece6cb072a93ddb64a0baad5ac952117a4 data\create\recipes\weathered_limestone 6eceb25fabbb6b389ca35de3b829ad061c9c456a data\create\recipes\weathered_limestone_pillar.json 11667414f73bc2d00bda7c5c1a7d2934bf6e9165 data\create\recipes\weathered_limestone_pillar_from_weathered_limestone_stonecutting.json 266f08e604d229a9d2b46f7272c0b06ec270bf3d data\create\recipes\zinc_block.json +081f5aa35602fc27af2ca01ea9f2fd5e7eb284dc data\create\tags\items\create_ingots.json d2dc4ff179ef7b2aa9276455c196e15d44aa95a8 data\create\tags\items\crushed_ores.json 16bcb8fcbe9170c2c11f1ca8d99d8b36cd812bbd data\forge\tags\blocks\glass\colorless.json 81ced867d24ec814942909965dd4576eff1db685 data\forge\tags\blocks\glass_panes.json @@ -2418,10 +2419,10 @@ d5ea262a0f5fb210612d22521818e26cf08e591a data\forge\tags\blocks\ores\zinc.json ff1900963bc4cd8ceffa78d58ef1952ceacb2fb7 data\forge\tags\blocks\storage_blocks\brass.json f6c8f34ceb475546dba5cc6ff288863ea795d20b data\forge\tags\blocks\storage_blocks\copper.json 7f71a774800111e50b42de0e6159ed2d2a807d32 data\forge\tags\blocks\storage_blocks\zinc.json -081f5aa35602fc27af2ca01ea9f2fd5e7eb284dc data\forge\tags\items\beacon_payment.json +d9ffc62a496946fc4848934e7c0a6e917337f8be data\forge\tags\items\beacon_payment.json 16bcb8fcbe9170c2c11f1ca8d99d8b36cd812bbd data\forge\tags\items\glass\colorless.json 81ced867d24ec814942909965dd4576eff1db685 data\forge\tags\items\glass_panes.json -081f5aa35602fc27af2ca01ea9f2fd5e7eb284dc data\forge\tags\items\ingots.json +d9ffc62a496946fc4848934e7c0a6e917337f8be data\forge\tags\items\ingots.json 2dfd21017cb51d4bdc18d977a7d16f103cc3a985 data\forge\tags\items\ingots\brass.json 8e0ca32df10a50544f54fbe3dbfe485971b23315 data\forge\tags\items\ingots\copper.json 2f9ac80569a5cc168061742f9e3c36277d4d056e data\forge\tags\items\ingots\zinc.json diff --git a/src/generated/resources/data/create/tags/items/create_ingots.json b/src/generated/resources/data/create/tags/items/create_ingots.json new file mode 100644 index 000000000..c407a2e9a --- /dev/null +++ b/src/generated/resources/data/create/tags/items/create_ingots.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "create:copper_ingot", + "create:zinc_ingot", + "create:brass_ingot" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/beacon_payment.json b/src/generated/resources/data/forge/tags/items/beacon_payment.json index c407a2e9a..ad8bdef78 100644 --- a/src/generated/resources/data/forge/tags/items/beacon_payment.json +++ b/src/generated/resources/data/forge/tags/items/beacon_payment.json @@ -1,8 +1,6 @@ { "replace": false, "values": [ - "create:copper_ingot", - "create:zinc_ingot", - "create:brass_ingot" + "#create:create_ingots" ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots.json b/src/generated/resources/data/forge/tags/items/ingots.json index c407a2e9a..ad8bdef78 100644 --- a/src/generated/resources/data/forge/tags/items/ingots.json +++ b/src/generated/resources/data/forge/tags/items/ingots.json @@ -1,8 +1,6 @@ { "replace": false, "values": [ - "create:copper_ingot", - "create:zinc_ingot", - "create:brass_ingot" + "#create:create_ingots" ] } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index f5f3dea79..e2efd67a0 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -72,12 +72,9 @@ public class AllItems { CRUSHED_BRASS = taggedIngredient("crushed_brass", AllItemTags.CRUSHED_ORES.tag), ANDESITE_ALLOY = ingredient("andesite_alloy"), - COPPER_INGOT = taggedIngredient("copper_ingot", forgeItemTag("ingots/copper"), AllItemTags.beacon_payment.tag, - AllItemTags.ingots.tag), - ZINC_INGOT = taggedIngredient("zinc_ingot", forgeItemTag("ingots/zinc"), AllItemTags.beacon_payment.tag, - AllItemTags.ingots.tag), - BRASS_INGOT = taggedIngredient("brass_ingot", forgeItemTag("ingots/brass"), AllItemTags.beacon_payment.tag, - AllItemTags.ingots.tag), + COPPER_INGOT = taggedIngredient("copper_ingot", forgeItemTag("ingots/copper"), AllItemTags.CREATE_INGOTS.tag), + ZINC_INGOT = taggedIngredient("zinc_ingot", forgeItemTag("ingots/zinc"), AllItemTags.CREATE_INGOTS.tag), + BRASS_INGOT = taggedIngredient("brass_ingot", forgeItemTag("ingots/brass"), AllItemTags.CREATE_INGOTS.tag), WHEAT_FLOUR = ingredient("wheat_flour"), DOUGH = ingredient("dough"), POWDERED_OBSIDIAN = ingredient("powdered_obsidian"), ROSE_QUARTZ = ingredient("rose_quartz"), diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index f52320c81..cfa4fb101 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -1,8 +1,10 @@ package com.simibubi.create; +import com.simibubi.create.foundation.data.CreateRegistrate; import com.simibubi.create.foundation.utility.Lang; import com.tterrag.registrate.builders.BlockBuilder; import com.tterrag.registrate.builders.ItemBuilder; +import com.tterrag.registrate.providers.ProviderType; import com.tterrag.registrate.util.nullness.NonNullFunction; import net.minecraft.block.Block; @@ -17,6 +19,9 @@ import net.minecraft.tags.TagCollection; import net.minecraft.util.ResourceLocation; public class AllTags { + private static final CreateRegistrate REGISTRATE = Create.registrate() + .itemGroup(() -> Create.baseCreativeTab); + public static NonNullFunction, ItemBuilder>> tagBlockAndItem( String tagName) { return b -> b.tag(forgeBlockTag(tagName)) @@ -41,7 +46,12 @@ public class AllTags { } public static enum AllItemTags { - CRUSHED_ORES, beacon_payment("", "forge"), ingots("", "forge"), nuggets("", "forge"), plates("", "forge"); + CRUSHED_ORES, + CREATE_INGOTS, + beacon_payment("", "forge"), + ingots("", "forge"), + nuggets("", "forge"), + plates("", "forge"); public Tag tag; @@ -81,4 +91,11 @@ public class AllTags { return tag.contains(block.getBlock()); } } + + public static void register() { + REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getBuilder(AllItemTags.beacon_payment.tag) + .add(AllItemTags.CREATE_INGOTS.tag)); + REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getBuilder(AllItemTags.ingots.tag) + .add(AllItemTags.CREATE_INGOTS.tag)); + } } diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index d049b61c4..0033adc32 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -57,6 +57,7 @@ public class Create { AllBlocks.register(); AllItems.register(); + AllTags.register(); AllPaletteBlocks.register(); AllEntityTypes.register(); AllTileEntities.register();