mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
improve hopping item interface performance
This commit is contained in:
parent
eda6fcb587
commit
49bcda43fa
1 changed files with 20 additions and 19 deletions
|
@ -50,6 +50,26 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer{
|
|||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
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));
|
||||
if(items != null && !items.isEmpty()){
|
||||
for(EntityItem item : items){
|
||||
if(item != null && !item.isDead){
|
||||
for(int i = 0; i < this.itemHandler.getSlots(); i++){
|
||||
ItemStack left = this.itemHandler.insertItem(i, item.getEntityItem(), false);
|
||||
item.setEntityItemStack(left);
|
||||
|
||||
if(!StackUtil.isValid(left)){
|
||||
item.setDead();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.handlerToPushTo != null){
|
||||
outer : for(int i = 0; i < this.itemHandler.getSlots(); i++){
|
||||
|
@ -62,25 +82,6 @@ public class TileEntityItemViewerHopping extends TileEntityItemViewer{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
if(items != null && !items.isEmpty()){
|
||||
for(EntityItem item : items){
|
||||
if(item != null && !item.isDead){
|
||||
for(int i = 0; i < this.itemHandler.getSlots(); i++){
|
||||
ItemStack left = this.itemHandler.insertItem(i, item.getEntityItem(), false);
|
||||
item.setEntityItemStack(left);
|
||||
|
||||
if(!StackUtil.isValid(left)){
|
||||
item.setDead();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue