improve inventory code
This commit is contained in:
parent
c374f35393
commit
cfcb590574
25 changed files with 144 additions and 184 deletions
|
@ -955,11 +955,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
--this.entity.hurtResistance;
|
||||
}
|
||||
|
||||
Container.removeEmptySlots(this.entity, 0, this.entity.getInventoryCapacity());
|
||||
if(this.entity.openContainer instanceof ContainerChest chest)
|
||||
Container.removeEmptySlots(chest.getChestInventory(), 0, chest.getChestInventory().getSizeInventory());
|
||||
else if(this.entity.openContainer instanceof ContainerEntityInventory ent && ent.getEntityInventory() != null)
|
||||
Container.removeEmptySlots(ent.getEntityInventory(), 2, ent.getEntityInventory().getSizeInventory() - 2);
|
||||
this.entity.openContainer.clearStacks();
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
// if(!this.worldObj.client)
|
||||
|
||||
|
@ -2953,7 +2949,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
return;
|
||||
slot.putStack(stack);
|
||||
}
|
||||
this.entity.openContainer.resortStacks(this.entity);
|
||||
this.entity.openContainer.resortStacks();
|
||||
this.entity.openContainer.detectAndSendChanges();
|
||||
this.entity.worldObj.playSoundAtEntity(this.entity, SoundEvent.POP, 0.2F);
|
||||
if(amount == 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue