From 23ad5cfcb2a08eff59d31f8a13f38dc3c264b42c Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Sat, 23 Sep 2023 01:08:48 +0800 Subject: disable large turbine rotation or flip (#2290) also made the rotation and flip marker to not show up when the multi doesn't support rotating or flipping --- src/main/java/gregtech/common/GT_Client.java | 19 +++++++++++------ .../multi/GT_MetaTileEntity_DistillationTower.java | 5 +++++ .../multi/GT_MetaTileEntity_DrillerBase.java | 5 +++++ .../multi/GT_MetaTileEntity_LargeTurbine.java | 24 ++++++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 0378e7f127..f741f56927 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -400,27 +400,34 @@ public class GT_Client extends GT_Proxy implements Runnable { if (tAlignment != null) { final ForgeDirection direction = tAlignment.getDirection(); if (direction.ordinal() == tSideHit) - drawExtendedRotationMarker(ROTATION_MARKER_TRANSFORM_CENTER, aIsSneaking, false); + drawExtendedRotationMarker(ROTATION_MARKER_TRANSFORM_CENTER, aIsSneaking, tAlignment); else if (direction.getOpposite() .ordinal() == tSideHit) { for (Transformation t : ROTATION_MARKER_TRANSFORMS_CORNER) { - drawExtendedRotationMarker(t, aIsSneaking, true); + drawExtendedRotationMarker(t, aIsSneaking, tAlignment); } } else { drawExtendedRotationMarker( ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS[ROTATION_MARKER_TRANSFORMS_SIDES[tSideHit * 6 + direction.ordinal()]], aIsSneaking, - true); + tAlignment); } } } GL11.glPopMatrix(); // get back to player center } - private static void drawExtendedRotationMarker(Transformation transform, boolean sneaking, boolean small) { - if (sneaking) drawFlipMarker(transform); - else drawRotationMarker(transform); + private static void drawExtendedRotationMarker(Transformation transform, boolean sneaking, IAlignment alignment) { + if (sneaking) { + if (alignment.isFlipChangeAllowed()) { + drawFlipMarker(transform); + } + } else { + if (alignment.isRotationChangeAllowed()) { + drawRotationMarker(transform); + } + } } private static void drawRotationMarker(Transformation transform) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index e368e43518..349614ea1e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -231,6 +231,11 @@ public class GT_MetaTileEntity_DistillationTower extends && !f.isVerticallyFliped(); } + @Override + public boolean isRotationChangeAllowed() { + return false; + } + @Override public IStructureDefinition getStructureDefinition() { return STRUCTURE_DEFINITION; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java index 41e0712627..efb4b8e6d2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java @@ -625,6 +625,11 @@ public abstract class GT_MetaTileEntity_DrillerBase && !f.isVerticallyFliped(); } + @Override + public boolean isRotationChangeAllowed() { + return false; + } + @Override public final IStructureDefinition getStructureDefinition() { return STRUCTURE_DEFINITION.get(getClass()); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java index a8961ce542..dc30cc79f0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java @@ -30,8 +30,11 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.NotNull; +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; +import com.gtnewhorizon.structurelib.alignment.enumerable.Flip; +import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; @@ -114,6 +117,27 @@ public abstract class GT_MetaTileEntity_LargeTurbine return STRUCTURE_DEFINITION.get(getClass()); } + @Override + protected IAlignmentLimits getInitialAlignmentLimits() { + return (d, r, f) -> r.isNotRotated() && f.isNotFlipped(); + } + + @Override + protected ExtendedFacing getCorrectedAlignment(ExtendedFacing aOldFacing) { + return aOldFacing.with(Flip.NONE) + .with(Rotation.NORMAL); + } + + @Override + public boolean isFlipChangeAllowed() { + return false; + } + + @Override + public boolean isRotationChangeAllowed() { + return false; + } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { return checkPiece(STRUCTURE_PIECE_MAIN, 2, 2, 1) && mMaintenanceHatches.size() == 1 -- cgit