Wrench shift click can move machine front direction

This commit is contained in:
Blood-Asp 2016-10-21 20:12:23 +02:00
parent 187a49f43c
commit 49ff6ffa31
3 changed files with 16 additions and 2 deletions

View file

@ -8,6 +8,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IEnergyConnected;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.net.GT_Packet_TileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.*;
@ -1186,7 +1187,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
return true;
}
if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) {
if (mMetaTileEntity.onWrenchRightClick(aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) {
if(aPlayer.isSneaking() && mMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine && ((GT_MetaTileEntity_BasicMachine)mMetaTileEntity).setMainFacing(GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ))){
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
}else if (mMetaTileEntity.onWrenchRightClick(aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) {
GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
}

View file

@ -87,6 +87,16 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
mGUIName = aGUIName;
mNEIName = aNEIName;
}
public boolean setMainFacing(byte aDirection){
mMainFacing = aDirection;
if(getBaseMetaTileEntity().getFrontFacing() == mMainFacing){
getBaseMetaTileEntity().setFrontFacing(GT_Utility.getOppositeSide(aDirection));
}
onFacingChange();
onMachineBlockUpdate();
return true;
}
@Override
public ITexture[][][] getTextureSet(ITexture[] aTextures) {

View file

@ -259,7 +259,7 @@ public class GT_Block_Machines
if(aPlayer.isSneaking()){
ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
if(tCurrentItem!=null){
if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)){
if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)){
return false;
}
}else {return false;}