diff options
Diffstat (limited to 'src/main/java/gregtech/api/logic')
8 files changed, 20 insertions, 29 deletions
diff --git a/src/main/java/gregtech/api/logic/AbstractProcessingLogic.java b/src/main/java/gregtech/api/logic/AbstractProcessingLogic.java index af86e7a9fa..57fbf22700 100644 --- a/src/main/java/gregtech/api/logic/AbstractProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/AbstractProcessingLogic.java @@ -282,7 +282,7 @@ public abstract class AbstractProcessingLogic<P extends AbstractProcessingLogic< /** * Override to perform additional logic when recipe starts. - * + * <p> * This is called when the recipe processing logic has finished all * checks, consumed all inputs, but has not yet set the outputs to * be produced. Returning a result other than SUCCESSFUL will void diff --git a/src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.java b/src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.java index 72a74ebd04..91df0bb1b6 100644 --- a/src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.java +++ b/src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.java @@ -102,20 +102,12 @@ public class ComplexParallelProcessingLogic<P extends ComplexParallelProcessingL calculatedEutValues = new long[maxComplexParallels]; durations = new int[maxComplexParallels]; progresses = new int[maxComplexParallels]; - for (int i = 0; i < oldOutputItems.length; i++) { - outputItems[i] = oldOutputItems[i]; - } - for (int i = 0; i < oldOutputFluids.length; i++) { - outputFluids[i] = oldOutputFluids[i]; - } - for (int i = 0; i < oldCalculatedEutValues.length; i++) { - calculatedEutValues[i] = oldCalculatedEutValues[i]; - } + System.arraycopy(oldOutputItems, 0, outputItems, 0, oldOutputItems.length); + System.arraycopy(oldOutputFluids, 0, outputFluids, 0, oldOutputFluids.length); + System.arraycopy(oldCalculatedEutValues, 0, calculatedEutValues, 0, oldCalculatedEutValues.length); for (int i = 0; i < oldDurations[i]; i++) { durations[i] = oldDurations[i]; } - for (int i = 0; i < oldProgresses.length; i++) { - progresses[i] = oldProgresses[i]; - } + System.arraycopy(oldProgresses, 0, progresses, 0, oldProgresses.length); } } diff --git a/src/main/java/gregtech/api/logic/ControllerFluidLogic.java b/src/main/java/gregtech/api/logic/ControllerFluidLogic.java index 211c1c2982..227f7641ce 100644 --- a/src/main/java/gregtech/api/logic/ControllerFluidLogic.java +++ b/src/main/java/gregtech/api/logic/ControllerFluidLogic.java @@ -20,7 +20,7 @@ import org.apache.commons.lang3.tuple.Pair; /** * Controller logic for Fluid inventories - * + * * @author BlueWeabo */ public class ControllerFluidLogic { @@ -54,7 +54,7 @@ public class ControllerFluidLogic { @Nullable private Pair<UUID, FluidInventoryLogic> checkIfInventoryExistsAsUnallocated( @Nonnull FluidInventoryLogic inventory) { - if (unallocatedInventories.size() == 0) { + if (unallocatedInventories.isEmpty()) { return null; } return unallocatedInventories.stream() diff --git a/src/main/java/gregtech/api/logic/ControllerItemLogic.java b/src/main/java/gregtech/api/logic/ControllerItemLogic.java index 2863c2f49c..28cc75313a 100644 --- a/src/main/java/gregtech/api/logic/ControllerItemLogic.java +++ b/src/main/java/gregtech/api/logic/ControllerItemLogic.java @@ -20,7 +20,7 @@ import org.apache.commons.lang3.tuple.Pair; /** * Logic of the Item logic for the controller. This is controlling all of the inventories. - * + * * @author BlueWeabo */ public class ControllerItemLogic { @@ -53,7 +53,7 @@ public class ControllerItemLogic { @Nullable private Pair<UUID, ItemInventoryLogic> checkIfInventoryExistsAsUnallocated(@Nonnull ItemInventoryLogic inventory) { - if (unallocatedInventories.size() == 0) { + if (unallocatedInventories.isEmpty()) { return null; } return unallocatedInventories.stream() diff --git a/src/main/java/gregtech/api/logic/FluidInventoryLogic.java b/src/main/java/gregtech/api/logic/FluidInventoryLogic.java index 88c0c954ec..1949a27e2a 100644 --- a/src/main/java/gregtech/api/logic/FluidInventoryLogic.java +++ b/src/main/java/gregtech/api/logic/FluidInventoryLogic.java @@ -3,7 +3,7 @@ package gregtech.api.logic; import java.util.Collection; import java.util.HashMap; import java.util.Map; -import java.util.stream.Collectors; +import java.util.Objects; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -25,7 +25,7 @@ import com.gtnewhorizons.modularui.common.widget.Scrollable; /** * Generic Fluid logic for MuTEs. - * + * * @author BlueWeabo */ public class FluidInventoryLogic { @@ -82,7 +82,7 @@ public class FluidInventoryLogic { } /** - * + * * @return The Fluid Inventory Logic as an NBTTagList to be saved in another nbt as how one wants. */ @Nonnull @@ -137,9 +137,8 @@ public class FluidInventoryLogic { public FluidStack[] getStoredFluids() { final FluidStack[] fluids = inventory.getFluids() .stream() - .filter(fluid -> fluid != null) - .collect(Collectors.toList()) - .toArray(new FluidStack[0]); + .filter(Objects::nonNull) + .toArray(FluidStack[]::new); if (fluids == null) { return new FluidStack[0]; } @@ -181,7 +180,7 @@ public class FluidInventoryLogic { /** * Try and drain the first fluid found for that amount. Used by GT_Cover_Pump - * + * * @param amount Fluid to drain from the tank * @return A fluidstack with the possible amount drained */ diff --git a/src/main/java/gregtech/api/logic/ItemInventoryLogic.java b/src/main/java/gregtech/api/logic/ItemInventoryLogic.java index 22d4a9a627..b37920d206 100644 --- a/src/main/java/gregtech/api/logic/ItemInventoryLogic.java +++ b/src/main/java/gregtech/api/logic/ItemInventoryLogic.java @@ -5,6 +5,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; @@ -164,9 +165,8 @@ public class ItemInventoryLogic { public ItemStack[] getStoredItems() { final ItemStack[] items = inventory.getStacks() .stream() - .filter(item -> item != null) - .collect(Collectors.toList()) - .toArray(new ItemStack[0]); + .filter(Objects::nonNull) + .toArray(ItemStack[]::new); if (items == null) { return new ItemStack[0]; } diff --git a/src/main/java/gregtech/api/logic/PowerLogic.java b/src/main/java/gregtech/api/logic/PowerLogic.java index afc1877deb..52fc762d1b 100644 --- a/src/main/java/gregtech/api/logic/PowerLogic.java +++ b/src/main/java/gregtech/api/logic/PowerLogic.java @@ -22,7 +22,7 @@ public class PowerLogic { public static final int RECEIVER = 1; public static final int EMITTER = 2; public static final int BOTH = RECEIVER | EMITTER; - private static float wirelessChargeFactor = 0.5F; + private static final float wirelessChargeFactor = 0.5F; private long storedEnergy = 0; private long energyCapacity = 0; private long voltage = 0; diff --git a/src/main/java/gregtech/api/logic/interfaces/ProcessingLogicHost.java b/src/main/java/gregtech/api/logic/interfaces/ProcessingLogicHost.java index b8291c9843..314d0d3d97 100644 --- a/src/main/java/gregtech/api/logic/interfaces/ProcessingLogicHost.java +++ b/src/main/java/gregtech/api/logic/interfaces/ProcessingLogicHost.java @@ -70,7 +70,7 @@ public interface ProcessingLogicHost<P extends MuTEProcessingLogic<P>> /** * DO NOT CALL YOURSELF!!! - * + * <p> * If you want to make the processing logic be updated call {@link #setProcessingUpdate(boolean)} */ boolean needsUpdate(); |