improve hopping item interface performance

This commit is contained in:
Ellpeck 2016-12-18 14:27:10 +01:00
parent eda6fcb587
commit 49bcda43fa

View file

@ -50,19 +50,7 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer{
} }
} }
} }
else{
if(this.handlerToPushTo != null){
outer : for(int i = 0; i < this.itemHandler.getSlots(); i++){
if(StackUtil.isValid(this.itemHandler.getStackInSlot(i))){
for(int j = 0; j < this.handlerToPushTo.getSlots(); j++){
if(WorldUtil.doItemInteraction(i, j, this.itemHandler, this.handlerToPushTo, 4)){
break outer;
}
}
}
}
}
if(this.world.getTotalWorldTime()%20 == 0){ if(this.world.getTotalWorldTime()%20 == 0){
List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.pos.getX(), this.pos.getY()+0.5, this.pos.getZ(), this.pos.getX()+1, this.pos.getY()+2, this.pos.getZ()+1)); List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.pos.getX(), this.pos.getY()+0.5, this.pos.getZ(), this.pos.getX()+1, this.pos.getY()+2, this.pos.getZ()+1));
if(items != null && !items.isEmpty()){ if(items != null && !items.isEmpty()){
@ -82,6 +70,19 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer{
} }
} }
} }
if(this.handlerToPushTo != null){
outer : for(int i = 0; i < this.itemHandler.getSlots(); i++){
if(StackUtil.isValid(this.itemHandler.getStackInSlot(i))){
for(int j = 0; j < this.handlerToPushTo.getSlots(); j++){
if(WorldUtil.doItemInteraction(i, j, this.itemHandler, this.handlerToPushTo, 4)){
break outer;
}
}
}
}
}
}
} }
@Override @Override