aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2022-08-17 06:47:36 +0200
committerGitHub <noreply@github.com>2022-08-17 06:47:36 +0200
commit0f36724b6960562d72bf019d582a313ed532e27d (patch)
treea643e411bb0a4ce7ed8b1a9e9c2660542a9d95c1
parentc07a7d403449ee2068cd176359a0b4f1d50a6a81 (diff)
parent6a30ab9aaa4cbf35b5fe93e80760f7908f810676 (diff)
downloadGT5-Unofficial-0f36724b6960562d72bf019d582a313ed532e27d.tar.gz
GT5-Unofficial-0f36724b6960562d72bf019d582a313ed532e27d.tar.bz2
GT5-Unofficial-0f36724b6960562d72bf019d582a313ed532e27d.zip
Merge pull request #78 from minecraft7771/MultiRotationImprovement
Multiblock rotation improvement
-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));
}