Made Phantomface update nearby Pipes on every occasion where something could change to connect or disconnect a Pipe

This commit is contained in:
Ellpeck 2015-07-07 16:22:37 +02:00
parent 7e2b9a2420
commit 490956dcb5
2 changed files with 15 additions and 2 deletions

View file

@ -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;

View file

@ -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);
}
}
}