Skip to content

Commit e17fc80

Browse files
committed
Update to support the new tag conventions and new vanilla tags
1 parent 18ad3ed commit e17fc80

File tree

22 files changed

+347
-512
lines changed

22 files changed

+347
-512
lines changed

src/additions/java/mekanism/additions/common/AdditionsTags.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ private Items() {
2222

2323
public static final TagKey<Item> BALLOONS = tag("balloons");
2424

25-
public static final TagKey<Item> FENCES_PLASTIC = forgeTag("fences/plastic");
26-
public static final TagKey<Item> FENCE_GATES_PLASTIC = forgeTag("fence_gates/plastic");
27-
public static final TagKey<Item> STAIRS_PLASTIC = forgeTag("stairs/plastic");
28-
public static final TagKey<Item> SLABS_PLASTIC = forgeTag("slabs/plastic");
29-
public static final TagKey<Item> STAIRS_PLASTIC_GLOW = forgeTag("stairs/plastic/glow");
30-
public static final TagKey<Item> SLABS_PLASTIC_GLOW = forgeTag("slabs/plastic/glow");
31-
public static final TagKey<Item> STAIRS_PLASTIC_TRANSPARENT = forgeTag("stairs/plastic/transparent");
32-
public static final TagKey<Item> SLABS_PLASTIC_TRANSPARENT = forgeTag("slabs/plastic/transparent");
25+
public static final TagKey<Item> FENCES_PLASTIC = commonTag("fences/plastic");
26+
public static final TagKey<Item> FENCE_GATES_PLASTIC = commonTag("fence_gates/plastic");
27+
public static final TagKey<Item> STAIRS_PLASTIC = commonTag("stairs/plastic");
28+
public static final TagKey<Item> SLABS_PLASTIC = commonTag("slabs/plastic");
29+
public static final TagKey<Item> STAIRS_PLASTIC_GLOW = commonTag("stairs/plastic/glow");
30+
public static final TagKey<Item> SLABS_PLASTIC_GLOW = commonTag("slabs/plastic/glow");
31+
public static final TagKey<Item> STAIRS_PLASTIC_TRANSPARENT = commonTag("stairs/plastic/transparent");
32+
public static final TagKey<Item> SLABS_PLASTIC_TRANSPARENT = commonTag("slabs/plastic/transparent");
3333

3434
public static final TagKey<Item> GLOW_PANELS = tag("glow_panels");
3535

@@ -41,8 +41,8 @@ private Items() {
4141
public static final TagKey<Item> PLASTIC_BLOCKS_SLICK = tag("plastic_blocks/slick");
4242
public static final TagKey<Item> PLASTIC_BLOCKS_TRANSPARENT = tag("plastic_blocks/transparent");
4343

44-
private static TagKey<Item> forgeTag(String name) {
45-
return ItemTags.create(new ResourceLocation("forge", name));
44+
private static TagKey<Item> commonTag(String name) {
45+
return ItemTags.create(new ResourceLocation("c", name));
4646
}
4747

4848
private static TagKey<Item> tag(String name) {
@@ -55,14 +55,14 @@ public static class Blocks {
5555
private Blocks() {
5656
}
5757

58-
public static final TagKey<Block> FENCES_PLASTIC = forgeTag("fences/plastic");
59-
public static final TagKey<Block> FENCE_GATES_PLASTIC = forgeTag("fence_gates/plastic");
60-
public static final TagKey<Block> STAIRS_PLASTIC = forgeTag("stairs/plastic");
61-
public static final TagKey<Block> SLABS_PLASTIC = forgeTag("slabs/plastic");
62-
public static final TagKey<Block> STAIRS_PLASTIC_GLOW = forgeTag("stairs/plastic/glow");
63-
public static final TagKey<Block> SLABS_PLASTIC_GLOW = forgeTag("slabs/plastic/glow");
64-
public static final TagKey<Block> STAIRS_PLASTIC_TRANSPARENT = forgeTag("stairs/plastic/transparent");
65-
public static final TagKey<Block> SLABS_PLASTIC_TRANSPARENT = forgeTag("slabs/plastic/transparent");
58+
public static final TagKey<Block> FENCES_PLASTIC = commonTag("fences/plastic");
59+
public static final TagKey<Block> FENCE_GATES_PLASTIC = commonTag("fence_gates/plastic");
60+
public static final TagKey<Block> STAIRS_PLASTIC = commonTag("stairs/plastic");
61+
public static final TagKey<Block> SLABS_PLASTIC = commonTag("slabs/plastic");
62+
public static final TagKey<Block> STAIRS_PLASTIC_GLOW = commonTag("stairs/plastic/glow");
63+
public static final TagKey<Block> SLABS_PLASTIC_GLOW = commonTag("slabs/plastic/glow");
64+
public static final TagKey<Block> STAIRS_PLASTIC_TRANSPARENT = commonTag("stairs/plastic/transparent");
65+
public static final TagKey<Block> SLABS_PLASTIC_TRANSPARENT = commonTag("slabs/plastic/transparent");
6666

6767
public static final TagKey<Block> GLOW_PANELS = tag("glow_panels");
6868

@@ -74,8 +74,8 @@ private Blocks() {
7474
public static final TagKey<Block> PLASTIC_BLOCKS_SLICK = tag("plastic_blocks/slick");
7575
public static final TagKey<Block> PLASTIC_BLOCKS_TRANSPARENT = tag("plastic_blocks/transparent");
7676

77-
private static TagKey<Block> forgeTag(String name) {
78-
return BlockTags.create(new ResourceLocation("forge", name));
77+
private static TagKey<Block> commonTag(String name) {
78+
return BlockTags.create(new ResourceLocation("c", name));
7979
}
8080

8181
private static TagKey<Block> tag(String name) {
@@ -100,11 +100,11 @@ public static class Entities {
100100
private Entities() {
101101
}
102102

103-
public static final TagKey<EntityType<?>> CREEPERS = forgeTag("creepers");
104-
public static final TagKey<EntityType<?>> ENDERMEN = forgeTag("endermen");
103+
public static final TagKey<EntityType<?>> CREEPERS = commonTag("creepers");
104+
public static final TagKey<EntityType<?>> ENDERMEN = commonTag("endermen");
105105

106-
private static TagKey<EntityType<?>> forgeTag(String name) {
107-
return TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation("forge", name));
106+
private static TagKey<EntityType<?>> commonTag(String name) {
107+
return TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation("c", name));
108108
}
109109
}
110110
}

src/datagen/additions/java/mekanism/additions/common/AdditionsTagProvider.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import mekanism.additions.common.registries.AdditionsItems;
1010
import mekanism.api.providers.IBlockProvider;
1111
import mekanism.api.providers.IItemProvider;
12+
import mekanism.api.text.EnumColor;
1213
import mekanism.common.item.block.ItemBlockMekanism;
1314
import mekanism.common.registration.impl.BlockRegistryObject;
1415
import mekanism.common.tag.BaseTagProvider;
@@ -24,6 +25,7 @@
2425
import net.minecraft.tags.TagKey;
2526
import net.minecraft.world.damagesource.DamageTypes;
2627
import net.minecraft.world.entity.EntityType;
28+
import net.minecraft.world.item.DyeColor;
2729
import net.minecraft.world.item.Item;
2830
import net.minecraft.world.level.block.Block;
2931
import net.neoforged.neoforge.common.Tags;
@@ -79,7 +81,7 @@ private void addDamageTypes() {
7981
}
8082

8183
private void addBalloons() {
82-
addToTag(AdditionsTags.Items.BALLOONS, AdditionsItems.BALLOONS.values().toArray(new IItemProvider[0]));
84+
addToTag(AdditionsTags.Items.BALLOONS, AdditionsItems.BALLOONS);
8385
}
8486

8587
private void addSlabs() {
@@ -145,7 +147,26 @@ private void addHarvestRequirements() {
145147
AdditionsBlocks.PLASTIC_STAIRS, AdditionsBlocks.PLASTIC_GLOW_STAIRS, AdditionsBlocks.TRANSPARENT_PLASTIC_STAIRS);
146148
}
147149

148-
private void addToTags(TagKey<Item> itemTag, TagKey<Block> blockTag, Map<?, ? extends IBlockProvider> blockProviders) {
150+
private void addToTags(TagKey<Item> itemTag, TagKey<Block> blockTag, Map<EnumColor, ? extends IBlockProvider> blockProviders) {
149151
addToTags(itemTag, blockTag, blockProviders.values().toArray(new IBlockProvider[0]));
152+
for (Map.Entry<EnumColor, ? extends IBlockProvider> entry : blockProviders.entrySet()) {
153+
DyeColor dyeColor = entry.getKey().getDyeColor();
154+
if (dyeColor != null) {
155+
addToTags(Tags.Items.DYED, Tags.Blocks.DYED, entry.getValue());
156+
TagKey<Item> dyedColor = ItemTags.create(Tags.Items.DYED.location().withSuffix("/" + dyeColor.getName()));
157+
addToTags(dyedColor, BlockTags.create(dyedColor.location()), entry.getValue());
158+
}
159+
}
160+
}
161+
162+
private void addToTag(TagKey<Item> itemTag, Map<EnumColor, ? extends IItemProvider> itemProviders) {
163+
addToTag(itemTag, itemProviders.values().toArray(new IItemProvider[0]));
164+
for (Map.Entry<EnumColor, ? extends IItemProvider> entry : itemProviders.entrySet()) {
165+
DyeColor dyeColor = entry.getKey().getDyeColor();
166+
if (dyeColor != null) {
167+
addToTag(Tags.Items.DYED, entry.getValue());
168+
addToTag(ItemTags.create(Tags.Items.DYED.location().withSuffix("/" + dyeColor.getName())), entry.getValue());
169+
}
170+
}
150171
}
151172
}

src/datagen/generators/java/mekanism/generators/common/GeneratorsTagProvider.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
import java.util.Collection;
44
import java.util.concurrent.CompletableFuture;
5-
import mekanism.common.registration.impl.TileEntityTypeRegistryObject;
65
import mekanism.common.tag.BaseTagProvider;
7-
import mekanism.common.tags.MekanismTags;
86
import mekanism.generators.common.registries.GeneratorsBlocks;
97
import mekanism.generators.common.registries.GeneratorsFluids;
108
import mekanism.generators.common.registries.GeneratorsGases;
11-
import mekanism.generators.common.registries.GeneratorsTileEntityTypes;
129
import net.minecraft.core.Holder;
1310
import net.minecraft.core.HolderLookup;
1411
import net.minecraft.data.PackOutput;
@@ -40,16 +37,10 @@ protected void registerTags(HolderLookup.Provider registries) {
4037
}
4138

4239
private void addBoxBlacklist() {
43-
addToTag(MekanismTags.Blocks.RELOCATION_NOT_SUPPORTED,
40+
addToTag(Tags.Blocks.RELOCATION_NOT_SUPPORTED,
4441
GeneratorsBlocks.ADVANCED_SOLAR_GENERATOR,
4542
GeneratorsBlocks.WIND_GENERATOR
4643
);
47-
TileEntityTypeRegistryObject<?>[] tilesToBlacklist = {
48-
GeneratorsTileEntityTypes.ADVANCED_SOLAR_GENERATOR,
49-
GeneratorsTileEntityTypes.WIND_GENERATOR
50-
};
51-
addToTag(MekanismTags.TileEntityTypes.IMMOVABLE, tilesToBlacklist);
52-
addToTag(MekanismTags.TileEntityTypes.RELOCATION_NOT_SUPPORTED, tilesToBlacklist);
5344
}
5445

5546
private void addEndermanBlacklist() {

src/datagen/main/java/mekanism/client/model/BaseItemModelProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
1919
import net.neoforged.neoforge.client.model.generators.loaders.DynamicFluidContainerModelBuilder;
2020
import net.neoforged.neoforge.common.data.ExistingFileHelper;
21+
import net.neoforged.neoforge.internal.versions.neoforge.NeoForgeVersion;
2122
import org.jetbrains.annotations.NotNull;
2223

2324
public abstract class BaseItemModelProvider extends ItemModelProvider {
@@ -58,7 +59,7 @@ protected void registerBuckets(FluidDeferredRegister register) {
5859
for (Holder<Item> holder : register.getBucketEntries()) {
5960
//Note: We expect this to always be the case
6061
if (holder.value() instanceof BucketItem bucket) {
61-
withExistingParent(RegistryUtils.getPath(bucket), new ResourceLocation("neoforge", "item/bucket"))
62+
withExistingParent(RegistryUtils.getPath(bucket), new ResourceLocation(NeoForgeVersion.MOD_ID, "item/bucket"))
6263
.customLoader(DynamicFluidContainerModelBuilder::begin)
6364
.fluid(bucket.content);
6465
}

src/datagen/main/java/mekanism/common/integration/crafttweaker/MekanismCrTExampleProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ private void addRecipeExamples() {
436436
"6) Adds a recipe that uses 400 mB of Water, 400 mB of Oxygen, and four Boats to create a Charcoal Dust and 400 mB of Hydrogen in 600 ticks."
437437
).blankLine()
438438
.recipe(PressurizedReactionRecipeManager.INSTANCE)
439-
.addExample("reaction/sawdust", IngredientCreatorAccess.item().from(MekanismTags.Items.SAWDUST), IngredientCreatorAccess.fluid().from(FluidTags.WATER, 350),
439+
.addExample("reaction/sawdust", IngredientCreatorAccess.item().from(MekanismTags.Items.DUSTS_WOOD), IngredientCreatorAccess.fluid().from(FluidTags.WATER, 350),
440440
IngredientCreatorAccess.gas().from(MekanismGases.HYDROGEN_CHLORIDE, 50), 45, new ItemStack(Items.PAPER, 2), FloatingLong.createConst(25))
441441
.addExample("reaction/sand", IngredientCreatorAccess.item().from(Tags.Items.SANDS), IngredientCreatorAccess.fluid().from(MekanismTags.Fluids.CHLORINE, 100),
442442
IngredientCreatorAccess.gas().from(MekanismGases.HYDROGEN, 100), 300, MekanismBlocks.SALT_BLOCK.getItemStack())

src/datagen/main/java/mekanism/common/recipe/RecipeProviderUtil.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ public static void addPrecisionSawmillWoodTypeRecipes(RecipeOutput consumer, Str
136136
), basePath + "trapdoor/" + name, condition);
137137
}
138138

139+
public static void addSandStoneToSandRecipe(RecipeOutput consumer, String path, @Nullable ICondition condition, ItemLike sand, TagKey<Item> sandstoneTag) {
140+
build(consumer, ItemStackToItemStackRecipeBuilder.crushing(
141+
IngredientCreatorAccess.item().from(Ingredient.of(sandstoneTag)),
142+
new ItemStack(sand, 2)
143+
), path, condition);
144+
}
145+
146+
@Deprecated
139147
public static void addSandStoneToSandRecipe(RecipeOutput consumer, String path, @Nullable ICondition condition, ItemLike sand, ItemLike... sandstones) {
140148
build(consumer, ItemStackToItemStackRecipeBuilder.crushing(
141149
IngredientCreatorAccess.item().from(Ingredient.of(sandstones)),

src/datagen/main/java/mekanism/common/recipe/compat/AE2RecipeProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess;
88
import mekanism.common.Mekanism;
99
import net.minecraft.data.recipes.RecipeOutput;
10-
import net.minecraft.resources.ResourceLocation;
1110
import net.minecraft.tags.ItemTags;
1211
import net.minecraft.world.item.ItemStack;
12+
import net.neoforged.neoforge.common.Tags;
1313

1414
@ParametersAreNotNullByDefault
1515
public class AE2RecipeProvider extends CompatRecipeProvider {
@@ -22,7 +22,7 @@ public AE2RecipeProvider(String modid) {
2222
protected void registerRecipes(RecipeOutput consumer, String basePath) {
2323
//Certus Crystal -> Certus Dust
2424
ItemStackToItemStackRecipeBuilder.crushing(
25-
IngredientCreatorAccess.item().from(ItemTags.create(new ResourceLocation("forge", "gems/certus_quartz"))),
25+
IngredientCreatorAccess.item().from(ItemTags.create(Tags.Items.GEMS.location().withSuffix("/certus_quartz"))),
2626
AEItems.CERTUS_QUARTZ_DUST.stack(1)
2727
).addCondition(modLoaded)
2828
.build(consumer, Mekanism.rl(basePath + "certus_crystal_to_dust"));

src/datagen/main/java/mekanism/common/recipe/impl/CrusherRecipeProvider.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,10 @@ public void addRecipes(RecipeOutput consumer) {
8888
IngredientCreatorAccess.item().from(Items.BONE),
8989
new ItemStack(Items.BONE_MEAL, 6)
9090
).build(consumer, Mekanism.rl(basePath + "bone"));
91-
//TODO: Do we just want to make a clear and red tag for sandstone?
9291
//Red Sandstone -> Sand
93-
RecipeProviderUtil.addSandStoneToSandRecipe(consumer, basePath + "red_sandstone_to_sand", null, Blocks.RED_SAND, Blocks.RED_SANDSTONE,
94-
Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.SMOOTH_RED_SANDSTONE);
92+
RecipeProviderUtil.addSandStoneToSandRecipe(consumer, basePath + "red_sandstone_to_sand", null, Blocks.RED_SAND, Tags.Items.SANDSTONE_RED_BLOCKS);
9593
//Sandstone -> Sand
96-
RecipeProviderUtil.addSandStoneToSandRecipe(consumer, basePath + "sandstone_to_sand", null, Blocks.SAND, Blocks.SANDSTONE,
97-
Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.SMOOTH_SANDSTONE);
94+
RecipeProviderUtil.addSandStoneToSandRecipe(consumer, basePath + "sandstone_to_sand", null, Blocks.SAND, Tags.Items.SANDSTONE_UNCOLORED_BLOCKS);
9895
//Wool -> String
9996
ItemStackToItemStackRecipeBuilder.crushing(
10097
IngredientCreatorAccess.item().from(ItemTags.WOOL),

src/datagen/main/java/mekanism/common/recipe/impl/MekanismRecipeProvider.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import mekanism.common.resource.ResourceType;
4141
import mekanism.common.tags.MekanismTags;
4242
import net.minecraft.core.HolderLookup;
43-
import net.minecraft.core.HolderLookup.Provider;
4443
import net.minecraft.data.PackOutput;
4544
import net.minecraft.data.recipes.RecipeCategory;
4645
import net.minecraft.data.recipes.RecipeOutput;
@@ -206,7 +205,7 @@ private void addMiscRecipes(RecipeOutput consumer) {
206205
.pattern(RecipePattern.createPattern(
207206
DoubleLine.of(Pattern.CONSTANT, Pattern.CONSTANT),
208207
DoubleLine.of(Pattern.CONSTANT, Pattern.CONSTANT))
209-
).key(Pattern.CONSTANT, MekanismTags.Items.SAWDUST)
208+
).key(Pattern.CONSTANT, MekanismTags.Items.DUSTS_WOOD)
210209
.build(consumer);
211210
//Bio Fuel
212211
ExtendedShapelessRecipeBuilder.shapelessRecipe(MekanismItems.BIO_FUEL, 9)
@@ -337,7 +336,7 @@ private void addMiscRecipes(RecipeOutput consumer) {
337336
).key(Pattern.REDSTONE, Tags.Items.DUSTS_REDSTONE)
338337
.key(Pattern.CIRCUIT, MekanismTags.Items.CIRCUITS_BASIC)
339338
.key(Pattern.STEEL_CASING, MekanismBlocks.STEEL_CASING)
340-
.key(Pattern.BUCKET, Items.LAVA_BUCKET)
339+
.key(Pattern.BUCKET, Tags.Items.BUCKETS_LAVA)
341340
.build(consumer);
342341
//Dictionary
343342
ExtendedShapedRecipeBuilder.shapedRecipe(MekanismItems.DICTIONARY)
@@ -372,7 +371,7 @@ private void addMiscRecipes(RecipeOutput consumer) {
372371
.build(consumer);
373372
//Dye Base
374373
ExtendedShapelessRecipeBuilder.shapelessRecipe(MekanismItems.DYE_BASE, 3)
375-
.addIngredient(MekanismTags.Items.SAWDUST, 2)
374+
.addIngredient(MekanismTags.Items.DUSTS_WOOD, 2)
376375
.addIngredient(Items.CLAY_BALL)
377376
.build(consumer);
378377
//Dynamic tank
@@ -764,7 +763,7 @@ private void addMiscRecipes(RecipeOutput consumer) {
764763
ExtendedShapedRecipeBuilder.shapedRecipe(Items.PAPER, 6)
765764
.pattern(RecipePattern.createPattern(
766765
TripleLine.of(Pattern.CONSTANT, Pattern.CONSTANT, Pattern.CONSTANT))
767-
).key(Pattern.CONSTANT, MekanismTags.Items.SAWDUST)
766+
).key(Pattern.CONSTANT, MekanismTags.Items.DUSTS_WOOD)
768767
.build(consumer, Mekanism.rl("paper"));
769768
//Personal barrel
770769
ExtendedShapedRecipeBuilder.shapedRecipe(MekanismBlocks.PERSONAL_BARREL)

src/datagen/main/java/mekanism/common/recipe/impl/OreProcessingRecipeProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ private void addUraniumRecipes(RecipeOutput consumer, String basePath) {
591591
).build(consumer, Mekanism.rl(basePath + "hydrofluoric_acid_from_block"));
592592
//uranium oxide
593593
ItemStackToChemicalRecipeBuilder.oxidizing(
594-
IngredientCreatorAccess.item().from(MekanismTags.Items.YELLOW_CAKE_URANIUM),
594+
IngredientCreatorAccess.item().from(MekanismItems.YELLOW_CAKE_URANIUM),
595595
MekanismGases.URANIUM_OXIDE.getStack(250)
596596
).build(consumer, Mekanism.rl(basePath + "uranium_oxide"));
597597
//uranium hexafluoride

0 commit comments

Comments
 (0)