diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2022-12-14 18:44:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-14 11:44:48 +0100 |
commit | cea7333c3c55efc2150a104dc86da65dc8e9d2b1 (patch) | |
tree | ece3dd5696cd0b13c9e8269542edbc26ed1c227f /src/main/java/gregtech/api | |
parent | f6919bc43dacaae50a9db5852cde6b1eaca8c6c9 (diff) | |
download | GT5-Unofficial-cea7333c3c55efc2150a104dc86da65dc8e9d2b1.tar.gz GT5-Unofficial-cea7333c3c55efc2150a104dc86da65dc8e9d2b1.tar.bz2 GT5-Unofficial-cea7333c3c55efc2150a104dc86da65dc8e9d2b1.zip |
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>
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r-- | src/main/java/gregtech/api/interfaces/covers/IControlsWorkCover.java | 27 |
1 files changed, 27 insertions, 0 deletions
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; + } +} |