Skip to content

Commit ad0a40f

Browse files
committed
Remove things that we deprecated for removal and rename a few methods in module helper
1 parent f06e6e5 commit ad0a40f

28 files changed

+49
-269
lines changed

src/api/java/mekanism/api/chemical/merged/ChemicalTankWrapper.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package mekanism.api.chemical.merged;
22

3-
import java.util.Collections;
43
import java.util.List;
54
import java.util.function.BooleanSupplier;
65
import mekanism.api.Action;
@@ -27,11 +26,6 @@ public abstract class ChemicalTankWrapper<CHEMICAL extends Chemical<CHEMICAL>, S
2726
private final BooleanSupplier insertCheck;
2827
private final MergedChemicalTank mergedTank;
2928

30-
@Deprecated(forRemoval = true, since = "10.5.15")
31-
protected ChemicalTankWrapper(MergedChemicalTank mergedTank, IChemicalTank<CHEMICAL, STACK> internal, BooleanSupplier insertCheck) {
32-
this(mergedTank, internal, Collections.emptyList(), insertCheck);
33-
}
34-
3529
protected ChemicalTankWrapper(MergedChemicalTank mergedTank, IChemicalTank<CHEMICAL, STACK> internal, List<IChemicalTank<?, ?>> otherTanks,
3630
@Nullable BooleanSupplier insertCheck) {
3731
//TODO: Do we want to short circuit it so that if we are not empty it allows for inserting before checking the insertCheck

src/api/java/mekanism/api/chemical/merged/MergedChemicalTank.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.ArrayList;
44
import java.util.Collection;
5-
import java.util.Collections;
65
import java.util.HashMap;
76
import java.util.List;
87
import java.util.Map;
@@ -197,16 +196,6 @@ private boolean canHandle(IChemicalTank<?, ?> tank) {
197196
return tankValidator.test(tank);
198197
}
199198

200-
/**
201-
* It is assumed that {@link #canHandle(IChemicalTank)} is called before this method
202-
*
203-
* @deprecated Use {@link #createWrapper(MergedChemicalTank, IChemicalTank, List, BooleanSupplier)}
204-
*/
205-
@Deprecated(forRemoval = true, since = "10.5.15")
206-
public TANK createWrapper(MergedChemicalTank mergedTank, IChemicalTank<?, ?> tank, BooleanSupplier insertCheck) {
207-
return createWrapper(mergedTank, tank, Collections.emptyList(), insertCheck);
208-
}
209-
210199
/**
211200
* It is assumed that {@link #canHandle(IChemicalTank)} is called before this method
212201
*
@@ -224,47 +213,27 @@ public String toString() {
224213

225214
private static class GasTankWrapper extends ChemicalTankWrapper<Gas, GasStack> implements IGasTank {
226215

227-
@Deprecated(forRemoval = true, since = "10.5.15")
228-
public GasTankWrapper(MergedChemicalTank mergedTank, IGasTank internal, BooleanSupplier insertCheck) {
229-
this(mergedTank, internal, Collections.emptyList(), insertCheck);
230-
}
231-
232216
public GasTankWrapper(MergedChemicalTank mergedTank, IGasTank internal, List<IChemicalTank<?, ?>> otherTanks, @Nullable BooleanSupplier insertCheck) {
233217
super(mergedTank, internal, otherTanks, insertCheck);
234218
}
235219
}
236220

237221
private static class InfusionTankWrapper extends ChemicalTankWrapper<InfuseType, InfusionStack> implements IInfusionTank {
238222

239-
@Deprecated(forRemoval = true, since = "10.5.15")
240-
public InfusionTankWrapper(MergedChemicalTank mergedTank, IInfusionTank internal, BooleanSupplier insertCheck) {
241-
this(mergedTank, internal, Collections.emptyList(), insertCheck);
242-
}
243-
244223
public InfusionTankWrapper(MergedChemicalTank mergedTank, IInfusionTank internal, List<IChemicalTank<?, ?>> otherTanks, @Nullable BooleanSupplier insertCheck) {
245224
super(mergedTank, internal, otherTanks, insertCheck);
246225
}
247226
}
248227

249228
private static class PigmentTankWrapper extends ChemicalTankWrapper<Pigment, PigmentStack> implements IPigmentTank {
250229

251-
@Deprecated(forRemoval = true, since = "10.5.15")
252-
public PigmentTankWrapper(MergedChemicalTank mergedTank, IPigmentTank internal, BooleanSupplier insertCheck) {
253-
this(mergedTank, internal, Collections.emptyList(), insertCheck);
254-
}
255-
256230
public PigmentTankWrapper(MergedChemicalTank mergedTank, IPigmentTank internal, List<IChemicalTank<?, ?>> otherTanks, @Nullable BooleanSupplier insertCheck) {
257231
super(mergedTank, internal, otherTanks, insertCheck);
258232
}
259233
}
260234

261235
private static class SlurryTankWrapper extends ChemicalTankWrapper<Slurry, SlurryStack> implements ISlurryTank {
262236

263-
@Deprecated(forRemoval = true, since = "10.5.15")
264-
public SlurryTankWrapper(MergedChemicalTank mergedTank, ISlurryTank internal, BooleanSupplier insertCheck) {
265-
this(mergedTank, internal, Collections.emptyList(), insertCheck);
266-
}
267-
268237
public SlurryTankWrapper(MergedChemicalTank mergedTank, ISlurryTank internal, List<IChemicalTank<?, ?>> otherTanks, @Nullable BooleanSupplier insertCheck) {
269238
super(mergedTank, internal, otherTanks, insertCheck);
270239
}

src/api/java/mekanism/api/fluid/ExtendedFluidHandlerUtils.java

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.util.ArrayList;
66
import java.util.List;
77
import java.util.function.Function;
8-
import java.util.function.IntFunction;
9-
import java.util.function.IntSupplier;
108
import java.util.function.ToIntFunction;
119
import mekanism.api.Action;
1210
import mekanism.api.AutomationType;
@@ -15,25 +13,10 @@
1513
import mekanism.api.container.IntContainerInteraction;
1614
import net.minecraft.core.Direction;
1715
import net.neoforged.neoforge.fluids.FluidStack;
18-
import org.jetbrains.annotations.NotNull;
1916
import org.jetbrains.annotations.Nullable;
2017

2118
public class ExtendedFluidHandlerUtils {
2219

23-
/**
24-
* Util method for a generic insert implementation for various handlers. Mainly for internal use only
25-
*
26-
* @deprecated Please use {@link #insert(FluidStack, Direction, Action, ToIntFunction, InContainerGetter, ContainerInteraction)} to avoid capturing lambdas.
27-
*/
28-
@Deprecated(forRemoval = true, since = "10.5.13")
29-
public static FluidStack insert(FluidStack stack, Action action, IntSupplier tankCount, IntFunction<@NotNull FluidStack> inTankGetter, InsertFluid insertFluid) {
30-
if (stack.isEmpty()) {
31-
//Short circuit if nothing is actually being inserted
32-
return FluidStack.EMPTY;
33-
}
34-
return insert(stack, null, action, side -> tankCount.getAsInt(), (tank, side) -> inTankGetter.apply(tank), (tank, fluid, side, act) -> insertFluid.insert(tank, fluid, act));
35-
}
36-
3720
/**
3821
* Util method for a generic insert implementation for various handlers. Mainly for internal use only
3922
*
@@ -125,19 +108,6 @@ public static FluidStack insert(FluidStack stack, @Nullable Direction side, Func
125108
return toInsert;
126109
}
127110

128-
/**
129-
* Util method for a generic extraction implementation for various handlers. Mainly for internal use only
130-
*
131-
* @deprecated Please use {@link #extract(int, Direction, Action, ToIntFunction, InContainerGetter, IntContainerInteraction)} to avoid capturing lambdas.
132-
*/
133-
@Deprecated(forRemoval = true, since = "10.5.13")
134-
public static FluidStack extract(int amount, Action action, IntSupplier tankCount, IntFunction<@NotNull FluidStack> inTankGetter, ExtractFluid extractFluid) {
135-
if (amount == 0) {
136-
return FluidStack.EMPTY;
137-
}
138-
return extract(amount, null, action, side -> tankCount.getAsInt(), (tank, side) -> inTankGetter.apply(tank), (tank, fluid, side, act) -> extractFluid.extract(tank, fluid, act));
139-
}
140-
141111
/**
142112
* Util method for a generic extraction implementation for various handlers. Mainly for internal use only
143113
*
@@ -222,19 +192,6 @@ public static FluidStack extract(int amount, @Nullable Direction side, Function<
222192
return extracted;
223193
}
224194

225-
/**
226-
* Util method for a generic extraction implementation for various handlers. Mainly for internal use only
227-
*
228-
* @deprecated Please use {@link #extract(FluidStack, Direction, Action, ToIntFunction, InContainerGetter, IntContainerInteraction)} to avoid capturing lambdas.
229-
*/
230-
@Deprecated(forRemoval = true, since = "10.5.13")
231-
public static FluidStack extract(FluidStack stack, Action action, IntSupplier tankCount, IntFunction<@NotNull FluidStack> inTankGetter, ExtractFluid extractFluid) {
232-
if (stack.isEmpty()) {
233-
return FluidStack.EMPTY;
234-
}
235-
return extract(stack, null, action, side -> tankCount.getAsInt(), (tank, side) -> inTankGetter.apply(tank), (tank, fluid, side, act) -> extractFluid.extract(tank, fluid, act));
236-
}
237-
238195
/**
239196
* Util method for a generic extraction implementation for various handlers. Mainly for internal use only
240197
*
@@ -324,24 +281,4 @@ public static FluidStack extract(FluidStack stack, @Nullable Direction side, Fun
324281
}
325282
return extracted;
326283
}
327-
328-
/**
329-
* @deprecated See {@link mekanism.api.container.ContainerInteraction}
330-
*/
331-
@FunctionalInterface
332-
@Deprecated(forRemoval = true, since = "10.5.13")
333-
public interface InsertFluid {
334-
335-
FluidStack insert(int tank, FluidStack stack, Action action);
336-
}
337-
338-
/**
339-
* @deprecated See {@link mekanism.api.container.IntContainerInteraction}
340-
*/
341-
@FunctionalInterface
342-
@Deprecated(forRemoval = true, since = "10.5.13")
343-
public interface ExtractFluid {
344-
345-
FluidStack extract(int tank, int amount, Action action);
346-
}
347284
}

