aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2020-08-29 14:25:29 +0200
committerGitHub <noreply@github.com>2020-08-29 14:25:29 +0200
commitdac85f10d4c97cefc4099816c04fc95cdf1078d9 (patch)
tree286e00c982ce1db6ddcf9bac8d9bb20dbec8d950 /src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
parent8d3a5c833713d56fbcd580db60b87872b4b6994f (diff)
parent3a8cc3c906b1c5c6ea0ce8595d07712d22912f88 (diff)
downloadGT5-Unofficial-dac85f10d4c97cefc4099816c04fc95cdf1078d9.tar.gz
GT5-Unofficial-dac85f10d4c97cefc4099816c04fc95cdf1078d9.tar.bz2
GT5-Unofficial-dac85f10d4c97cefc4099816c04fc95cdf1078d9.zip
Merge pull request #310 from moller21/experimental
Fix strong power redstone
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity/BaseTileEntity.java')
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseTileEntity.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
index f5ba784162..dcaa98f120 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseTileEntity.java
@@ -427,6 +427,28 @@ public abstract class BaseTileEntity extends TileEntity implements IHasWorldObje
clearNullMarkersFromTileEntityBuffer();
}
+ public void updateNeighbours(int mStrongRedstone, int oStrongRedstone) {
+ Block thisBlock = getBlockOffset(0, 0, 0);
+ for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
+ int x1 = xCoord + dir.offsetX, y1 = yCoord + dir.offsetY, z1 = zCoord + dir.offsetZ;
+
+ if (worldObj.blockExists(x1, y1, z1)) {
+ worldObj.notifyBlockOfNeighborChange(x1, y1, z1, thisBlock);
+
+ //update if it was / is strong powered.
+ if (((((mStrongRedstone | oStrongRedstone) >>> dir.ordinal()) & 1) != 0 ) && getBlock(x1, y1, z1).isNormalCube()) {
+ int skipUpdateSide = dir.getOpposite().ordinal(); //Don't update this block. Still updates diagonal blocks twice if conditions meet.
+
+ for (ForgeDirection dir2 : ForgeDirection.VALID_DIRECTIONS) {
+ int x2 = x1 + dir2.offsetX, y2 = y1 + dir2.offsetY, z2 = z1 + dir2.offsetZ;
+ if (dir2.ordinal() != skipUpdateSide && worldObj.blockExists(x2, y2, z2))
+ worldObj.notifyBlockOfNeighborChange(x2, y2, z2, thisBlock);
+ }
+ }
+ }
+ }
+ }
+
@Override
public final void sendBlockEvent(byte aID, byte aValue) {
NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_Block_Event(xCoord, (short) yCoord, zCoord, aID, aValue), xCoord, zCoord);