mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-27 01:08:34 +01:00
Fixed phantom connections being left behind with the Item Interface
This commit is contained in:
parent
1510927831
commit
dba6a68488
1 changed files with 29 additions and 14 deletions
|
@ -77,29 +77,44 @@ 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.oldNetwork != network || this.lastNetworkChangeAmount != network.changeAmount)){
|
||||
this.genericInfos.clear();
|
||||
this.specificInfos.clear();
|
||||
if(network != null){
|
||||
if(this.oldNetwork != network || this.lastNetworkChangeAmount != network.changeAmount){
|
||||
this.clearInfos();
|
||||
|
||||
this.connectedRelay.getItemHandlersInNetwork(network, this.genericInfos);
|
||||
if(!this.genericInfos.isEmpty()){
|
||||
Collections.sort(this.genericInfos);
|
||||
this.connectedRelay.getItemHandlersInNetwork(network, this.genericInfos);
|
||||
if(!this.genericInfos.isEmpty()){
|
||||
Collections.sort(this.genericInfos);
|
||||
|
||||
int slotsQueried = 0;
|
||||
for(GenericItemHandlerInfo info : this.genericInfos){
|
||||
for(IItemHandler handler : info.handlers){
|
||||
for(int i = 0; i < handler.getSlots(); i++){
|
||||
this.specificInfos.put(slotsQueried, new SpecificItemHandlerInfo(handler, i, info.relayInQuestion));
|
||||
slotsQueried++;
|
||||
int slotsQueried = 0;
|
||||
for(GenericItemHandlerInfo info : this.genericInfos){
|
||||
for(IItemHandler handler : info.handlers){
|
||||
for(int i = 0; i < handler.getSlots(); i++){
|
||||
this.specificInfos.put(slotsQueried, new SpecificItemHandlerInfo(handler, i, info.relayInQuestion));
|
||||
slotsQueried++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.oldNetwork = network;
|
||||
this.lastNetworkChangeAmount = network.changeAmount;
|
||||
}
|
||||
|
||||
this.oldNetwork = network;
|
||||
this.lastNetworkChangeAmount = network.changeAmount;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.clearInfos();
|
||||
}
|
||||
|
||||
private void clearInfos(){
|
||||
if(!this.genericInfos.isEmpty()){
|
||||
this.genericInfos.clear();
|
||||
}
|
||||
|
||||
if(!this.specificInfos.isEmpty()){
|
||||
this.specificInfos.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private SpecificItemHandlerInfo getSwitchedIndexHandler(int i){
|
||||
|
|
Loading…
Reference in a new issue