use of org.dragonet.inventory.PEInventorySlot in project Dragonet-Legacy by DragonetMC.
the class DragonetSession method sendInventory.
public void sendInventory() {
if (this.getPlayer() == null) {
return;
}
if (this.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
return;
}
WindowItemsPacket pkItems = new WindowItemsPacket();
pkItems.windowID = PEWindowConstantID.PLAYER_INVENTORY;
pkItems.slots = new PEInventorySlot[InventoryType.SlotSize.PLAYER];
pkItems.hotbar = new int[9];
for (int i = 9; i <= 35; i++) {
if (this.getPlayer().getInventory().getContents()[i] != null) {
pkItems.slots[i - 9] = new PEInventorySlot((short) (this.getPlayer().getInventory().getContents()[i].getTypeId() & 0xFFFF), (byte) (this.getPlayer().getInventory().getContents()[i].getAmount() & 0xFF), this.getPlayer().getInventory().getContents()[i].getDurability());
} else {
pkItems.slots[i - 9] = new PEInventorySlot();
}
}
for (int i = 0; i <= 8; i++) {
if (this.getPlayer().getInventory().getContents()[i] != null) {
pkItems.slots[i + 27] = new PEInventorySlot((short) (this.getPlayer().getInventory().getContents()[i].getTypeId() & 0xFFFF), (byte) (this.getPlayer().getInventory().getContents()[i].getAmount() & 0xFF), this.getPlayer().getInventory().getContents()[i].getDurability());
} else {
pkItems.slots[i + 27] = new PEInventorySlot();
}
}
for (int i = 0; i <= 8; i++) {
pkItems.hotbar[i] = 44 - 8 + i;
}
this.send(pkItems);
}
Aggregations