src/api/java/mekanism/api/gear/IModuleHelper.java

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.Collection;
55
import java.util.Collections;
66
import java.util.List;
7-
import java.util.Optional;
87
import java.util.ServiceLoader;
98
import java.util.Set;
109
import java.util.function.Predicate;
@@ -101,7 +100,7 @@ public interface IModuleHelper {
101100
* @return {@code true} if the item has the module installed and enabled.
102101
*/
103102
default boolean isEnabled(ItemStack stack, IModuleDataProvider<?> typeProvider) {
104-
IModuleContainer container = getModuleContainerNullable(stack);
103+
IModuleContainer container = getModuleContainer(stack);
105104
return container != null && container.hasEnabled(typeProvider);
106105
}
107106

@@ -114,9 +113,8 @@ default boolean isEnabled(ItemStack stack, IModuleDataProvider<?> typeProvider)
114113
* @return Module, or {@code null} if no module of the given type is installed.
115114
*/
116115
@Nullable
117-
default <MODULE extends ICustomModule<MODULE>> IModule<MODULE> load(ItemStack stack, IModuleDataProvider<MODULE> typeProvider) {
118-
//TODO - 1.20.5: Rename to getModule or get, and also re-evaluate other names in this class
119-
IModuleContainer container = getModuleContainerNullable(stack);
116+
default <MODULE extends ICustomModule<MODULE>> IModule<MODULE> getModule(ItemStack stack, IModuleDataProvider<MODULE> typeProvider) {
117+
IModuleContainer container = getModuleContainer(stack);
120118
return container == null ? null : container.get(typeProvider);
121119
}
122120

@@ -130,7 +128,7 @@ default <MODULE extends ICustomModule<MODULE>> IModule<MODULE> load(ItemStack st
130128
*/
131129
@Nullable
132130
default <MODULE extends ICustomModule<MODULE>> IModule<MODULE> getIfEnabled(ItemStack stack, IModuleDataProvider<MODULE> typeProvider) {
133-
IModuleContainer container = getModuleContainerNullable(stack);
131+
IModuleContainer container = getModuleContainer(stack);
134132
return container == null ? null : container.getIfEnabled(typeProvider);
135133
}
136134

@@ -146,46 +144,19 @@ default <MODULE extends ICustomModule<MODULE>> IModule<MODULE> getIfEnabled(Item
146144
@Nullable
147145
default <MODULE extends ICustomModule<MODULE>> IModule<MODULE> getIfEnabled(@Nullable LivingEntity entity, @Nullable EquipmentSlot slot,
148146
IModuleDataProvider<MODULE> typeProvider) {
149-
IModuleContainer container = getModuleContainerNullable(entity, slot);
147+
IModuleContainer container = getModuleContainer(entity, slot);
150148
return container == null ? null : container.getIfEnabled(typeProvider);
151149
}
152150

153-
/**
154-
* {@return module container for the stack, or empty if it is empty or not a module container}
155-
*
156-
* @param stack Stack to check for being a module container and then to retrieve the container of.
157-
*
158-
* @since 10.5.0
159-
* @deprecated Prefer using {@link #getModuleContainerNullable(ItemStack)}
160-
*/
161-
@Deprecated(forRemoval = true, since = "10.5.15")
162-
default Optional<? extends IModuleContainer> getModuleContainer(ItemStack stack) {
163-
return Optional.ofNullable(getModuleContainerNullable(stack));
164-
}
165-
166151
/**
167152
* {@return module container for the stack, or null if the stack is empty or not a module container}
168153
*
169154
* @param stack Stack to check for being a module container and then to retrieve the container of.
170155
*
171156
* @since 10.5.15
172157
*/
173-
@Nullable//TODO - 1.20.5: Rename to getModuleContainer
174-
IModuleContainer getModuleContainerNullable(ItemStack stack);
175-
176-
/**
177-
* {@return module container for the item in entity's equipment slot, or empty if it is empty or not a module container}
178-
*
179-
* @param entity Entity that has the stack.
180-
* @param slot Slot the stack is in.
181-
*
182-
* @since 10.5.0
183-
* @deprecated Prefer using {@link #getModuleContainerNullable(LivingEntity, EquipmentSlot)}
184-
*/
185-
@Deprecated(forRemoval = true, since = "10.5.15")
186-
default Optional<? extends IModuleContainer> getModuleContainer(@Nullable LivingEntity entity, @Nullable EquipmentSlot slot) {
187-
return Optional.ofNullable(getModuleContainerNullable(entity, slot));
188-
}
158+
@Nullable
159+
IModuleContainer getModuleContainer(ItemStack stack);
189160

190161
/**
191162
* {@return module container for the item in entity's equipment slot, or null if the entity is null, or the stack is empty or not a module container}
@@ -195,12 +166,12 @@ default Optional<? extends IModuleContainer> getModuleContainer(@Nullable Living
195166
*
196167
* @since 10.5.15
197168
*/
198-
@Nullable//TODO - 1.20.5: Rename to getModuleContainer
199-
default IModuleContainer getModuleContainerNullable(@Nullable LivingEntity entity, @Nullable EquipmentSlot slot) {
169+
@Nullable
170+
default IModuleContainer getModuleContainer(@Nullable LivingEntity entity, @Nullable EquipmentSlot slot) {
200171
if (entity == null || slot == null) {
201172
return null;
202173
}
203-
return getModuleContainerNullable(entity.getItemBySlot(slot));
174+
return getModuleContainer(entity.getItemBySlot(slot));
204175
}
205176

206177
/**
@@ -232,8 +203,8 @@ default boolean isModuleContainer(ItemStack stack) {
232203
*
233204
* @param stack Module container, for example a Meka-Tool or MekaSuit piece.
234205
*/
235-
default Collection<? extends IModule<?>> loadAll(ItemStack stack) {
236-
IModuleContainer container = getModuleContainerNullable(stack);
206+
default Collection<? extends IModule<?>> getAllModules(ItemStack stack) {
207+
IModuleContainer container = getModuleContainer(stack);
237208
return container != null ? container.modules() : Collections.emptyList();
238209
}
239210

@@ -246,9 +217,9 @@ default Collection<? extends IModule<?>> loadAll(ItemStack stack) {
246217
* @return List of modules on an item of the given class, or an empty list if the item doesn't support modules or has no modules of that type.
247218
*/
248219
@SuppressWarnings("unchecked")
249-
default <MODULE extends ICustomModule<?>> List<? extends IModule<? extends MODULE>> loadAll(ItemStack stack, Class<MODULE> moduleClass) {
220+
default <MODULE extends ICustomModule<?>> List<? extends IModule<? extends MODULE>> getAllModules(ItemStack stack, Class<MODULE> moduleClass) {
250221
List<IModule<? extends MODULE>> list = new ArrayList<>();
251-
for (IModule<?> module : loadAll(stack)) {
222+
for (IModule<?> module : getAllModules(stack)) {
252223
if (moduleClass.isInstance(module.getCustomInstance())) {
253224
list.add((IModule<? extends MODULE>) module);
254225
}
@@ -263,8 +234,8 @@ default <MODULE extends ICustomModule<?>> List<? extends IModule<? extends MODUL
263234
*
264235
* @return Module types on an item.
265236
*/
266-
default Set<ModuleData<?>> loadAllTypes(ItemStack stack) {
267-
IModuleContainer container = getModuleContainerNullable(stack);
237+
default Set<ModuleData<?>> getAllTypes(ItemStack stack) {
238+
IModuleContainer container = getModuleContainer(stack);
268239
return container != null ? container.moduleTypes() : Collections.emptySet();
269240
}
270241

src/api/java/mekanism/api/gear/config/ModuleEnumData.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,35 +58,6 @@ public ModuleEnumData(TYPE def, int selectableCount) {
5858
}
5959
}
6060

61-
/**
62-
* Creates a new {@link ModuleEnumData} out of a given enum type and initializes it to the given default value.
63-
*
64-
* @param enumClass Class of the Enum this {@link ModuleEnumData} corresponds to.
65-
* @param def Default value.
66-
*
67-
* @deprecated since 10.3.2, use the version ({@link #ModuleEnumData(Enum)}) that figures out the class automatically.
68-
*/
69-
@Deprecated(forRemoval = true, since = "10.3.2")
70-
public ModuleEnumData(Class<TYPE> enumClass, TYPE def) {
71-
this(def);
72-
Objects.requireNonNull(enumClass, "Enum Class cannot be null.");
73-
}
74-
75-
/**
76-
* Creates a new {@link ModuleEnumData} out of the first selectableCount elements in the given enum type and initializes it to the given default value.
77-
*
78-
* @param enumClass Class of the Enum this {@link ModuleEnumData} corresponds to.
79-
* @param selectableCount The number of selectable elements.
80-
* @param def Default value.
81-
*
82-
* @deprecated since 10.3.2, use the version ({@link #ModuleEnumData(Enum, int)}) that figures out the class automatically.
83-
*/
84-
@Deprecated(forRemoval = true, since = "10.3.2")
85-
public ModuleEnumData(Class<TYPE> enumClass, int selectableCount, TYPE def) {
86-
this(def, selectableCount);
87-
Objects.requireNonNull(enumClass, "Enum Class cannot be null.");
88-
}
89-
9061
/**
9162
* Gets all the valid values of this {@link ModuleEnumData}.
9263
*

0 commit comments

Comments
 (0)