mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
*Actually* fixed Item Laser Relays leaving phantom connections behind
This commit is contained in:
parent
f7f68e4f16
commit
6955188d7b
1 changed files with 29 additions and 15 deletions
|
@ -75,32 +75,46 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queryAndSaveData(){
|
private void queryAndSaveData(){
|
||||||
this.genericInfos.clear();
|
|
||||||
this.specificInfos.clear();
|
|
||||||
|
|
||||||
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){
|
||||||
|
if(this.oldNetwork != network || this.lastNetworkChangeAmount != network.changeAmount){
|
||||||
|
this.clearInfos();
|
||||||
|
|
||||||
this.connectedRelay.getItemHandlersInNetwork(network, this.genericInfos);
|
this.connectedRelay.getItemHandlersInNetwork(network, this.genericInfos);
|
||||||
if(!this.genericInfos.isEmpty()){
|
if(!this.genericInfos.isEmpty()){
|
||||||
Collections.sort(this.genericInfos);
|
Collections.sort(this.genericInfos);
|
||||||
|
|
||||||
int slotsQueried = 0;
|
int slotsQueried = 0;
|
||||||
for(GenericItemHandlerInfo info : this.genericInfos){
|
for(GenericItemHandlerInfo info : this.genericInfos){
|
||||||
for(IItemHandler handler : info.handlers){
|
for(IItemHandler handler : info.handlers){
|
||||||
for(int i = 0; i < handler.getSlots(); i++){
|
for(int i = 0; i < handler.getSlots(); i++){
|
||||||
this.specificInfos.put(slotsQueried, new SpecificItemHandlerInfo(handler, i, info.relayInQuestion));
|
this.specificInfos.put(slotsQueried, new SpecificItemHandlerInfo(handler, i, info.relayInQuestion));
|
||||||
slotsQueried++;
|
slotsQueried++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.oldNetwork = network;
|
||||||
|
this.lastNetworkChangeAmount = network.changeAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.oldNetwork = network;
|
return;
|
||||||
this.lastNetworkChangeAmount = network.changeAmount;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.clearInfos();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearInfos(){
|
||||||
|
if(!this.genericInfos.isEmpty()){
|
||||||
|
this.genericInfos.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.specificInfos.isEmpty()){
|
||||||
|
this.specificInfos.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpecificItemHandlerInfo getSwitchedIndexHandler(int i){
|
private SpecificItemHandlerInfo getSwitchedIndexHandler(int i){
|
||||||
|
|
Loading…
Reference in a new issue