Skip to content

Commit b74b68b

Browse files
thiakilpupnewfster
andauthored
Merge all four chemical types into a singlular registry and type called chemical (#8196)
- Slightly adjusted IChemicalHandler to allow direct implementation alongside implementing IFluidHandler (method clashes) - Removed all Boxed Types relating to chemicals - Added Infusion recipes to the Chemical Oxidizer - Added a per_tick_usage field that determines if the chemical is used each tick or only when finished to the nucleosynthesizing, compressing, injecting, metallurgic infusing, puriffying, and painting recipes - Unified various names in recipes (old syntax ones that changed will not be able to load) Old world data should load mostly fine with the following known exceptions: - Chemical Dissolution Chamber items that have contents in multiple tanks will lose the stored contents - Quantum Entangloporters that are transferring multiple different chemical types will have the first type win out --------- Co-authored-by: Sara Freimer <sara@freimer.com>
1 parent c08a1b7 commit b74b68b

File tree

1,618 files changed

+14013
-28957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,618 files changed

+14013
-28957
lines changed
Lines changed: 8 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
11
package mekanism.api;
22

33
import java.util.ServiceLoader;
4-
import mekanism.api.chemical.gas.Gas;
5-
import mekanism.api.chemical.gas.GasStack;
6-
import mekanism.api.chemical.infuse.InfuseType;
7-
import mekanism.api.chemical.infuse.InfusionStack;
8-
import mekanism.api.chemical.pigment.Pigment;
9-
import mekanism.api.chemical.pigment.PigmentStack;
10-
import mekanism.api.chemical.slurry.Slurry;
11-
import mekanism.api.chemical.slurry.SlurryStack;
124
import mekanism.api.integration.emi.IMekanismEmiHelper;
135
import mekanism.api.integration.jei.IMekanismJEIHelper;
14-
import mekanism.api.recipes.ingredients.GasStackIngredient;
15-
import mekanism.api.recipes.ingredients.InfusionStackIngredient;
16-
import mekanism.api.recipes.ingredients.PigmentStackIngredient;
17-
import mekanism.api.recipes.ingredients.SlurryStackIngredient;
18-
import mekanism.api.recipes.ingredients.chemical.IGasIngredient;
19-
import mekanism.api.recipes.ingredients.chemical.IInfusionIngredient;
20-
import mekanism.api.recipes.ingredients.chemical.IPigmentIngredient;
21-
import mekanism.api.recipes.ingredients.chemical.ISlurryIngredient;
226
import mekanism.api.recipes.ingredients.creator.IChemicalIngredientCreator;
237
import mekanism.api.recipes.ingredients.creator.IChemicalStackIngredientCreator;
248
import mekanism.api.recipes.ingredients.creator.IFluidStackIngredientCreator;
@@ -66,62 +50,18 @@ public interface IMekanismAccess {
6650
IFluidStackIngredientCreator fluidStackIngredientCreator();
6751

6852
/**
69-
* Gets the gas stack ingredient creator.
53+
* Gets the chemical stack ingredient creator.
7054
*
71-
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#gasStack()} instead.
55+
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#chemicalStack()} instead.
56+
* @since 10.7.0
7257
*/
73-
IChemicalStackIngredientCreator<Gas, GasStack, IGasIngredient, GasStackIngredient> gasStackIngredientCreator();
58+
IChemicalStackIngredientCreator chemicalStackIngredientCreator();
7459

7560
/**
76-
* Gets the gas ingredient creator.
61+
* Gets the chemical ingredient creator.
7762
*
78-
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#gas()} instead.
79-
* @since 10.6.0
63+
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#chemical()} instead.
64+
* @since 10.7.0
8065
*/
81-
IChemicalIngredientCreator<Gas, IGasIngredient> gasIngredientCreator();
82-
83-
/**
84-
* Gets the infusion stack ingredient creator.
85-
*
86-
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#infusionStack()} instead.
87-
*/
88-
IChemicalStackIngredientCreator<InfuseType, InfusionStack, IInfusionIngredient, InfusionStackIngredient> infusionStackIngredientCreator();
89-
90-
/**
91-
* Gets the infusion ingredient creator.
92-
*
93-
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#infusion()} instead.
94-
* @since 10.6.0
95-
*/
96-
IChemicalIngredientCreator<InfuseType, IInfusionIngredient> infusionIngredientCreator();
97-
98-
/**
99-
* Gets the pigment stack ingredient creator.
100-
*
101-
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#pigmentStack()} instead.
102-
*/
103-
IChemicalStackIngredientCreator<Pigment, PigmentStack, IPigmentIngredient, PigmentStackIngredient> pigmentStackIngredientCreator();
104-
105-
/**
106-
* Gets the pigment ingredient creator.
107-
*
108-
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#pigment()} instead.
109-
* @since 10.6.0
110-
*/
111-
IChemicalIngredientCreator<Pigment, IPigmentIngredient> pigmentIngredientCreator();
112-
113-
/**
114-
* Gets the slurry stack ingredient creator.
115-
*
116-
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#slurryStack()} instead.
117-
*/
118-
IChemicalStackIngredientCreator<Slurry, SlurryStack, ISlurryIngredient, SlurryStackIngredient> slurryStackIngredientCreator();
119-
120-
/**
121-
* Gets the slurry ingredient creator.
122-
*
123-
* @apiNote Use {@link mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess#slurry()} instead.
124-
* @since 10.6.0
125-
*/
126-
IChemicalIngredientCreator<Slurry, ISlurryIngredient> slurryIngredientCreator();
66+
IChemicalIngredientCreator chemicalIngredientCreator();
12767
}

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

Lines changed: 30 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@
33
import com.mojang.logging.LogUtils;
44
import com.mojang.serialization.MapCodec;
55
import mekanism.api.annotations.NothingNullByDefault;
6-
import mekanism.api.chemical.gas.Gas;
7-
import mekanism.api.chemical.gas.GasBuilder;
8-
import mekanism.api.chemical.infuse.InfuseType;
9-
import mekanism.api.chemical.infuse.InfuseTypeBuilder;
10-
import mekanism.api.chemical.pigment.Pigment;
11-
import mekanism.api.chemical.pigment.PigmentBuilder;
12-
import mekanism.api.chemical.slurry.Slurry;
13-
import mekanism.api.chemical.slurry.SlurryBuilder;
6+
import mekanism.api.chemical.Chemical;
7+
import mekanism.api.chemical.ChemicalBuilder;
148
import mekanism.api.gear.ModuleData;
15-
import mekanism.api.recipes.ingredients.chemical.IGasIngredient;
16-
import mekanism.api.recipes.ingredients.chemical.IInfusionIngredient;
17-
import mekanism.api.recipes.ingredients.chemical.IPigmentIngredient;
18-
import mekanism.api.recipes.ingredients.chemical.ISlurryIngredient;
9+
import mekanism.api.recipes.ingredients.chemical.ChemicalIngredient;
1910
import mekanism.api.robit.RobitSkin;
2011
import net.minecraft.core.DefaultedRegistry;
2112
import net.minecraft.core.Registry;
@@ -34,7 +25,7 @@ private MekanismAPI() {
3425
/**
3526
* The version of the api classes - may not always match the mod's version
3627
*/
37-
public static final String API_VERSION = "10.6.7";
28+
public static final String API_VERSION = "10.7.0";
3829
/**
3930
* Mekanism's Mod ID
4031
*/
@@ -68,61 +59,21 @@ private static <T> ResourceKey<Registry<MapCodec<? extends T>>> codecRegistryKey
6859
public static final ResourceLocation EMPTY_CHEMICAL_NAME = rl("empty");
6960

7061
/**
71-
* Gets the {@link ResourceKey} representing the name of the Registry for {@link Gas gases}.
62+
* Gets the {@link ResourceKey} representing the name of the Registry for {@link Chemical chemicals}.
7263
*
73-
* @apiNote When registering {@link Gas gases} using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
74-
* @since 10.4.0
75-
*/
76-
public static final ResourceKey<Registry<Gas>> GAS_REGISTRY_NAME = registryKey(Gas.class, "gas");
77-
/**
78-
* Gets the {@link ResourceKey} representing the name of the Registry for {@link IGasIngredient} ingredient type serializers.
79-
*
80-
* @apiNote When registering gas ingredient types using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
81-
* @since 10.6.0
82-
*/
83-
public static final ResourceKey<Registry<MapCodec<? extends IGasIngredient>>> GAS_INGREDIENT_TYPE_REGISTRY_NAME = codecRegistryKey(IGasIngredient.class, "gas_ingredient_type");
84-
/**
85-
* Gets the {@link ResourceKey} representing the name of the Registry for {@link InfuseType infuse types}.
86-
*
87-
* @apiNote When registering {@link InfuseType infuse types} using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
88-
* @since 10.4.0
89-
*/
90-
public static final ResourceKey<Registry<InfuseType>> INFUSE_TYPE_REGISTRY_NAME = registryKey(InfuseType.class, "infuse_type");
91-
/**
92-
* Gets the {@link ResourceKey} representing the name of the Registry for {@link IInfusionIngredient} ingredient type serializers.
93-
*
94-
* @apiNote When registering infusion ingredient types using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
95-
* @since 10.6.0
96-
*/
97-
public static final ResourceKey<Registry<MapCodec<? extends IInfusionIngredient>>> INFUSION_INGREDIENT_TYPE_REGISTRY_NAME = codecRegistryKey(IInfusionIngredient.class, "infusion_ingredient_type");
98-
/**
99-
* Gets the {@link ResourceKey} representing the name of the Registry for {@link Pigment pigments}.
100-
*
101-
* @apiNote When registering {@link Pigment pigments} using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
102-
* @since 10.4.0
103-
*/
104-
public static final ResourceKey<Registry<Pigment>> PIGMENT_REGISTRY_NAME = registryKey(Pigment.class, "pigment");
105-
/**
106-
* Gets the {@link ResourceKey} representing the name of the Registry for {@link IPigmentIngredient} ingredient type serializers.
107-
*
108-
* @apiNote When registering pigment ingredient types using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
109-
* @since 10.6.0
110-
*/
111-
public static final ResourceKey<Registry<MapCodec<? extends IPigmentIngredient>>> PIGMENT_INGREDIENT_TYPE_REGISTRY_NAME = codecRegistryKey(IPigmentIngredient.class, "pigment_ingredient_type");
112-
/**
113-
* Gets the {@link ResourceKey} representing the name of the Registry for {@link Slurry sluries}.
114-
*
115-
* @apiNote When registering {@link Slurry sluries} using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
116-
* @since 10.4.0
64+
* @apiNote When registering {@link Chemical chemicals} using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
65+
* @since 10.7.0
11766
*/
118-
public static final ResourceKey<Registry<Slurry>> SLURRY_REGISTRY_NAME = registryKey(Slurry.class, "slurry");
67+
public static final ResourceKey<Registry<Chemical>> CHEMICAL_REGISTRY_NAME = registryKey(Chemical.class, "chemical");
68+
11969
/**
120-
* Gets the {@link ResourceKey} representing the name of the Registry for {@link ISlurryIngredient} ingredient type serializers.
70+
* Gets the {@link ResourceKey} representing the name of the Registry for {@link ChemicalIngredient} ingredient type serializers.
12171
*
122-
* @apiNote When registering slurry ingredient types using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
123-
* @since 10.6.0
72+
* @apiNote When registering chemical ingredient types using {@link DeferredRegister}, use this field to get access to the {@link ResourceKey}.
73+
* @since 10.7.0
12474
*/
125-
public static final ResourceKey<Registry<MapCodec<? extends ISlurryIngredient>>> SLURRY_INGREDIENT_TYPE_REGISTRY_NAME = codecRegistryKey(ISlurryIngredient.class, "slurry_ingredient_type");
75+
public static final ResourceKey<Registry<MapCodec<? extends ChemicalIngredient>>> CHEMICAL_INGREDIENT_TYPE_REGISTRY_NAME = codecRegistryKey(ChemicalIngredient.class, "chemical_ingredient_type");
76+
12677
/**
12778
* Gets the {@link ResourceKey} representing the name of the Registry for {@link ModuleData modules}.
12879
*
@@ -146,81 +97,26 @@ private static <T> ResourceKey<Registry<MapCodec<? extends T>>> codecRegistryKey
14697
public static final ResourceKey<Registry<MapCodec<? extends RobitSkin>>> ROBIT_SKIN_SERIALIZER_REGISTRY_NAME = codecRegistryKey(RobitSkin.class, "robit_skin_serializer");
14798

14899
/**
149-
* Gets the Registry for {@link Gas}.
100+
* Gets the Registry for {@link Chemical}.
150101
*
151-
* @see #GAS_REGISTRY_NAME
152-
* @since 10.5.0
102+
* @see #CHEMICAL_REGISTRY_NAME
103+
* @since 10.7.0
153104
*/
154-
public static final DefaultedRegistry<Gas> GAS_REGISTRY = (DefaultedRegistry<Gas>) new RegistryBuilder<>(GAS_REGISTRY_NAME)
105+
public static final DefaultedRegistry<Chemical> CHEMICAL_REGISTRY = (DefaultedRegistry<Chemical>) new RegistryBuilder<>(CHEMICAL_REGISTRY_NAME)
155106
.defaultKey(EMPTY_CHEMICAL_NAME)
156107
.sync(true)
157108
.create();
109+
158110
/**
159-
* Gets the Registry for {@link IGasIngredient} type serializers.
160-
*
161-
* @see #GAS_INGREDIENT_TYPE_REGISTRY_NAME
162-
* @since 10.6.0
163-
*/
164-
public static final Registry<MapCodec<? extends IGasIngredient>> GAS_INGREDIENT_TYPES = new RegistryBuilder<>(GAS_INGREDIENT_TYPE_REGISTRY_NAME)
165-
.sync(true)
166-
.create();
167-
/**
168-
* Gets the Registry for {@link InfuseType}.
169-
*
170-
* @see #INFUSE_TYPE_REGISTRY_NAME
171-
* @since 10.5.0
172-
*/
173-
public static final DefaultedRegistry<InfuseType> INFUSE_TYPE_REGISTRY = (DefaultedRegistry<InfuseType>) new RegistryBuilder<>(INFUSE_TYPE_REGISTRY_NAME)
174-
.defaultKey(EMPTY_CHEMICAL_NAME)
175-
.sync(true)
176-
.create();
177-
/**
178-
* Gets the Registry for {@link IInfusionIngredient} type serializers.
179-
*
180-
* @see #INFUSION_INGREDIENT_TYPE_REGISTRY_NAME
181-
* @since 10.6.0
182-
*/
183-
public static final Registry<MapCodec<? extends IInfusionIngredient>> INFUSION_INGREDIENT_TYPES = new RegistryBuilder<>(INFUSION_INGREDIENT_TYPE_REGISTRY_NAME)
184-
.sync(true)
185-
.create();
186-
/**
187-
* Gets the Registry for {@link Pigment}.
188-
*
189-
* @see #PIGMENT_REGISTRY_NAME
190-
* @since 10.5.0
191-
*/
192-
public static final DefaultedRegistry<Pigment> PIGMENT_REGISTRY = (DefaultedRegistry<Pigment>) new RegistryBuilder<>(PIGMENT_REGISTRY_NAME)
193-
.defaultKey(EMPTY_CHEMICAL_NAME)
194-
.sync(true)
195-
.create();
196-
/**
197-
* Gets the Registry for {@link IPigmentIngredient} type serializers.
198-
*
199-
* @see #PIGMENT_INGREDIENT_TYPE_REGISTRY_NAME
200-
* @since 10.6.0
201-
*/
202-
public static final Registry<MapCodec<? extends IPigmentIngredient>> PIGMENT_INGREDIENT_TYPES = new RegistryBuilder<>(PIGMENT_INGREDIENT_TYPE_REGISTRY_NAME)
203-
.sync(true)
204-
.create();
205-
/**
206-
* Gets the Registry for {@link Slurry}.
207-
*
208-
* @see #SLURRY_REGISTRY_NAME
209-
* @since 10.5.0
210-
*/
211-
public static final DefaultedRegistry<Slurry> SLURRY_REGISTRY = (DefaultedRegistry<Slurry>) new RegistryBuilder<>(SLURRY_REGISTRY_NAME)
212-
.defaultKey(EMPTY_CHEMICAL_NAME)
213-
.sync(true)
214-
.create();
215-
/**
216-
* Gets the Registry for {@link ISlurryIngredient} type serializers.
111+
* Gets the Registry for {@link ChemicalIngredient} type serializers.
217112
*
218-
* @see #SLURRY_INGREDIENT_TYPE_REGISTRY_NAME
219-
* @since 10.6.0
113+
* @see #CHEMICAL_INGREDIENT_TYPE_REGISTRY_NAME
114+
* @since 10.7.0
220115
*/
221-
public static final Registry<MapCodec<? extends ISlurryIngredient>> SLURRY_INGREDIENT_TYPES = new RegistryBuilder<>(SLURRY_INGREDIENT_TYPE_REGISTRY_NAME)
116+
public static final Registry<MapCodec<? extends ChemicalIngredient>> CHEMICAL_INGREDIENT_TYPES = new RegistryBuilder<>(CHEMICAL_INGREDIENT_TYPE_REGISTRY_NAME)
222117
.sync(true)
223118
.create();
119+
224120
/**
225121
* Gets the Registry for {@link ModuleData}.
226122
*
@@ -239,22 +135,12 @@ private static <T> ResourceKey<Registry<MapCodec<? extends T>>> codecRegistryKey
239135
public static final Registry<MapCodec<? extends RobitSkin>> ROBIT_SKIN_SERIALIZER_REGISTRY = new RegistryBuilder<>(ROBIT_SKIN_SERIALIZER_REGISTRY_NAME)
240136
.create();
241137

242-
//TODO: Potentially define these with DeferredHolder for purposes of fully defining them outside of the API
243-
// would have some minor issues with how the empty stacks are declared
244-
/**
245-
* Empty Gas instance.
246-
*/
247-
public static final Gas EMPTY_GAS = new Gas(GasBuilder.builder());
248-
/**
249-
* Empty Infuse Type instance.
250-
*/
251-
public static final InfuseType EMPTY_INFUSE_TYPE = new InfuseType(InfuseTypeBuilder.builder());
138+
//TODO: Potentially define this with DeferredHolder for purposes of fully defining them outside of the API
252139
/**
253-
* Empty Pigment instance.
254-
*/
255-
public static final Pigment EMPTY_PIGMENT = new Pigment(PigmentBuilder.builder());
256-
/**
257-
* Empty Slurry instance.
140+
* Empty Chemical instance.
141+
*
142+
* @since 10.7.0
258143
*/
259-
public static final Slurry EMPTY_SLURRY = new Slurry(SlurryBuilder.clean());
144+
public static final Chemical EMPTY_CHEMICAL = new Chemical(ChemicalBuilder.builder());
145+
260146
}

0 commit comments

Comments
 (0)