aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/blocks
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2018-09-06 08:40:35 +0200
committerGitHub <noreply@github.com>2018-09-06 08:40:35 +0200
commit8043ad2663d07bd97d7eaf7c9dcaaac72c413e72 (patch)
tree11351ed8e8ff50d06a985956ecb5f90a75842de9 /src/main/java/gregtech/common/blocks
parent9d530773035ad21cffb1f558fa8309a57021c3b2 (diff)
parent9cd17d07c543a14a80672fa709c419f7c580a344 (diff)
downloadGT5-Unofficial-8043ad2663d07bd97d7eaf7c9dcaaac72c413e72.tar.gz
GT5-Unofficial-8043ad2663d07bd97d7eaf7c9dcaaac72c413e72.tar.bz2
GT5-Unofficial-8043ad2663d07bd97d7eaf7c9dcaaac72c413e72.zip
Merge pull request #144 from GTNewHorizons/pipe_overhaul_and_fluidfilter_fix
Pipe/Cable overhaul & Add filter output on fluid filters
Diffstat (limited to 'src/main/java/gregtech/common/blocks')
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Machines.java7
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java10
2 files changed, 16 insertions, 1 deletions
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 8688fce78f..157a38962a 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
@@ -87,6 +87,13 @@ public class GT_Block_Machines
}
}
+ public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block aBlock) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof BaseMetaPipeEntity)) {
+ ((BaseMetaPipeEntity) tTileEntity).onNeighborBlockChange(aX, aY, aZ);
+ }
+ }
+
public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
super.onBlockAdded(aWorld, aX, aY, aZ);
if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
index a742994ddc..1fa33e2a1d 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -158,8 +158,16 @@ public class GT_Item_Machines
tTileEntity.setOwnerName(aPlayer.getDisplayName());
}
tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound());
+ final byte aSide = GT_Utility.getOppositeSide(side);
if (tTileEntity.getMetaTileEntity() instanceof IConnectable) {
- ((IConnectable) tTileEntity.getMetaTileEntity()).connect(GT_Utility.getOppositeSide(side));
+ // If we're connectable, try connecting to whatever we're up against
+ ((IConnectable) tTileEntity.getMetaTileEntity()).connect(aSide);
+ } else if (aPlayer != null && aPlayer.isSneaking()) {
+ // If we're being placed against something that is connectable, try telling it to connect to us
+ IGregTechTileEntity aTileEntity = tTileEntity.getIGregTechTileEntityAtSide(aSide);
+ if (aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof IConnectable) {
+ ((IConnectable) aTileEntity.getMetaTileEntity()).connect((byte)side);
+ }
}
}
} else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) {