diff options
author | Technus <daniel112092@gmail.com> | 2017-12-25 23:46:59 +0100 |
---|---|---|
committer | Technus <daniel112092@gmail.com> | 2017-12-25 23:46:59 +0100 |
commit | c89acf537d0b729f41147f8575016d96f53c6ee2 (patch) | |
tree | 63516ff118fef7c894d3d805b6ede7394a174c6a /src/main | |
parent | 55df81600aca11e2d4334168049b7be48d2ed00a (diff) | |
download | GT5-Unofficial-c89acf537d0b729f41147f8575016d96f53c6ee2.tar.gz GT5-Unofficial-c89acf537d0b729f41147f8575016d96f53c6ee2.tar.bz2 GT5-Unofficial-c89acf537d0b729f41147f8575016d96f53c6ee2.zip |
Added missing overlays, made the passtrough of wire cutting/connectiong trough gt machine blocks work only if the player is isneaking. And because of that, added back the soldering iron support.
Diffstat (limited to 'src/main')
8 files changed, 131 insertions, 108 deletions
diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index 7175e1982a..1ebeda2895 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -52,186 +52,191 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * 14 = BaseMetaPipeEntity, Axe lvl 2 to dismantle * 15 = BaseMetaPipeEntity, Axe lvl 3 to dismantle */ - public byte getTileEntityBaseType(); + byte getTileEntityBaseType(); /** * @param aTileEntity is just because the internal Variable "mBaseMetaTileEntity" is set after this Call. * @return a newly created and ready MetaTileEntity */ - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity); + IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity); /** * @return an ItemStack representing this MetaTileEntity. */ - public ItemStack getStackForm(long aAmount); + ItemStack getStackForm(long aAmount); /** * new getter for the BaseMetaTileEntity, which restricts usage to certain Functions. */ - public IGregTechTileEntity getBaseMetaTileEntity(); + IGregTechTileEntity getBaseMetaTileEntity(); /** * Sets the BaseMetaTileEntity of this */ - public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity); + void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity); /** * when placing a Machine in World, to initialize default Modes. aNBT can be null! */ - public void initDefaultModes(NBTTagCompound aNBT); + void initDefaultModes(NBTTagCompound aNBT); /** * ^= writeToNBT */ - public void saveNBTData(NBTTagCompound aNBT); + void saveNBTData(NBTTagCompound aNBT); /** * ^= readFromNBT */ - public void loadNBTData(NBTTagCompound aNBT); + void loadNBTData(NBTTagCompound aNBT); /** * Adds the NBT-Information to the ItemStack, when being dismanteled properly * Used to store Machine specific Upgrade Data. */ - public void setItemNBT(NBTTagCompound aNBT); + void setItemNBT(NBTTagCompound aNBT); /** * Called in the registered MetaTileEntity when the Server starts, to reset static variables */ - public void onServerStart(); + void onServerStart(); /** * Called in the registered MetaTileEntity when the Server ticks a World the first time, to load things from the World Save */ - public void onWorldLoad(File aSaveDirectory); + void onWorldLoad(File aSaveDirectory); /** * Called in the registered MetaTileEntity when the Server stops, to save the Game. */ - public void onWorldSave(File aSaveDirectory); + void onWorldSave(File aSaveDirectory); /** * Called to set Configuration values for this MetaTileEntity. * Use aConfig.get(ConfigCategories.machineconfig, "MetaTileEntityName.Ability", DEFAULT_VALUE); to set the Values. */ - public void onConfigLoad(GT_Config aConfig); + void onConfigLoad(GT_Config aConfig); /** * If a Cover of that Type can be placed on this Side. * Also Called when the Facing of the Block Changes and a Cover is on said Side. */ - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack); + boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack); /** * When a Player rightclicks the Facing with a Screwdriver. */ - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ); + void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ); /** * When a Player rightclicks the Facing with a Wrench. */ - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ); + boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ); /** * When a Player rightclicks the Facing with a wire cutter. */ - public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ); + boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ); + + /** + * When a Player rightclicks the Facing with a soldering iron. + */ + boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ); /** * Called right before this Machine explodes */ - public void onExplosion(); + void onExplosion(); /** * The First processed Tick which was passed to this MetaTileEntity */ - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity); + void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity); /** * The Tick before all the generic handling happens, what gives a slightly faster reaction speed. * Don't use this if you really don't need to. @onPostTick is better suited for ticks. * This happens still after the Cover handling. */ - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick); + void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick); /** * The Tick after all the generic handling happened. * Recommended to use this like updateEntity. */ - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick); + void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick); /** * Called when this MetaTileEntity gets (intentionally) disconnected from the BaseMetaTileEntity. * Doesn't get called when this thing is moved by Frames or similar hacks. */ - public void inValidate(); + void inValidate(); /** * Called when the BaseMetaTileEntity gets invalidated, what happens right before the @inValidate above gets called */ - public void onRemoval(); + void onRemoval(); /** * @param aFacing * @return if aFacing would be a valid Facing for this Device. Used for wrenching. */ - public boolean isFacingValid(byte aFacing); + boolean isFacingValid(byte aFacing); /** * @return the Server Side Container */ - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity); + Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity); /** * @return the Client Side GUI Container */ - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity); + Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity); /** * From new ISidedInventory */ - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack); + boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack); /** * From new ISidedInventory */ - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack); + boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack); /** * @return if aIndex is a valid Slot. false for things like HoloSlots. Is used for determining if an Item is dropped upon Block destruction and for Inventory Access Management */ - public boolean isValidSlot(int aIndex); + boolean isValidSlot(int aIndex); /** * @return if aIndex can be set to Zero stackSize, when being removed. */ - public boolean setStackToZeroInsteadOfNull(int aIndex); + boolean setStackToZeroInsteadOfNull(int aIndex); /** * If this Side can connect to inputting pipes */ - public boolean isLiquidInput(byte aSide); + boolean isLiquidInput(byte aSide); /** * If this Side can connect to outputting pipes */ - public boolean isLiquidOutput(byte aSide); + boolean isLiquidOutput(byte aSide); /** * Just an Accessor for the Name variable. */ - public String getMetaName(); + String getMetaName(); /** * @return true if the Machine can be accessed */ - public boolean isAccessAllowed(EntityPlayer aPlayer); + boolean isAccessAllowed(EntityPlayer aPlayer); /** * When a Machine Update occurs */ - public void onMachineBlockUpdate(); + void onMachineBlockUpdate(); /** * a Player rightclicks the Machine @@ -239,18 +244,18 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * * @return */ - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ); + boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ); /** * a Player leftclicks the Machine * Sneaky leftclicks are getting passed to this unlike with the rightclicks. */ - public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer); + void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer); /** * Called Clientside with the Data got from @getUpdateData */ - public void onValueUpdate(byte aValue); + void onValueUpdate(byte aValue); /** * return a small bit of Data, like a secondary Facing for example with this Function, for the Client. @@ -259,50 +264,50 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * <p/> * If you just want to have an Active/Redstone State then set the Active State inside the BaseMetaTileEntity instead. */ - public byte getUpdateData(); + byte getUpdateData(); /** * For the rare case you need this Function */ - public void receiveClientEvent(byte aEventID, byte aValue); + void receiveClientEvent(byte aEventID, byte aValue); /** * Called to actually play the Sound. * Do not insert Client/Server checks. That is already done for you. * Do not use @playSoundEffect, Minecraft doesn't like that at all. Use @playSound instead. */ - public void doSound(byte aIndex, double aX, double aY, double aZ); + void doSound(byte aIndex, double aX, double aY, double aZ); - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ); + void startSoundLoop(byte aIndex, double aX, double aY, double aZ); - public void stopSoundLoop(byte aValue, double aX, double aY, double aZ); + void stopSoundLoop(byte aValue, double aX, double aY, double aZ); /** * Sends the Event for the Sound Triggers, only usable Server Side! */ - public void sendSound(byte aIndex); + void sendSound(byte aIndex); /** * Sends the Event for the Sound Triggers, only usable Server Side! */ - public void sendLoopStart(byte aIndex); + void sendLoopStart(byte aIndex); /** * Sends the Event for the Sound Triggers, only usable Server Side! */ - public void sendLoopEnd(byte aIndex); + void sendLoopEnd(byte aIndex); /** * Called when the Machine explodes, override Explosion Code here. * * @param aExplosionPower */ - public void doExplosion(long aExplosionPower); + void doExplosion(long aExplosionPower); /** * If this is just a simple Machine, which can be wrenched at 100% */ - public boolean isSimpleMachine(); + boolean isSimpleMachine(); /** * If there should be a Lag Warning if something laggy happens during this Tick. @@ -310,22 +315,22 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * The Advanced Pump uses this to not cause the Lag Message, while it scans for all close Fluids. * The Item Pipes and Retrievers neither send this Message, when scanning for Pipes. */ - public boolean doTickProfilingMessageDuringThisTick(); + boolean doTickProfilingMessageDuringThisTick(); /** * returns the DebugLog */ - public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList); + ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList); /** * get a small Description */ - public String[] getDescription(); + String[] getDescription(); /** * In case the Output Voltage varies. */ - public String getSpecialVoltageToolTip(); + String getSpecialVoltageToolTip(); /** * Icon of the Texture. If this returns null then it falls back to getTextureIndex. @@ -336,7 +341,7 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * @param aActive if the Machine is currently active (use this instead of calling mBaseMetaTileEntity.mActive!!!). Note: In case of Pipes this means if this Side is connected to something or not. * @param aRedstone if the Machine is currently outputting a RedstoneSignal (use this instead of calling mBaseMetaTileEntity.mRedstone!!!) */ - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone); + ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone); /** * The Textures used for the Item rendering. Return null if you want the regular 3D Block Rendering. @@ -350,55 +355,55 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand * @param aBlockIconRegister The Block Icon Register */ @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister); + void registerIcons(IIconRegister aBlockIconRegister); /** * @return true if you override the Rendering. */ @SideOnly(Side.CLIENT) - public boolean renderInInventory(Block aBlock, int aMeta, RenderBlocks aRenderer); + boolean renderInInventory(Block aBlock, int aMeta, RenderBlocks aRenderer); /** * @return true if you override the Rendering. */ @SideOnly(Side.CLIENT) - public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer); + boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer); /** * Gets the Output for the comparator on the given Side */ - public byte getComparatorValue(byte aSide); + byte getComparatorValue(byte aSide); - public float getExplosionResistance(byte aSide); + float getExplosionResistance(byte aSide); - public String[] getInfoData(); + String[] getInfoData(); - public boolean isGivingInformation(); + boolean isGivingInformation(); - public ItemStack[] getRealInventory(); + ItemStack[] getRealInventory(); - public boolean connectsToItemPipe(byte aSide); + boolean connectsToItemPipe(byte aSide); - public void onColorChangeServer(byte aColor); + void onColorChangeServer(byte aColor); - public void onColorChangeClient(byte aColor); + void onColorChangeClient(byte aColor); - public int getLightOpacity(); + int getLightOpacity(); - public boolean allowGeneralRedstoneOutput(); + boolean allowGeneralRedstoneOutput(); - public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider); + void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider); - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); + AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ); - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider); + void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider); /** * The onCreated Function of the Item Class redirects here */ - public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer); + void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer); - public boolean hasAlternativeModeText(); + boolean hasAlternativeModeText(); - public String getAlternativeModeText(); + String getAlternativeModeText(); }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index f1f7b8d76b..fd4426da62 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -816,7 +816,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) {
if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
- GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
+ //logic handled internally
GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
}
return true;
@@ -824,8 +824,8 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) {
if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) {
- GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 500, aPlayer);
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
+ //logic handled internally
+ GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 1.0F, -1, xCoord, yCoord, zCoord);
} else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) {
mStrongRedstone ^= (1 << tSide);
GT_Utility.sendChatToPlayer(aPlayer, trans("091","Redstone Output at Side ") + tSide + trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? trans("093","Strong") : trans("094","Weak")));
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 1d6b7f7677..d44ada526f 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -1317,7 +1317,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) { byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); - if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { + if (mMetaTileEntity.onSolderingToolRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { + //logic handled internally + GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 1.0F, -1, xCoord, yCoord, zCoord); + } else if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) { mStrongRedstone ^= (1 << tSide); GT_Utility.sendChatToPlayer(aPlayer, trans("091","Redstone Output at Side ") + tSide + trans("092"," set to: ") + ((mStrongRedstone & (1 << tSide)) != 0 ? trans("093","Strong") : trans("094","Weak"))); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord); @@ -1328,7 +1331,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList)) { byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); if (mMetaTileEntity.onWireCutterRightClick(aSide, tSide, aPlayer, aX, aY, aZ)) { - GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer); + //logic handled internally GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord); } return true; diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index c60673f6fd..e5724bb653 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -209,6 +209,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { return false;
}
+ @Override
public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
return false;
}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index c231350ada..7486a61445 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -165,16 +165,26 @@ public abstract class MetaTileEntity implements IMetaTileEntity { @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - byte tSide = GT_Utility.getOppositeSide(aWrenchingSide); - TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide); - - if(tTileEntity != null && (tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) - { - // The tile entity we're facing is a cable, let's try to connect to it - return ((GT_MetaPipeEntity_Cable)((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).onWireCutterRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); - } - - return true; + if(!aPlayer.isSneaking()) return false; + byte tSide = GT_Utility.getOppositeSide(aWrenchingSide); + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide); + if (tTileEntity != null && (tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { + // The tile entity we're facing is a cable, let's try to connect to it + return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity().onWireCutterRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); + } + return false; + } + + @Override + public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if(!aPlayer.isSneaking()) return false; + byte tSide = GT_Utility.getOppositeSide(aWrenchingSide); + TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityAtSide(aWrenchingSide); + if (tTileEntity != null && (tTileEntity instanceof IGregTechTileEntity) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof GT_MetaPipeEntity_Cable)) { + // The tile entity we're facing is a cable, let's try to connect to it + return ((IGregTechTileEntity) tTileEntity).getMetaTileEntity().onSolderingToolRightClick(aWrenchingSide, tSide, aPlayer, aX, aY, aZ); + } + return false; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index b0a40e2133..08bd62e091 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -308,26 +308,30 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override
public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- return onConnectionToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
+ if (GT_Mod.gregtechproxy.gt6Cable && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) {
+ if(isConnectedAtSide(aWrenchingSide)) {
+ disconnect(aWrenchingSide);
+ GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected"));
+ }else if(!GT_Mod.gregtechproxy.costlyCableConnection){
+ if (connect(aWrenchingSide) > 0)
+ GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected"));
+ }
+ return true;
+ }
+ return false;
}
public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- return onConnectionToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
- }
-
- private boolean onConnectionToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (GT_Mod.gregtechproxy.gt6Cable) {
- if (!isConnectedAtSide(aWrenchingSide)) {
- if (GT_Mod.gregtechproxy.costlyCableConnection && !GT_ModHandler.consumeSolderingMaterial(aPlayer)) return false;
- if (connect(aWrenchingSide) > 0)
- GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected"));
- }
- else {
- disconnect(aWrenchingSide);
- GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected"));
- }
- return true;
- }
+ if (GT_Mod.gregtechproxy.gt6Cable && GT_ModHandler.damageOrDechargeItem(aPlayer.inventory.getCurrentItem(), 1, 500, aPlayer)) {
+ if (isConnectedAtSide(aWrenchingSide)) {
+ disconnect(aWrenchingSide);
+ GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected"));
+ } else if (!GT_Mod.gregtechproxy.costlyCableConnection || GT_ModHandler.consumeSolderingMaterial(aPlayer)) {
+ if (connect(aWrenchingSide) > 0)
+ GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected"));
+ }
+ return true;
+ }
return false;
}
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 2bb93cc66a..272a6bfa6e 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -444,15 +444,15 @@ public class GT_Client extends GT_Proxy TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
try {
Class.forName("codechicken.lib.vec.Rotation");
- if (((aTileEntity instanceof BaseMetaPipeEntity)) && (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) && ((GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet())) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWireCutterList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList)))) {
+ if (((aTileEntity instanceof BaseMetaPipeEntity)) && (((ICoverable) aTileEntity).getCoverIDAtSide((byte) aEvent.target.sideHit) == 0) && ((GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCovers.keySet())) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sCrowbarList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWireCutterList)) || (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sScrewdriverList))|| GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList))) {
drawGrid(aEvent);
return;
}
- if ((((aTileEntity instanceof ITurnable)) || (ROTATABLE_VANILLA_BLOCKS.contains(aBlock)) || ((aTileEntity instanceof IWrenchable))) && (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWrenchList))) {
+ if ((aTileEntity instanceof ITurnable || ROTATABLE_VANILLA_BLOCKS.contains(aBlock) || aTileEntity instanceof IWrenchable) && GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWrenchList)) {
drawGrid(aEvent);
return;
}
- if (aTileEntity instanceof BaseTileEntity && (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWireCutterList))) {
+ if (aTileEntity instanceof BaseTileEntity && (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWireCutterList) || GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sSolderingToolList))) {
drawGrid(aEvent);
return;
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java index 1c24ce4dac..8688fce78f 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java @@ -291,7 +291,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) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)){
+ if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)){
return false;
}
}else {return false;}
|