From be5885155c0072721c95a23a0b2ee13483c37b8a Mon Sep 17 00:00:00 2001 From: tterrag Date: Wed, 2 Sep 2020 23:18:22 -0400 Subject: [PATCH] Add validation via resources for tag providers (#7271) BREAKING CHANGE: Moved ExistingFileHelper to common package Remove various workarounds from forge tag providers --- .../data/BlockTagsProvider.java.patch | 16 +++ .../data/EntityTypeTagsProvider.java.patch | 16 +++ .../data/FluidTagsProvider.java.patch | 16 +++ .../data/ItemTagsProvider.java.patch | 18 ++++ .../minecraft/data/TagsProvider.java.patch | 56 +++++++--- .../net/minecraft/tags/ITag.java.patch | 3 +- src/generated_test/resources/.cache/cache | 100 +++++++++--------- .../assets/data_gen_test/lang/en_us.json | 1 - .../model/generators/BlockModelBuilder.java | 1 + .../model/generators/BlockModelProvider.java | 1 + .../model/generators/BlockStateProvider.java | 1 + .../model/generators/ItemModelBuilder.java | 1 + .../model/generators/ItemModelProvider.java | 1 + .../client/model/generators/ModelBuilder.java | 1 + .../client/model/generators/ModelFile.java | 1 + .../model/generators/ModelProvider.java | 1 + .../net/minecraftforge/common/ForgeMod.java | 4 +- .../data}/ExistingFileHelper.java | 2 +- .../common/data/ForgeBlockTagsProvider.java | 18 +--- .../common/data/ForgeItemTagsProvider.java | 18 +--- .../net/minecraftforge/fml/ModLoader.java | 2 +- .../fml/event/lifecycle/GatherDataEvent.java | 2 +- src/main/resources/forge.exc | 5 + .../debug/DataGeneratorTest.java | 25 ++--- .../debug/block/PistonEventTest.java | 2 +- 25 files changed, 191 insertions(+), 121 deletions(-) create mode 100644 patches/minecraft/net/minecraft/data/BlockTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/EntityTypeTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/FluidTagsProvider.java.patch create mode 100644 patches/minecraft/net/minecraft/data/ItemTagsProvider.java.patch rename src/main/java/net/minecraftforge/{client/model/generators => common/data}/ExistingFileHelper.java (98%) diff --git a/patches/minecraft/net/minecraft/data/BlockTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/BlockTagsProvider.java.patch new file mode 100644 index 000000000..7e6267a87 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/BlockTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/BlockTagsProvider.java ++++ b/net/minecraft/data/BlockTagsProvider.java +@@ -8,9 +8,13 @@ + import net.minecraft.util.registry.Registry; + + public class BlockTagsProvider extends TagsProvider { ++ @Deprecated + public BlockTagsProvider(DataGenerator p_i48256_1_) { + super(p_i48256_1_, Registry.field_212618_g); + } ++ public BlockTagsProvider(DataGenerator p_i48256_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_i48256_1_, Registry.field_212618_g, modId, existingFileHelper); ++ } + + protected void func_200432_c() { + this.func_240522_a_(BlockTags.field_199897_a).func_240534_a_(Blocks.field_196556_aL, Blocks.field_196557_aM, Blocks.field_196558_aN, Blocks.field_196559_aO, Blocks.field_196560_aP, Blocks.field_196561_aQ, Blocks.field_196562_aR, Blocks.field_196563_aS, Blocks.field_196564_aT, Blocks.field_196565_aU, Blocks.field_196566_aV, Blocks.field_196567_aW, Blocks.field_196568_aX, Blocks.field_196569_aY, Blocks.field_196570_aZ, Blocks.field_196602_ba); diff --git a/patches/minecraft/net/minecraft/data/EntityTypeTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/EntityTypeTagsProvider.java.patch new file mode 100644 index 000000000..79a282484 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/EntityTypeTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/EntityTypeTagsProvider.java ++++ b/net/minecraft/data/EntityTypeTagsProvider.java +@@ -7,9 +7,13 @@ + import net.minecraft.util.registry.Registry; + + public class EntityTypeTagsProvider extends TagsProvider> { ++ @Deprecated + public EntityTypeTagsProvider(DataGenerator p_i50784_1_) { + super(p_i50784_1_, Registry.field_212629_r); + } ++ public EntityTypeTagsProvider(DataGenerator p_i50784_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_i50784_1_, Registry.field_212629_r, modId, existingFileHelper); ++ } + + protected void func_200432_c() { + this.func_240522_a_(EntityTypeTags.field_219764_a).func_240534_a_(EntityType.field_200741_ag, EntityType.field_200750_ap, EntityType.field_200722_aA); diff --git a/patches/minecraft/net/minecraft/data/FluidTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/FluidTagsProvider.java.patch new file mode 100644 index 000000000..61cec0884 --- /dev/null +++ b/patches/minecraft/net/minecraft/data/FluidTagsProvider.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/data/FluidTagsProvider.java ++++ b/net/minecraft/data/FluidTagsProvider.java +@@ -8,9 +8,13 @@ + import net.minecraft.util.registry.Registry; + + public class FluidTagsProvider extends TagsProvider { ++ @Deprecated + public FluidTagsProvider(DataGenerator p_i49156_1_) { + super(p_i49156_1_, Registry.field_212619_h); + } ++ public FluidTagsProvider(DataGenerator p_i49156_1_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_i49156_1_, Registry.field_212619_h, modId, existingFileHelper); ++ } + + protected void func_200432_c() { + this.func_240522_a_(FluidTags.field_206959_a).func_240534_a_(Fluids.field_204546_a, Fluids.field_207212_b); diff --git a/patches/minecraft/net/minecraft/data/ItemTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/ItemTagsProvider.java.patch new file mode 100644 index 000000000..3cdae251d --- /dev/null +++ b/patches/minecraft/net/minecraft/data/ItemTagsProvider.java.patch @@ -0,0 +1,18 @@ +--- a/net/minecraft/data/ItemTagsProvider.java ++++ b/net/minecraft/data/ItemTagsProvider.java +@@ -14,10 +14,15 @@ + public class ItemTagsProvider extends TagsProvider { + private final Function, ITag.Builder> field_240520_d_; + ++ @Deprecated + public ItemTagsProvider(DataGenerator p_i232552_1_, BlockTagsProvider p_i232552_2_) { + super(p_i232552_1_, Registry.field_212630_s); + this.field_240520_d_ = p_i232552_2_::func_240525_b_; + } ++ public ItemTagsProvider(DataGenerator p_i232552_1_, BlockTagsProvider p_i232552_2_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { ++ super(p_i232552_1_, Registry.field_212630_s, modId, existingFileHelper); ++ this.field_240520_d_ = p_i232552_2_::func_240525_b_; ++ } + + protected void func_200432_c() { + this.func_240521_a_(BlockTags.field_199897_a, ItemTags.field_199904_a); diff --git a/patches/minecraft/net/minecraft/data/TagsProvider.java.patch b/patches/minecraft/net/minecraft/data/TagsProvider.java.patch index ab865dea7..5c7683c1c 100644 --- a/patches/minecraft/net/minecraft/data/TagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/TagsProvider.java.patch @@ -1,26 +1,33 @@ --- a/net/minecraft/data/TagsProvider.java +++ b/net/minecraft/data/TagsProvider.java -@@ -28,11 +28,17 @@ +@@ -28,10 +28,18 @@ protected final DataGenerator field_200433_a; protected final Registry field_200435_c; protected final Map field_200434_b = Maps.newLinkedHashMap(); -+ protected String modId; ++ protected final String modId; ++ protected final net.minecraftforge.common.data.ExistingFileHelper existingFileHelper; + @Deprecated//Forge, Use ModID version. protected TagsProvider(DataGenerator p_i49827_1_, Registry p_i49827_2_) { -- this.field_200433_a = p_i49827_1_; -- this.field_200435_c = p_i49827_2_; -+ this(p_i49827_1_, p_i49827_2_, "vanilla"); - } -+ protected TagsProvider(DataGenerator generatorIn, Registry registryIn, String modId) { -+ this.field_200433_a = generatorIn; -+ this.field_200435_c = registryIn; -+ this.modId = modId; ++ this(p_i49827_1_, p_i49827_2_, "vanilla", null); + } ++ protected TagsProvider(DataGenerator p_i49827_1_, Registry p_i49827_2_, String modId, @javax.annotation.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) { + this.field_200433_a = p_i49827_1_; + this.field_200435_c = p_i49827_2_; ++ this.modId = modId; ++ this.existingFileHelper = existingFileHelper; + } protected abstract void func_200432_c(); - -@@ -53,6 +59,7 @@ +@@ -47,12 +55,14 @@ + return this.field_200435_c.func_241873_b(p_240527_1_).orElse((T)null); + }; + this.field_200434_b.forEach((p_240524_4_, p_240524_5_) -> { +- List list = p_240524_5_.func_232963_b_(function, function1).collect(Collectors.toList()); ++ // FORGE: Add validation via existing resources ++ List list = p_240524_5_.func_232963_b_(function, function1).filter(this::missing).collect(Collectors.toList()); + if (!list.isEmpty()) { + throw new IllegalArgumentException(String.format("Couldn't define tag %s as it is missing following references: %s", p_240524_4_, list.stream().map(Objects::toString).collect(Collectors.joining(",")))); } else { JsonObject jsonobject = p_240524_5_.func_232965_c_(); Path path = this.func_200431_a(p_240524_4_); @@ -28,7 +35,26 @@ try { String s = field_200437_e.toJson((JsonElement)jsonobject); -@@ -78,7 +85,7 @@ +@@ -74,11 +84,26 @@ + }); + } + ++ private boolean missing(ITag.Proxy reference) { ++ ITag.ITagEntry entry = reference.func_232968_a_(); ++ // We only care about non-optional tag entries, this is the only type that can reference a resource and needs validation ++ // Optional tags should not be validated ++ if (entry instanceof ITag.TagEntry) { ++ return existingFileHelper == null || !existingFileHelper.exists(((ITag.TagEntry)entry).getId(), net.minecraft.resources.ResourcePackType.SERVER_DATA, ".json", "tags/" + getTagFolder()); ++ } ++ return false; ++ } ++ ++ @SuppressWarnings({ "unchecked", "rawtypes" }) ++ protected String getTagFolder() { ++ return ((Registry)Registry.field_212617_f).func_177774_c(field_200435_c).func_110623_a() + "s"; ++ } ++ + protected abstract Path func_200431_a(ResourceLocation p_200431_1_); protected TagsProvider.Builder func_240522_a_(ITag.INamedTag p_240522_1_) { ITag.Builder itag$builder = this.func_240525_b_(p_240522_1_); @@ -37,7 +63,7 @@ } protected ITag.Builder func_240525_b_(ITag.INamedTag p_240525_1_) { -@@ -87,7 +94,7 @@ +@@ -87,7 +112,7 @@ }); } @@ -46,7 +72,7 @@ private final ITag.Builder field_240528_a_; private final Registry field_240529_b_; private final String field_240530_c_; -@@ -115,5 +122,18 @@ +@@ -115,5 +140,18 @@ }); return this; } diff --git a/patches/minecraft/net/minecraft/tags/ITag.java.patch b/patches/minecraft/net/minecraft/tags/ITag.java.patch index 8608888c9..41ea14199 100644 --- a/patches/minecraft/net/minecraft/tags/ITag.java.patch +++ b/patches/minecraft/net/minecraft/tags/ITag.java.patch @@ -49,10 +49,11 @@ } public static class OptionalItemEntry implements ITag.ITagEntry { -@@ -278,5 +290,6 @@ +@@ -278,5 +290,7 @@ public String toString() { return "#" + this.field_200163_a; } + @Override public boolean equals(Object o) { return o == this || (o instanceof ITag.TagEntry && java.util.Objects.equals(this.field_200163_a, ((ITag.TagEntry) o).field_200163_a)); } ++ public ResourceLocation getId() { return field_200163_a; } } } diff --git a/src/generated_test/resources/.cache/cache b/src/generated_test/resources/.cache/cache index 3ebd03ab4..b6c98ea82 100644 --- a/src/generated_test/resources/.cache/cache +++ b/src/generated_test/resources/.cache/cache @@ -1,60 +1,62 @@ -25f832a55d9d61fe27871ce866ef712b625032cc assets/data_gen_test/lang/en_us.json -dc2deb0c2da07695855bbb88882455a80787ccac assets/data_gen_test/models/block/acacia_door_bottom.json -e987df4921fc71322984556e9617915d4df2bdff assets/data_gen_test/models/block/acacia_door_bottom_hinge.json -5103910559b21ce74f315358935a3e582b0c45cd assets/data_gen_test/models/block/acacia_door_top.json -590e2cc0ba335ffc618441d6fcc582401ee646cc assets/data_gen_test/models/block/acacia_door_top_hinge.json -9c4e371aace89c681b4ea367975f9b4569acaada assets/data_gen_test/models/block/acacia_fence_gate.json -1e2e4ace5adef04a3cee3d528c33382a18f40513 assets/data_gen_test/models/block/acacia_fence_gate_open.json -557312487766c0801958d72d13b0ac16d8d5d9fd assets/data_gen_test/models/block/acacia_fence_gate_wall.json -dd8d2e76831b2a445737f378458db5c505a9b03d assets/data_gen_test/models/block/acacia_fence_gate_wall_open.json -4d5b8be3e004e34e75c0f7d415595e14f8985d6c assets/data_gen_test/models/block/acacia_fence_post.json -90491fcfa42ee4d8ec7958655866f5a3b55811ad assets/data_gen_test/models/block/acacia_fence_side.json -9bf079dec64b632446a867744149d0fccff6fc70 assets/data_gen_test/models/block/acacia_log.json -462367a50d9ab2306ca642a72b5fd20c217dc451 assets/data_gen_test/models/block/acacia_slab.json -3032bec1f17684ceef914e3763b9be773d17b02f assets/data_gen_test/models/block/acacia_slab_top.json -3611756373823dced8f5db5237a6ee0a5f3cbb7a assets/data_gen_test/models/block/acacia_stairs.json -72a7c67a73c6217ad117d5583a329e89fd34f246 assets/data_gen_test/models/block/acacia_stairs_inner.json -34f85d11d44a198433f530bd54c2c172d7699872 assets/data_gen_test/models/block/acacia_stairs_outer.json -31c3b7793cb61870bd74e8e85af7597be57827c6 assets/data_gen_test/models/block/acacia_trapdoor_bottom.json -8be9644fe5227cb2c3af52af01b02e9c2c4f9a38 assets/data_gen_test/models/block/acacia_trapdoor_open.json -8978e4a1d2902029738eac82749ffc2c30088fe9 assets/data_gen_test/models/block/acacia_trapdoor_top.json -88c7bca952fda50e5287ddb5c2e74ff179d08eb2 assets/data_gen_test/models/block/barrel.json -ce5d10ee7ab7afed216f3159bdcd5b1deb114104 assets/data_gen_test/models/block/barrel_open.json -c3ecb601615c300cafbdd9dc28f9fc42b6835dcd assets/data_gen_test/models/block/birch_fence_gate.json -3bcea12fba8714c7ad7c00f440f3e7546a8958ce assets/data_gen_test/models/block/birch_fence_gate_open.json -13b47687fb80334b3e51781e691f53f8073843a7 assets/data_gen_test/models/block/birch_fence_gate_wall.json -dd0a89461e5f72c08ccf6f3d07bce9c290019022 assets/data_gen_test/models/block/birch_fence_gate_wall_open.json +a9cf5409aca6b29f95eff8309254d1bd8ec98a21 assets/data_gen_test/lang/en_us.json +50b86f9a70b2f9c1c0f65407a53cd0a11274bbc6 assets/data_gen_test/models/block/acacia_door_bottom.json +99ed466fe923281f2239bac1f4ff0d455dbb6fb5 assets/data_gen_test/models/block/acacia_door_bottom_hinge.json +e72eaab1dd012741114d4cb718b257a44420eef8 assets/data_gen_test/models/block/acacia_door_top.json +3cd89a1bf3ee19b6917721796a53dfde5bc4d764 assets/data_gen_test/models/block/acacia_door_top_hinge.json +e267e3cd85282291d97148a330e7857ba75df85d assets/data_gen_test/models/block/acacia_fence_gate.json +a56c3472de2dd6b175f0926b295b7f0b9c92a0b7 assets/data_gen_test/models/block/acacia_fence_gate_open.json +5c8a634491d6465c9da6983878ea22b71c0e0ae6 assets/data_gen_test/models/block/acacia_fence_gate_wall.json +2ebae83ff7451e4c142cd46ae74b523d307618c8 assets/data_gen_test/models/block/acacia_fence_gate_wall_open.json +611969c44ad660c1f6c12c9e5c5a7d784b7f7a22 assets/data_gen_test/models/block/acacia_fence_post.json +e02938f13d9603e2386e35de87f1c4a7e6872747 assets/data_gen_test/models/block/acacia_fence_side.json +874d39d611b7c6276d495596035b796b3d745518 assets/data_gen_test/models/block/acacia_log.json +a3653df2772aebce449fdfa3cb90ca744c63986f assets/data_gen_test/models/block/acacia_log_horizontal.json +921e28f174a3e6f99d9862956821fd89b7b433bf assets/data_gen_test/models/block/acacia_slab.json +fb8b01d93255d1363969d9f5ac09bdcc53b26706 assets/data_gen_test/models/block/acacia_slab_top.json +098d5642c4fff739615fbcc676cd7635ecadbb62 assets/data_gen_test/models/block/acacia_stairs.json +f225c575beba9f52fafa9b24ec15b9754d6371c5 assets/data_gen_test/models/block/acacia_stairs_inner.json +909c9ed3baf0acb762dedd4f5e4d5aaf9ef66ee1 assets/data_gen_test/models/block/acacia_stairs_outer.json +d08718b62ded7c528b7b249fb950488a08f487a7 assets/data_gen_test/models/block/acacia_trapdoor_bottom.json +314bfae35e576597a6ede4f2083e1632fe4bf5a7 assets/data_gen_test/models/block/acacia_trapdoor_open.json +545c25cccf3803195a7293cf99cdd6385ac1f96d assets/data_gen_test/models/block/acacia_trapdoor_top.json +b07b4e3dbd294ec20b93615a40b69b18dcd229a2 assets/data_gen_test/models/block/barrel.json +32e192b203624058aa8f7b6af52d1fa7de384725 assets/data_gen_test/models/block/barrel_open.json +0ce1da46399e06a8b9d6314787fe4d94cbdfedc6 assets/data_gen_test/models/block/birch_fence_gate.json +eb28ba3bd186bbfdcf2302ce938d166ac9c87856 assets/data_gen_test/models/block/birch_fence_gate_open.json +cd05c0d5983e415ec4d610591c783cdff8b6a8ca assets/data_gen_test/models/block/birch_fence_gate_wall.json +e701d4ff5aa062ca4fe612ee3efed4aec14f436e assets/data_gen_test/models/block/birch_fence_gate_wall_open.json 49948428acf0defe004ff07718afd9b50fc41326 assets/data_gen_test/models/block/block.json -42fcd2c027f204708f423808f22f6e4c0d5f586b assets/data_gen_test/models/block/cobblestone_wall_post.json -21d8ec1410152c67c4b7a06184be545ef1e1d0cf assets/data_gen_test/models/block/cobblestone_wall_side.json +a11f3003da1d2e8928895c767ceab94468269cdb assets/data_gen_test/models/block/cobblestone_wall_post.json +2119f2dc78e8fb8788db71f1fbf8fd18efc35f12 assets/data_gen_test/models/block/cobblestone_wall_side.json +795b63de0b2793493d862f7d34f2c162cf231af5 assets/data_gen_test/models/block/cobblestone_wall_side_tall.json 26c80ee9a99336b434c9984445bfcf01b25f2cd0 assets/data_gen_test/models/block/cube.json -428f68585535789c809eb40d8151a5baa2b0045b assets/data_gen_test/models/block/furnace.json -51a161348cf0c51252dbdbad035b7945e02a8763 assets/data_gen_test/models/block/furnace_on.json -eb911d39c848d09bc5910aef1a86af63b4fbb6c6 assets/data_gen_test/models/block/glass_pane_noside.json -e5df8cc0b7dd9f79fe930711bcf8e60385b8b7ab assets/data_gen_test/models/block/glass_pane_noside_alt.json -b178beb42e1db7d177ceb28f0703876943c22a90 assets/data_gen_test/models/block/glass_pane_post.json -17cd1168c6c32e1fbd870a9e61716aed6ba7c8a2 assets/data_gen_test/models/block/glass_pane_side.json -85326250de254ad1bba0ad183c78e876afa3da51 assets/data_gen_test/models/block/glass_pane_side_alt.json -cebd38234491e0882901230538b4205bcf816597 assets/data_gen_test/models/block/oak_trapdoor_bottom.json -d8842f8f1a63ee4ac0bcc52e83a375de983b8bb0 assets/data_gen_test/models/block/oak_trapdoor_open.json -091f1cf54c828d8c8315cedeb28a3f864a72456e assets/data_gen_test/models/block/oak_trapdoor_top.json -a5ace137c931b71acf2599184832187a241acc9c assets/data_gen_test/models/block/stone.json -78f9176f15f3a728ee20b5a734e89a32c8108395 assets/data_gen_test/models/block/torch.json -e1820400e7b8e4011121eae3f7c873d73f301cd7 assets/data_gen_test/models/block/wall_torch.json -d96ff395b92ed2419c8c4aa6e61a610ef78b3216 assets/data_gen_test/models/item/fishing_rod.json -abe69efd05a6349acca7e39f3353d7c928a55a72 assets/data_gen_test/models/item/fishing_rod_cast.json -e1a3a09af48181e868c26741053e36eafe8bead6 assets/data_gen_test/models/item/test_block_model.json -9a27e0d9a3f3d2a834eff92661e090eeda1c59fe assets/data_gen_test/models/item/test_generated_model.json +2438b91cbedbdedb9b6bd59af9e6960b2a44fd4c assets/data_gen_test/models/block/furnace.json +e6a83e45c49c170705d76ae3234119db14220b4a assets/data_gen_test/models/block/furnace_on.json +26798b264a5530d43dfab028c269db3cd9c19ee1 assets/data_gen_test/models/block/glass_pane_noside.json +24654193c65e4e933df05b5c29686039d53e1705 assets/data_gen_test/models/block/glass_pane_noside_alt.json +899c995dfe5cd9eb8f6a9b90e60a2b31b5b835a7 assets/data_gen_test/models/block/glass_pane_post.json +8e4fb1b8dd3be98709ad233d76e914ee7ed5d1e7 assets/data_gen_test/models/block/glass_pane_side.json +725ddf2e14db508478d8d78397a2294d1ee51140 assets/data_gen_test/models/block/glass_pane_side_alt.json +c4d268471ee793597917c966d1aaed29e438d366 assets/data_gen_test/models/block/oak_trapdoor_bottom.json +2abb8b11c91441badd91b7c52f5f8ba3226c92de assets/data_gen_test/models/block/oak_trapdoor_open.json +560d419e3d542cb0509bca078988308d387c15a9 assets/data_gen_test/models/block/oak_trapdoor_top.json +556f0d997250661e0401fba13a4afd1bb0627dcc assets/data_gen_test/models/block/stone.json +db2cd929128c8a6e8e0b02437f90ad8d24238206 assets/data_gen_test/models/block/torch.json +81ce9ac0a7f4ed7a94d5496b918987a6f5a24988 assets/data_gen_test/models/block/wall_torch.json +6b40df2a47c13cd00e295244b6cf74462938359d assets/data_gen_test/models/item/fishing_rod.json +7fecdc30a209fca790df79b973c30b9e84415e0b assets/data_gen_test/models/item/fishing_rod_cast.json +b029993275f16569b0edf093362f55df6ea6f9be assets/data_gen_test/models/item/test_block_model.json +726e1884e53151492ca05bd752c67031603570f6 assets/data_gen_test/models/item/test_generated_model.json 1767c874758bd7c3235db446b6219e6e1edd25b4 assets/minecraft/blockstates/acacia_door.json e41383b4c13ec922c0f5cfa2cc313d88fd294685 assets/minecraft/blockstates/acacia_fence.json 967d268bfcf32474b61578bef16e853b6360dd73 assets/minecraft/blockstates/acacia_fence_gate.json -e9af65f877e6d012bce27ae35eef3822dda98675 assets/minecraft/blockstates/acacia_log.json +3d8a5e75de9324c98d0e26dcc848ed6545c1a7b2 assets/minecraft/blockstates/acacia_log.json 2fc1c2cff82aaebdb4ecf298e6de278c62cce3b3 assets/minecraft/blockstates/acacia_slab.json 075938fd82340c895eff226d11898abae9a5e178 assets/minecraft/blockstates/acacia_stairs.json 9384d458574395650a976b3ad1fe5905b100ddbf assets/minecraft/blockstates/acacia_trapdoor.json 42a10a132337264c8821426e17d0c09b92ad42f9 assets/minecraft/blockstates/barrel.json 9bc8ba4b8e4ad3cc7074838cf1bf8dad89e2b339 assets/minecraft/blockstates/birch_fence_gate.json -acbf9f921b05785d49d8526870ba13aee1a322f7 assets/minecraft/blockstates/cobblestone_wall.json +cd097e56cf2332a07ae31c2cacb01cba69e53ab3 assets/minecraft/blockstates/cobblestone_wall.json 6a3c8e2691b6b7f39f1236a17bb6aa145a9db53f assets/minecraft/blockstates/furnace.json 1b2a1344020237ab877e27c43934b042d259bf36 assets/minecraft/blockstates/glass_pane.json bf2e445b48b024354a69138b20a4a4a8aa5d15d1 assets/minecraft/blockstates/oak_trapdoor.json @@ -62,11 +64,11 @@ bf2e445b48b024354a69138b20a4a4a8aa5d15d1 assets/minecraft/blockstates/oak_trapdo 570fdd86046df75a073b759ff7aaf4c4caf43115 assets/minecraft/blockstates/torch.json a012d6d92bab1c91913bd0f2dc0492a0fce916f2 assets/minecraft/blockstates/wall_torch.json 273e0ed992d227f09f1c83bc22d066fb68d03c84 assets/piston_event_test/blockstates/shiftonmove.json -108951e1323586dab98f296c9ead9b2084eb879a assets/piston_event_test/models/block/shiftonmove.json +d2c8e860521c5e738ed0798337f5728d610825ff assets/piston_event_test/models/block/shiftonmove.json f51f026a75e27a0a53a76771d553c0e3385a2966 assets/piston_event_test/models/item/shiftonmove.json 4fbaf6f4a3ea05cc071076e27f44ac81f9cc50e3 data/data_gen_test/advancements/conditional.json ed4cbf1a3a2f5d8969f6346fdc9acdbe81d0c919 data/data_gen_test/recipes/conditional.json -2c3e2073a1597baaa2970de5ae1649781f87aef8 data/data_gen_test/tags/blocks/test.json +40208299608468b044f64317995f9182ec219d90 data/data_gen_test/tags/blocks/test.json d65c425e740dc833f29d16606a1171825876be0d data/data_gen_test/tags/blocks/thing/one.json 1f70ed4ddc878bada5e43d3c44a34157806beda8 data/data_gen_test/tags/blocks/thing/three.json 2c648bca262caaa826ddbbde796d35bb2ee5f03a data/data_gen_test/tags/blocks/thing/two.json diff --git a/src/generated_test/resources/assets/data_gen_test/lang/en_us.json b/src/generated_test/resources/assets/data_gen_test/lang/en_us.json index 28222703c..ba4c5b31e 100644 --- a/src/generated_test/resources/assets/data_gen_test/lang/en_us.json +++ b/src/generated_test/resources/assets/data_gen_test/lang/en_us.json @@ -1,5 +1,4 @@ { - "biome.minecraft.beach": "Beach", "block.minecraft.stone": "Stone", "data_gen_test.test.unicode": "\u0287s\u01DD\u2534 \u01DDpo\u0254\u1D09u\u2229", "effect.minecraft.poison": "Poison", diff --git a/src/main/java/net/minecraftforge/client/model/generators/BlockModelBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/BlockModelBuilder.java index f0a267663..4502ad3c9 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/BlockModelBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/BlockModelBuilder.java @@ -20,6 +20,7 @@ package net.minecraftforge.client.model.generators; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.data.ExistingFileHelper; /** * Builder for block models, does not currently provide any additional diff --git a/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java b/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java index 29b821e2d..32e8795bb 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/BlockModelProvider.java @@ -22,6 +22,7 @@ package net.minecraftforge.client.model.generators; import javax.annotation.Nonnull; import net.minecraft.data.DataGenerator; +import net.minecraftforge.common.data.ExistingFileHelper; /** * Stub class to extend for block model data providers, eliminates some diff --git a/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java b/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java index 6ec3ac868..9c19f5a9f 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java @@ -69,6 +69,7 @@ import net.minecraft.state.properties.SlabType; import net.minecraft.state.properties.StairsShape; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; +import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraft.util.ResourceLocation; /** diff --git a/src/main/java/net/minecraftforge/client/model/generators/ItemModelBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/ItemModelBuilder.java index ece466bb7..a352e5275 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ItemModelBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ItemModelBuilder.java @@ -29,6 +29,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.data.ExistingFileHelper; /** * Builder for item models, adds the ability to build overrides via diff --git a/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java b/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java index 9d7c4b559..abba578e9 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ItemModelProvider.java @@ -22,6 +22,7 @@ package net.minecraftforge.client.model.generators; import javax.annotation.Nonnull; import net.minecraft.data.DataGenerator; +import net.minecraftforge.common.data.ExistingFileHelper; /** * Stub class to extend for item model data providers, eliminates some diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java index a44470425..b59d23b78 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java @@ -37,6 +37,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import net.minecraft.util.math.vector.Vector3f; +import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraft.client.renderer.model.BlockFaceUV; import net.minecraft.client.renderer.model.BlockPart; import net.minecraft.client.renderer.model.BlockPartFace; diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelFile.java b/src/main/java/net/minecraftforge/client/model/generators/ModelFile.java index 9d4012957..6e5016dda 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelFile.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelFile.java @@ -23,6 +23,7 @@ import com.google.common.base.Preconditions; import net.minecraft.resources.ResourcePackType; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.data.ExistingFileHelper; public abstract class ModelFile { diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java b/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java index 232e3d06e..5ae8aece2 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java @@ -37,6 +37,7 @@ import net.minecraft.data.DirectoryCache; import net.minecraft.data.IDataProvider; import net.minecraft.resources.ResourcePackType; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.data.ExistingFileHelper; public abstract class ModelProvider> implements IDataProvider { diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index b3f1a4427..7a31767c6 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -188,9 +188,9 @@ public class ForgeMod implements WorldPersistenceHooks.WorldPersistenceHook if (event.includeServer()) { - ForgeBlockTagsProvider blockTags = new ForgeBlockTagsProvider(gen); + ForgeBlockTagsProvider blockTags = new ForgeBlockTagsProvider(gen, event.getExistingFileHelper()); gen.addProvider(blockTags); - gen.addProvider(new ForgeItemTagsProvider(gen, blockTags)); + gen.addProvider(new ForgeItemTagsProvider(gen, blockTags, event.getExistingFileHelper())); gen.addProvider(new ForgeRecipeProvider(gen)); gen.addProvider(new ForgeLootTableProvider(gen)); } diff --git a/src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java similarity index 98% rename from src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java rename to src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java index ea92f9741..81a0ac803 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ExistingFileHelper.java +++ b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package net.minecraftforge.client.model.generators; +package net.minecraftforge.common.data; import java.io.File; import java.io.IOException; diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index a8a0aa426..15e6b4a34 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -32,28 +32,20 @@ import net.minecraft.data.BlockTagsProvider; import static net.minecraftforge.common.Tags.Blocks.*; -import java.nio.file.Path; import java.util.Locale; -import java.util.Set; import java.util.function.Consumer; -import java.util.stream.Collectors; public class ForgeBlockTagsProvider extends BlockTagsProvider { - private Set filter = null; - - public ForgeBlockTagsProvider(DataGenerator gen) + public ForgeBlockTagsProvider(DataGenerator gen, ExistingFileHelper existingFileHelper) { - super(gen); + super(gen, "forge", existingFileHelper); } @SuppressWarnings("unchecked") @Override public void registerTags() { - super.registerTags(); - filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet()); - func_240522_a_(CHESTS).addTags(CHESTS_ENDER, CHESTS_TRAPPED, CHESTS_WOODEN); func_240522_a_(CHESTS_ENDER).func_240534_a_(Blocks.ENDER_CHEST); func_240522_a_(CHESTS_TRAPPED).func_240534_a_(Blocks.TRAPPED_CHEST); @@ -131,12 +123,6 @@ public class ForgeBlockTagsProvider extends BlockTagsProvider } } - @Override - protected Path makePath(ResourceLocation id) - { - return filter != null && filter.contains(id) ? null : super.makePath(id); //We don't want to save vanilla tags. - } - @Override public String getName() { diff --git a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java index 8aa367dfb..79e4776b8 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java @@ -19,11 +19,8 @@ package net.minecraftforge.common.data; -import java.nio.file.Path; import java.util.Locale; -import java.util.Set; import java.util.function.Consumer; -import java.util.stream.Collectors; import net.minecraft.block.Block; import net.minecraft.data.BlockTagsProvider; @@ -39,20 +36,15 @@ import net.minecraftforge.registries.ForgeRegistries; public class ForgeItemTagsProvider extends ItemTagsProvider { - private Set filter = null; - - public ForgeItemTagsProvider(DataGenerator gen, BlockTagsProvider blockTagProvider) + public ForgeItemTagsProvider(DataGenerator gen, BlockTagsProvider blockTagProvider, ExistingFileHelper existingFileHelper) { - super(gen, blockTagProvider); + super(gen, blockTagProvider, "forge", existingFileHelper); } @SuppressWarnings("unchecked") @Override public void registerTags() { - super.registerTags(); - filter = this.tagToBuilder.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toSet()); - func_240522_a_(Tags.Items.BONES).func_240534_a_(Items.BONE); func_240522_a_(Tags.Items.BOOKSHELVES).func_240534_a_(Items.BOOKSHELF); func_240521_a_(Tags.Blocks.CHESTS, Tags.Items.CHESTS); @@ -203,12 +195,6 @@ public class ForgeItemTagsProvider extends ItemTagsProvider } } - @Override - protected Path makePath(ResourceLocation id) - { - return filter != null && filter.contains(id) ? null : super.makePath(id); //We don't want to save vanilla tags. - } - @Override public String getName() { diff --git a/src/main/java/net/minecraftforge/fml/ModLoader.java b/src/main/java/net/minecraftforge/fml/ModLoader.java index ccb7db510..b2356aae9 100644 --- a/src/main/java/net/minecraftforge/fml/ModLoader.java +++ b/src/main/java/net/minecraftforge/fml/ModLoader.java @@ -23,8 +23,8 @@ import com.google.common.collect.ImmutableList; import cpw.mods.modlauncher.TransformingClassLoader; import net.minecraft.util.registry.Bootstrap; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.model.generators.ExistingFileHelper; import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fml.config.ConfigTracker; import net.minecraftforge.fml.config.ModConfig; diff --git a/src/main/java/net/minecraftforge/fml/event/lifecycle/GatherDataEvent.java b/src/main/java/net/minecraftforge/fml/event/lifecycle/GatherDataEvent.java index cc0051fa3..835633f40 100644 --- a/src/main/java/net/minecraftforge/fml/event/lifecycle/GatherDataEvent.java +++ b/src/main/java/net/minecraftforge/fml/event/lifecycle/GatherDataEvent.java @@ -21,7 +21,7 @@ package net.minecraftforge.fml.event.lifecycle; import cpw.mods.modlauncher.api.LamdbaExceptionUtils; import net.minecraft.data.DataGenerator; -import net.minecraftforge.client.model.generators.ExistingFileHelper; +import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fml.ModContainer; diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 4d84a66aa..17d88c587 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -22,6 +22,11 @@ net/minecraft/client/renderer/model/ModelBakery.getBakedModel(Lnet/minecraft/uti net/minecraft/client/renderer/model/ModelBakery.processLoading(Lnet/minecraft/profiler/IProfiler;I)V=|p_i226056_3_,p_i226056_4_ net/minecraft/client/renderer/model/MultipartBakedModel.getQuads(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/Direction;Ljava/util/Random;Lnet/minecraftforge/client/model/data/IModelData;)Ljava/util/List;=|p_200117_1_,p_200117_2_,p_200117_3_,modelData net/minecraft/client/renderer/model/WeightedBakedModel.getQuads(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/Direction;Ljava/util/Random;Lnet/minecraftforge/client/model/data/IModelData;)Ljava/util/List;=|p_200117_1_,p_200117_2_,p_200117_3_,modelData +net/minecraft/data/BlockTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_i48256_1_,modId,existingFileHelper +net/minecraft/data/EntityTypeTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_i50784_1_,modId,existingFileHelper +net/minecraft/data/FluidTagsProvider.(Lnet/minecraft/data/DataGenerator;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_i49156_1_,modId,existingFileHelper +net/minecraft/data/ItemTagsProvider.(Lnet/minecraft/data/DataGenerator;Lnet/minecraft/data/BlockTagsProvider;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_i232552_1_,p_i232552_2_,modId,existingFileHelper +net/minecraft/data/TagsProvider.(Lnet/minecraft/data/DataGenerator;Lnet/minecraft/util/registry/Registry;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_i49827_1_,p_i49827_2_,modId,existingFileHelper net/minecraft/entity/Entity.changeDimension(Lnet/minecraft/world/server/ServerWorld;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_241206_1_,teleporter net/minecraft/entity/item/EnderPearlEntity.changeDimension(Lnet/minecraft/world/server/ServerWorld;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_241206_1_,teleporter net/minecraft/entity/item/ItemEntity.changeDimension(Lnet/minecraft/world/server/ServerWorld;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_241206_1_,teleporter diff --git a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java index 52cf1b186..cfdf058c9 100644 --- a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java +++ b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java @@ -22,14 +22,12 @@ package net.minecraftforge.debug; import static net.minecraftforge.debug.DataGeneratorTest.MODID; import java.io.IOException; -import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.HashSet; import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -75,7 +73,6 @@ import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.biome.Biomes; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ConfiguredModel; -import net.minecraftforge.client.model.generators.ExistingFileHelper; import net.minecraftforge.client.model.generators.ItemModelProvider; import net.minecraftforge.client.model.generators.ModelBuilder; import net.minecraftforge.client.model.generators.ModelBuilder.Perspective; @@ -86,6 +83,7 @@ import net.minecraftforge.client.model.generators.VariantBlockStateBuilder; import net.minecraftforge.common.crafting.ConditionalAdvancement; import net.minecraftforge.common.crafting.ConditionalRecipe; import net.minecraftforge.common.crafting.conditions.IConditionBuilder; +import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.data.LanguageProvider; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -115,13 +113,15 @@ public class DataGeneratorTest if (event.includeClient()) { gen.addProvider(new Lang(gen)); - gen.addProvider(new ItemModels(gen, event.getExistingFileHelper())); - gen.addProvider(new BlockStates(gen, event.getExistingFileHelper())); + // Let blockstate provider see generated item models by passing its existing file helper + ItemModelProvider itemModels = new ItemModels(gen, event.getExistingFileHelper()); + gen.addProvider(itemModels); + gen.addProvider(new BlockStates(gen, itemModels.existingFileHelper)); } if (event.includeServer()) { gen.addProvider(new Recipes(gen)); - gen.addProvider(new Tags(gen)); + gen.addProvider(new Tags(gen, event.getExistingFileHelper())); } } @@ -183,17 +183,14 @@ public class DataGeneratorTest { private Set filter; - public Tags(DataGenerator gen) + public Tags(DataGenerator gen, ExistingFileHelper existingFileHelper) { - super(gen); + super(gen, MODID, existingFileHelper); } @Override protected void registerTags() { - super.registerTags(); - filter = new HashSet<>(this.tagToBuilder.keySet()); // will copy all vanilla tags. - func_240522_a_(BlockTags.makeWrapperTag(new ResourceLocation(MODID, "test").toString())) .func_240532_a_(Blocks.DIAMOND_BLOCK) .func_240531_a_(BlockTags.STONE_BRICKS) @@ -213,12 +210,6 @@ public class DataGeneratorTest .func_240532_a_(Blocks.DIORITE) .func_240532_a_(Blocks.ANDESITE); } - - @Override - protected Path makePath(ResourceLocation id) - { - return filter != null && filter.contains(id) ? null : super.makePath(id); //To escape saving vanilla tags, but still register them. - } } public static class Lang extends LanguageProvider diff --git a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java index 4b646b376..ec71107c1 100644 --- a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java +++ b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java @@ -39,8 +39,8 @@ import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.model.generators.BlockStateProvider; -import net.minecraftforge.client.model.generators.ExistingFileHelper; import net.minecraftforge.client.model.generators.ModelFile; +import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.event.world.PistonEvent; import net.minecraftforge.event.world.PistonEvent.PistonMoveType; import net.minecraftforge.eventbus.api.IEventBus;