Fixed phantom connections being left behind with the Item Interface

This commit is contained in:
Ellpeck 2016-11-25 15:38:01 +01:00
parent 1510927831
commit dba6a68488

View file

@ -77,9 +77,9 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{
private void queryAndSaveData(){ private void queryAndSaveData(){
if(this.connectedRelay != null){ if(this.connectedRelay != null){
Network network = ActuallyAdditionsAPI.connectionHandler.getNetworkFor(this.connectedRelay.getPos(), this.worldObj); Network network = ActuallyAdditionsAPI.connectionHandler.getNetworkFor(this.connectedRelay.getPos(), this.worldObj);
if(network != null && (this.oldNetwork != network || this.lastNetworkChangeAmount != network.changeAmount)){ if(network != null){
this.genericInfos.clear(); if(this.oldNetwork != network || this.lastNetworkChangeAmount != network.changeAmount){
this.specificInfos.clear(); this.clearInfos();
this.connectedRelay.getItemHandlersInNetwork(network, this.genericInfos); this.connectedRelay.getItemHandlersInNetwork(network, this.genericInfos);
if(!this.genericInfos.isEmpty()){ if(!this.genericInfos.isEmpty()){
@ -99,6 +99,21 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{
this.oldNetwork = network; this.oldNetwork = network;
this.lastNetworkChangeAmount = network.changeAmount; this.lastNetworkChangeAmount = network.changeAmount;
} }
return;
}
}
this.clearInfos();
}
private void clearInfos(){
if(!this.genericInfos.isEmpty()){
this.genericInfos.clear();
}
if(!this.specificInfos.isEmpty()){
this.specificInfos.clear();
} }
} }