From 490956dcb59ec6edcc9bf0727777a9c6b930268e Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 7 Jul 2015 16:22:37 +0200 Subject: [PATCH] Made Phantomface update nearby Pipes on every occasion where something could change to connect or disconnect a Pipe --- .../items/ItemPhantomConnector.java | 1 - .../tile/TileEntityPhantomface.java | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java index 23c5943f2..b35e324fe 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemPhantomConnector.java @@ -37,7 +37,6 @@ public class ItemPhantomConnector extends Item implements INameableItem{ if(tile instanceof TileEntityPhantomface){ if(this.checkHasConnection(stack, player, tile)){ ((TileEntityPhantomface)tile).boundPosition = this.getStoredPosition(stack); - WorldUtil.updateTileAndTilesAround(tile); this.clearStorage(stack); player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc"))); return true; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java index b211957a9..5c4818a33 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java @@ -32,6 +32,10 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{ public final int defaultRange = ConfigIntValues.PHANTOMFACE_RANGE.getValue(); public int range; + private int rangeBefore; + private WorldPos boundPosBefore; + private Block boundBlockBefore; + public TileEntityPhantomface(String name){ super(0, name); } @@ -54,7 +58,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{ if(xDif >= -this.range && xDif <= this.range){ if(yDif >= -this.range && yDif <= this.range){ - if(zDif >= -this.range && zDif <= this.range) return true; + if(zDif >= -this.range && zDif <= this.range){ + return true; + } } } } @@ -69,6 +75,14 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{ if(!this.hasBoundTile()){ this.boundPosition = null; } + + if((this.boundPosition != null && (this.boundBlockBefore != this.boundPosition.getBlock() || !this.boundPosition.isEqual(boundPosBefore))) || this.range != this.rangeBefore){ + this.rangeBefore = this.range; + this.boundPosBefore = this.boundPosition; + this.boundBlockBefore = this.boundPosition == null ? null : this.boundPosition.getBlock(); + System.out.println("Hi!"); + WorldUtil.updateTileAndTilesAround(this); + } } }