Skip to content

Commit c96feca

Browse files
committed
Expose some of our tags to the API for ease of consumption in datagen of other mods (can move more if people request certain tags be moved), and remove hidden chemicals as a concept and instead make use of the hidden from recipe viewer tags. Also make use of the hidden from recipe viewer tags for what fluids and chemicals we display in creative tanks by default
1 parent 7987c6a commit c96feca

30 files changed

+281
-218
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ neogradle.subsystems.conventions.sourcesets.enabled=false
3030

3131
#misc settings
3232
# recipe viewer, currently accepts: jei, emi, hybrid
33-
recipe_viewer=emi
33+
recipe_viewer=none
3434

3535
#datagen
3636
yamlops_version=1.2.0

src/api/java/mekanism/api/MekanismAPI.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private MekanismAPI() {
3434
/**
3535
* The version of the api classes - may not always match the mod's version
3636
*/
37-
public static final String API_VERSION = "10.6.1";
37+
public static final String API_VERSION = "10.6.2";
3838
/**
3939
* Mekanism's Mod ID
4040
*/
@@ -244,17 +244,17 @@ private static <T> ResourceKey<Registry<MapCodec<? extends T>>> codecRegistryKey
244244
/**
245245
* Empty Gas instance.
246246
*/
247-
public static final Gas EMPTY_GAS = new Gas(GasBuilder.builder().hidden());
247+
public static final Gas EMPTY_GAS = new Gas(GasBuilder.builder());
248248
/**
249249
* Empty Infuse Type instance.
250250
*/
251-
public static final InfuseType EMPTY_INFUSE_TYPE = new InfuseType(InfuseTypeBuilder.builder().hidden());
251+
public static final InfuseType EMPTY_INFUSE_TYPE = new InfuseType(InfuseTypeBuilder.builder());
252252
/**
253253
* Empty Pigment instance.
254254
*/
255-
public static final Pigment EMPTY_PIGMENT = new Pigment(PigmentBuilder.builder().hidden());
255+
public static final Pigment EMPTY_PIGMENT = new Pigment(PigmentBuilder.builder());
256256
/**
257257
* Empty Slurry instance.
258258
*/
259-
public static final Slurry EMPTY_SLURRY = new Slurry(SlurryBuilder.clean().hidden());
259+
public static final Slurry EMPTY_SLURRY = new Slurry(SlurryBuilder.clean());
260260
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
package mekanism.api;
2+
3+
import mekanism.api.annotations.NothingNullByDefault;
4+
import mekanism.api.chemical.gas.Gas;
5+
import mekanism.api.chemical.infuse.InfuseType;
6+
import mekanism.api.chemical.pigment.Pigment;
7+
import mekanism.api.chemical.slurry.Slurry;
8+
import net.minecraft.core.registries.Registries;
9+
import net.minecraft.resources.ResourceLocation;
10+
import net.minecraft.tags.TagKey;
11+
import net.minecraft.world.damagesource.DamageType;
12+
import net.minecraft.world.effect.MobEffect;
13+
14+
/**
15+
* Provides access to pre-existing tag keys for various functionality that we use tags for.
16+
*
17+
* @since 10.6.2
18+
*/
19+
@NothingNullByDefault
20+
public class MekanismAPITags {
21+
22+
private static final ResourceLocation HIDDEN_RL = ResourceLocation.fromNamespaceAndPath("c", "hidden_from_recipe_viewers");
23+
24+
private MekanismAPITags() {
25+
}
26+
27+
private static ResourceLocation rl(String path) {
28+
return ResourceLocation.fromNamespaceAndPath(MekanismAPI.MEKANISM_MODID, path);
29+
}
30+
31+
public static class Gases {
32+
33+
private Gases() {
34+
}
35+
36+
/**
37+
* Tag that holds all gases that recipe viewers should not show to users.
38+
*/
39+
public static final TagKey<Gas> HIDDEN_FROM_RECIPE_VIEWERS = TagKey.create(MekanismAPI.GAS_REGISTRY_NAME, HIDDEN_RL);
40+
/**
41+
* Gases in this tag that are radioactive will not decay inside a Radioactive Waste Barrel.
42+
*/
43+
public static final TagKey<Gas> WASTE_BARREL_DECAY_BLACKLIST = tag("waste_barrel_decay_blacklist");
44+
45+
private static TagKey<Gas> tag(String name) {
46+
return TagKey.create(MekanismAPI.GAS_REGISTRY_NAME, rl(name));
47+
}
48+
}
49+
50+
public static class InfuseTypes {
51+
52+
private InfuseTypes() {
53+
}
54+
55+
/**
56+
* Tag that holds all infuse types that recipe viewers should not show to users.
57+
*/
58+
public static final TagKey<InfuseType> HIDDEN_FROM_RECIPE_VIEWERS = TagKey.create(MekanismAPI.INFUSE_TYPE_REGISTRY_NAME, HIDDEN_RL);
59+
60+
/**
61+
* Represents an infuse type that is equivalent to carbon.
62+
*/
63+
public static final TagKey<InfuseType> CARBON = tag("carbon");
64+
/**
65+
* Represents an infuse type that is equivalent to redstone.
66+
*/
67+
public static final TagKey<InfuseType> REDSTONE = tag("redstone");
68+
/**
69+
* Represents an infuse type that is equivalent to diamond.
70+
*/
71+
public static final TagKey<InfuseType> DIAMOND = tag("diamond");
72+
/**
73+
* Represents an infuse type that is equivalent to refined obsidian.
74+
*/
75+
public static final TagKey<InfuseType> REFINED_OBSIDIAN = tag("refined_obsidian");
76+
/**
77+
* Represents an infuse type that is equivalent to bio.
78+
*/
79+
public static final TagKey<InfuseType> BIO = tag("bio");
80+
/**
81+
* Represents an infuse type that is equivalent to fungi.
82+
*/
83+
public static final TagKey<InfuseType> FUNGI = tag("fungi");
84+
/**
85+
* Represents an infuse type that is equivalent to gold.
86+
*/
87+
public static final TagKey<InfuseType> GOLD = tag("gold");
88+
/**
89+
* Represents an infuse type that is equivalent to tin.
90+
*/
91+
public static final TagKey<InfuseType> TIN = tag("tin");
92+
93+
private static TagKey<InfuseType> tag(String name) {
94+
return TagKey.create(MekanismAPI.INFUSE_TYPE_REGISTRY_NAME, rl(name));
95+
}
96+
}
97+
98+
public static class Pigments {
99+
100+
private Pigments() {
101+
}
102+
103+
/**
104+
* Tag that holds all pigments that recipe viewers should not show to users.
105+
*/
106+
public static final TagKey<Pigment> HIDDEN_FROM_RECIPE_VIEWERS = TagKey.create(MekanismAPI.PIGMENT_REGISTRY_NAME, HIDDEN_RL);
107+
}
108+
109+
public static class Slurries {
110+
111+
private Slurries() {
112+
}
113+
114+
/**
115+
* Tag that holds all slurries that recipe viewers should not show to users.
116+
*/
117+
public static final TagKey<Slurry> HIDDEN_FROM_RECIPE_VIEWERS = TagKey.create(MekanismAPI.SLURRY_REGISTRY_NAME, HIDDEN_RL);
118+
119+
/**
120+
* Represents all dirty slurries.
121+
*/
122+
public static final TagKey<Slurry> DIRTY = tag("dirty");
123+
/**
124+
* Represents all clean slurries.
125+
*/
126+
public static final TagKey<Slurry> CLEAN = tag("clean");
127+
128+
private static TagKey<Slurry> tag(String name) {
129+
return TagKey.create(MekanismAPI.SLURRY_REGISTRY_NAME, rl(name));
130+
}
131+
}
132+
133+
public static class MobEffects {
134+
135+
private MobEffects() {
136+
}
137+
138+
/**
139+
* Mob effects in this tag, will be skipped when trying to speed up potion effects with a Scuba Mask or the Inhalation Purification Unit.
140+
*/
141+
public static final TagKey<MobEffect> SPEED_UP_BLACKLIST = tag("speed_up_blacklist");
142+
143+
private static TagKey<MobEffect> tag(String name) {
144+
return TagKey.create(Registries.MOB_EFFECT, rl(name));
145+
}
146+
}
147+
148+
public static class DamageTypes {
149+
150+
private DamageTypes() {
151+
}
152+
153+
/**
154+
* Represents any damage type that is always supported by the MekaSuit.
155+
*/
156+
public static final TagKey<DamageType> MEKASUIT_ALWAYS_SUPPORTED = tag("mekasuit_always_supported");
157+
/**
158+
* Represents any type of damage that can be prevented by the Scuba Mask or the Inhalation Purification Unit.
159+
*/
160+
public static final TagKey<DamageType> IS_PREVENTABLE_MAGIC = tag("is_preventable_magic");
161+
162+
private static TagKey<DamageType> tag(String name) {
163+
return TagKey.create(Registries.DAMAGE_TYPE, rl(name));
164+
}
165+
}
166+
}

src/api/java/mekanism/api/chemical/Chemical.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public void encode(RegistryFriendlyByteBuf buffer, Chemical<?> chemical) {
9898
private final Map<Class<? extends ChemicalAttribute>, ChemicalAttribute> attributeMap;
9999

100100
private final ResourceLocation iconLocation;
101-
private final boolean hidden;
102101
private final int tint;
103102
private boolean isRadioactive;
104103
private boolean hasAttributesWithValidation;
@@ -111,7 +110,6 @@ protected Chemical(ChemicalBuilder<CHEMICAL, ?> builder) {
111110
this.attributeMap = new HashMap<>(builder.getAttributeMap());
112111
this.iconLocation = builder.getTexture();
113112
this.tint = builder.getTint();
114-
this.hidden = builder.isHidden();
115113
this.isRadioactive = attributeMap.containsKey(Radiation.class);
116114
this.hasAttributesWithValidation = isRadioactive || attributeMap.values().stream().anyMatch(ChemicalAttribute::needsValidation);
117115
}
@@ -227,15 +225,6 @@ public int getColorRepresentation() {
227225
return getTint();
228226
}
229227

230-
/**
231-
* Whether this chemical is hidden.
232-
*
233-
* @return if this chemical is hidden
234-
*/
235-
public boolean isHidden() {
236-
return hidden;
237-
}
238-
239228
/**
240229
* Checks if this chemical is in a given tag.
241230
*

src/api/java/mekanism/api/chemical/ChemicalBuilder.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public class ChemicalBuilder<CHEMICAL extends Chemical<CHEMICAL>, BUILDER extend
1313
private final Map<Class<? extends ChemicalAttribute>, ChemicalAttribute> attributeMap = new Object2ObjectOpenHashMap<>();
1414
private final ResourceLocation texture;
1515
private int tint = 0xFFFFFF;
16-
private boolean hidden;
1716

1817
protected ChemicalBuilder(ResourceLocation texture) {
1918
this.texture = texture;
@@ -53,14 +52,6 @@ public BUILDER tint(int tint) {
5352
return self();
5453
}
5554

56-
/**
57-
* Marks that this chemical will be hidden in JEI, and not included in the preset of filled chemical tanks.
58-
*/
59-
public BUILDER hidden() {
60-
this.hidden = true;
61-
return self();
62-
}
63-
6455
/**
6556
* Gets the tint to apply to this chemical when rendering.
6657
*
@@ -70,15 +61,6 @@ public int getTint() {
7061
return tint;
7162
}
7263

73-
/**
74-
* Checks if this chemical should be hidden from JEI and not included in the preset of filled chemical tanks.
75-
*
76-
* @return {@code true} if it should be hidden.
77-
*/
78-
public boolean isHidden() {
79-
return hidden;
80-
}
81-
8264
@SuppressWarnings("unchecked")
8365
private BUILDER self() {
8466
return (BUILDER) this;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package mekanism.generators.common;
22

33
import java.util.concurrent.CompletableFuture;
4+
import mekanism.api.MekanismAPITags;
45
import mekanism.api.annotations.NothingNullByDefault;
56
import mekanism.api.chemical.gas.Gas;
67
import mekanism.api.datagen.recipe.builder.ChemicalChemicalToChemicalRecipeBuilder;
@@ -269,7 +270,7 @@ private void addFusionReactorRecipes(RecipeOutput consumer) {
269270
//Hohlraum
270271
ItemStackChemicalToItemStackRecipeBuilder.metallurgicInfusing(
271272
IngredientCreatorAccess.item().from(MekanismTags.Items.PROCESSED_RESOURCES.get(ResourceType.DUST, PrimaryResource.GOLD), 4),
272-
IngredientCreatorAccess.infusionStack().from(MekanismTags.InfuseTypes.CARBON, 10),
273+
IngredientCreatorAccess.infusionStack().from(MekanismAPITags.InfuseTypes.CARBON, 10),
273274
GeneratorsItems.HOHLRAUM.getItemStack()
274275
).build(consumer);
275276
//Laser Focus Matrix

src/datagen/main/java/mekanism/client/lang/MekanismLangProvider.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.common.collect.Table.Cell;
44
import java.util.Map;
55
import mekanism.api.MekanismAPI;
6+
import mekanism.api.MekanismAPITags;
67
import mekanism.api.chemical.slurry.Slurry;
78
import mekanism.api.gear.config.ModuleConfig;
89
import mekanism.api.providers.IItemProvider;
@@ -204,19 +205,19 @@ private void addTags() {
204205
addTag(MekanismTags.Fluids.NUTRITIONAL_PASTE, "Nutritional Paste");
205206

206207
addTag(MekanismTags.Gases.WATER_VAPOR, "Water Vapor");
207-
addTag(MekanismTags.Gases.WASTE_BARREL_DECAY_BLACKLIST, "Waste Barrel Does Not Decay");
208-
209-
addTag(MekanismTags.InfuseTypes.CARBON, "Carbon");
210-
addTag(MekanismTags.InfuseTypes.REDSTONE, "Redstone");
211-
addTag(MekanismTags.InfuseTypes.DIAMOND, "Diamond");
212-
addTag(MekanismTags.InfuseTypes.REFINED_OBSIDIAN, "Refined Obsidian");
213-
addTag(MekanismTags.InfuseTypes.BIO, "Bio");
214-
addTag(MekanismTags.InfuseTypes.FUNGI, "Fungi");
215-
addTag(MekanismTags.InfuseTypes.GOLD, "Gold");
216-
addTag(MekanismTags.InfuseTypes.TIN, "Tin");
217-
218-
addTag(MekanismTags.Slurries.DIRTY, "Dirty Slurry");
219-
addTag(MekanismTags.Slurries.CLEAN, "Clean Slurry");
208+
addTag(MekanismAPITags.Gases.WASTE_BARREL_DECAY_BLACKLIST, "Waste Barrel Does Not Decay");
209+
210+
addTag(MekanismAPITags.InfuseTypes.CARBON, "Carbon");
211+
addTag(MekanismAPITags.InfuseTypes.REDSTONE, "Redstone");
212+
addTag(MekanismAPITags.InfuseTypes.DIAMOND, "Diamond");
213+
addTag(MekanismAPITags.InfuseTypes.REFINED_OBSIDIAN, "Refined Obsidian");
214+
addTag(MekanismAPITags.InfuseTypes.BIO, "Bio");
215+
addTag(MekanismAPITags.InfuseTypes.FUNGI, "Fungi");
216+
addTag(MekanismAPITags.InfuseTypes.GOLD, "Gold");
217+
addTag(MekanismAPITags.InfuseTypes.TIN, "Tin");
218+
219+
addTag(MekanismAPITags.Slurries.DIRTY, "Dirty Slurry");
220+
addTag(MekanismAPITags.Slurries.CLEAN, "Clean Slurry");
220221
}
221222

222223
private void addItems() {

src/datagen/main/java/mekanism/common/MekanismDataMapsProvider.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package mekanism.common;
22

3+
import java.util.concurrent.CompletableFuture;
4+
import mekanism.api.MekanismAPITags;
35
import mekanism.api.datamaps.MekaSuitAbsorption;
46
import mekanism.common.registries.MekanismBlocks;
57
import mekanism.common.registries.MekanismDataMapTypes;
68
import mekanism.common.registries.MekanismGameEvents;
7-
import mekanism.common.tags.MekanismTags;
89
import net.minecraft.core.HolderLookup;
910
import net.minecraft.data.PackOutput;
1011
import net.minecraft.world.damagesource.DamageTypes;
@@ -13,8 +14,6 @@
1314
import net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps;
1415
import net.neoforged.neoforge.registries.datamaps.builtin.VibrationFrequency;
1516

16-
import java.util.concurrent.CompletableFuture;
17-
1817
public class MekanismDataMapsProvider extends DataMapProvider {
1918

2019
public MekanismDataMapsProvider(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
@@ -40,7 +39,7 @@ protected void gather() {
4039

4140
builder(MekanismDataMapTypes.MEKA_SUIT_ABSORPTION)
4241
.add(DamageTypes.SONIC_BOOM, new MekaSuitAbsorption(0.75f), false)
43-
.add(MekanismTags.DamageTypes.MEKASUIT_ALWAYS_SUPPORTED, new MekaSuitAbsorption(1f), false)
42+
.add(MekanismAPITags.DamageTypes.MEKASUIT_ALWAYS_SUPPORTED, new MekaSuitAbsorption(1f), false)
4443
;
4544
}
4645
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.blamejared.crafttweaker.api.bracket.CommandStringDisplayable;
44
import java.util.Locale;
55
import java.util.function.Function;
6+
import mekanism.api.MekanismAPITags;
67
import mekanism.api.chemical.Chemical;
78
import mekanism.api.chemical.ChemicalStack;
89
import mekanism.api.chemical.slurry.Slurry;
@@ -152,7 +153,7 @@ private void addRecipeExamples() {
152153
.recipe(ChemicalCrystallizerRecipeManager.INSTANCE)
153154
.addExample("osmium_ingotification", IngredientCreatorAccess.gasStack().from(MekanismGases.OSMIUM, 200),
154155
MekanismItems.PROCESSED_RESOURCES.get(ResourceType.INGOT, PrimaryResource.OSMIUM).getItemStack())
155-
.addExample("gold_infusion_to_gold", IngredientCreatorAccess.infusionStack().from(MekanismTags.InfuseTypes.GOLD, 9), new ItemStack(Items.GOLD_NUGGET))
156+
.addExample("gold_infusion_to_gold", IngredientCreatorAccess.infusionStack().from(MekanismAPITags.InfuseTypes.GOLD, 9), new ItemStack(Items.GOLD_NUGGET))
156157
.end()
157158
.comment("Removes two Crystallizing Recipes:",
158159
"1) The recipe for producing Lithium Dust.",

0 commit comments

Comments
 (0)