diff --git a/CHANGELOG.md b/CHANGELOG.md index 837b0f68cb..a9cb27cc5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,4 +18,4 @@ Version: 1.0.15 * fix item pipes stopping transfer after their transfer rate per second has been reached once * fix capability IO directions * fix laser pipes not connecting to hatches -* fix diodes being counted as energy input in cleanrooms \ No newline at end of file +* fix diodes and hulls being counted as energy input in cleanrooms \ No newline at end of file diff --git a/common/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java b/common/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java index 0c8dc42ea8..5c29e0d03c 100644 --- a/common/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java +++ b/common/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java @@ -7,8 +7,6 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.ICleanroomReceiver; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; -import com.gregtechceu.gtceu.common.machine.multiblock.part.DiodePartMachine; -import com.gregtechceu.gtceu.common.machine.trait.CleanroomLogic; import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; @@ -19,14 +17,23 @@ import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMufflerMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; -import com.gregtechceu.gtceu.api.machine.multiblock.*; +import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; +import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; +import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; +import com.gregtechceu.gtceu.api.machine.multiblock.WorkableMultiblockMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.misc.EnergyContainerList; -import com.gregtechceu.gtceu.api.pattern.*; +import com.gregtechceu.gtceu.api.pattern.BlockPattern; +import com.gregtechceu.gtceu.api.pattern.FactoryBlockPattern; +import com.gregtechceu.gtceu.api.pattern.Predicates; +import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; import com.gregtechceu.gtceu.common.data.GTBlocks; +import com.gregtechceu.gtceu.common.machine.electric.HullMachine; +import com.gregtechceu.gtceu.common.machine.multiblock.part.DiodePartMachine; import com.gregtechceu.gtceu.common.machine.multiblock.primitive.CokeOvenMachine; import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitiveBlastFurnaceMachine; import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitivePumpMachine; +import com.gregtechceu.gtceu.common.machine.trait.CleanroomLogic; import com.gregtechceu.gtceu.utils.GTUtil; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; @@ -53,7 +60,8 @@ import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; -import static com.gregtechceu.gtceu.api.pattern.Predicates.*; +import static com.gregtechceu.gtceu.api.pattern.Predicates.abilities; +import static com.gregtechceu.gtceu.api.pattern.Predicates.states; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @@ -158,9 +166,9 @@ protected void initializeAbilities() { List energyContainers = new ArrayList<>(); Map ioMap = getMultiblockState().getMatchContext().getOrCreate("ioMap", Long2ObjectMaps::emptyMap); for (IMultiPart part : getParts()) { - if (part instanceof DiodePartMachine) continue; + if (isPartIgnored(part)) continue; IO io = ioMap.getOrDefault(part.self().getPos().asLong(), IO.BOTH); - if(io == IO.NONE || io == IO.OUT) continue; + if (io == IO.NONE || io == IO.OUT) continue; for (var handler : part.getRecipeHandlers()) { // If IO not compatible if (io != IO.BOTH && handler.getHandlerIO() != IO.BOTH && io != handler.getHandlerIO()) continue; @@ -176,6 +184,14 @@ protected void initializeAbilities() { getRecipeLogic().setEnergyContainer(this.inputEnergyContainers); } + @SuppressWarnings("RedundantIfStatement") // `return false` being a separate statement is better for readability + private static boolean isPartIgnored(IMultiPart part) { + if (part instanceof DiodePartMachine) return true; + if (part instanceof HullMachine) return true; + + return false; + } + /** * Scans for blocks around the controller to update the dimensions */ @@ -376,7 +392,7 @@ protected BlockState getGlassState() { @Nonnull protected static TraceabilityPredicate doorPredicate() { return Predicates.custom(blockWorldState -> blockWorldState.getBlockState().getBlock() instanceof DoorBlock, - () -> new BlockInfo[] {new BlockInfo(Blocks.IRON_DOOR.defaultBlockState()), new BlockInfo(Blocks.IRON_DOOR.defaultBlockState().setValue(DoorBlock.HALF, DoubleBlockHalf.UPPER))}); + () -> new BlockInfo[]{new BlockInfo(Blocks.IRON_DOOR.defaultBlockState()), new BlockInfo(Blocks.IRON_DOOR.defaultBlockState().setValue(DoorBlock.HALF, DoubleBlockHalf.UPPER))}); } @Nonnull