Fix the item viewer, in very special cases, not updating its inventories

This commit is contained in:
Ellpeck 2016-11-03 10:54:28 +01:00
parent d5ee51ff46
commit de46e22840

View file

@ -27,6 +27,8 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{
private final List<GenericItemHandlerInfo> genericInfos = new ArrayList<GenericItemHandlerInfo>();
private final Map<Integer, SpecificItemHandlerInfo> specificInfos = new HashMap<Integer, SpecificItemHandlerInfo>();
public TileEntityLaserRelayItem connectedRelay;
private Network oldNetwork;
private int lastNetworkChangeAmount = -1;
public TileEntityItemViewer(){
@ -79,7 +81,7 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{
private void queryAndSaveData(){
if(this.connectedRelay != null){
Network network = ActuallyAdditionsAPI.connectionHandler.getNetworkFor(this.connectedRelay.getPos(), this.worldObj);
if(network != null && this.lastNetworkChangeAmount != network.changeAmount){
if(network != null && (this.oldNetwork != network || this.lastNetworkChangeAmount != network.changeAmount)){
this.genericInfos.clear();
this.specificInfos.clear();
@ -98,6 +100,7 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{
}
}
this.oldNetwork = network;
this.lastNetworkChangeAmount = network.changeAmount;
}
}