aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorminecraft7771 <maxim235@gmx.de>2022-08-11 19:53:19 +0200
committerminecraft7771 <maxim235@gmx.de>2022-08-11 19:53:19 +0200
commit6a30ab9aaa4cbf35b5fe93e80760f7908f810676 (patch)
tree1f2c82237aa3469b22b916974b3bd5df17c30b73
parent7c28c6b0e4b496d81444a0dd8c9a39c3486ed9b7 (diff)
downloadGT5-Unofficial-6a30ab9aaa4cbf35b5fe93e80760f7908f810676.tar.gz
GT5-Unofficial-6a30ab9aaa4cbf35b5fe93e80760f7908f810676.tar.bz2
GT5-Unofficial-6a30ab9aaa4cbf35b5fe93e80760f7908f810676.zip
Backported rotation logic from enhanced mulitblock base to allow all TT based machines to be rotated more freely
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
index b74ac5023a..e8228d0f03 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
@@ -34,6 +34,7 @@ import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Pollution;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -175,16 +176,16 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
@Override
public void setExtendedFacing(ExtendedFacing newExtendedFacing) {
if (extendedFacing != newExtendedFacing) {
+ if(mMachine)
+ stopMachine();
extendedFacing = newExtendedFacing;
- IGregTechTileEntity base = getBaseMetaTileEntity();
+ final IGregTechTileEntity base = getBaseMetaTileEntity();
mMachine = false;
+ mUpdated = false;
+ mUpdate = 100;
if (getBaseMetaTileEntity().isServerSide()) {
- //NetworkDispatcher.INSTANCE.sendToAllAround(new AlignmentMessage.AlignmentData(this),
- // base.getWorld().provider.dimensionId,
- // base.getXCoord(), base.getYCoord(), base.getZCoord(), 512);
StructureLibAPI.sendAlignment((IAlignmentProvider) base,
- new NetworkRegistry.TargetPoint(base.getWorld().provider.dimensionId,
- base.getXCoord(), base.getYCoord(), base.getZCoord(), 512));
+ new NetworkRegistry.TargetPoint(base.getWorld().provider.dimensionId, base.getXCoord(), base.getYCoord(), base.getZCoord(), 512));
} else {
base.issueTextureUpdate();
}
@@ -192,6 +193,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
@Override
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (aWrenchingSide != getBaseMetaTileEntity().getFrontFacing())
+ return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
+ if (aPlayer.isSneaking()) {
+ // we won't be allowing horizontal flips, as it can be perfectly emulated by rotating twice and flipping horizontally
+ // allowing an extra round of flip make it hard to draw meaningful flip markers in GT_Proxy#drawGrid
+ toolSetFlip(getFlip().isHorizontallyFlipped() ? Flip.NONE : Flip.HORIZONTAL);
+ } else {
+ toolSetRotation(null);
+ }
+ return true;
+ }
+
+ @Override
public boolean isFacingValid(byte aFacing) {
return canSetToDirectionAny(ForgeDirection.getOrientation(aFacing));
}