From cea7333c3c55efc2150a104dc86da65dc8e9d2b1 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Wed, 14 Dec 2022 18:44:48 +0800 Subject: ensure machine controller incompatible with redstone receiver (#1547) Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> --- .../api/interfaces/covers/IControlsWorkCover.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main/java/gregtech/api/interfaces/covers/IControlsWorkCover.java (limited to 'src/main/java/gregtech/api') diff --git a/src/main/java/gregtech/api/interfaces/covers/IControlsWorkCover.java b/src/main/java/gregtech/api/interfaces/covers/IControlsWorkCover.java new file mode 100644 index 0000000000..7c2361af83 --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/covers/IControlsWorkCover.java @@ -0,0 +1,27 @@ +package gregtech.api.interfaces.covers; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IMachineProgress; + +/** + * Marker interface for covers that might control whether the work can start on a {@link IMachineProgress}. + */ +public interface IControlsWorkCover { + + /** + * Make sure there is only one GT_Cover_ControlsWork on the aTileEntity + * TODO this is a migration thing. Remove this after 2.3.0 is released. + * + * @return true if the cover is the first (side) one + **/ + static boolean makeSureOnlyOne(byte aMySide, ICoverable aTileEntity) { + for (byte i = 0; i < 6; i++) { + if (aTileEntity.getCoverBehaviorAtSideNew(i) instanceof IControlsWorkCover && i < aMySide) { + aTileEntity.dropCover(i, i, true); + aTileEntity.markDirty(); + return false; + } + } + return true; + } +} -- cgit