1
0
Fork 0

improve inventory code

This commit is contained in:
Sen 2025-09-07 11:51:01 +02:00
parent c374f35393
commit cfcb590574
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
25 changed files with 144 additions and 184 deletions

View file

@ -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)