use of org.dragonet.protocol.packets.InventoryContentPacket in project DragonProxy by DragonetMC.
the class UpstreamSession method sendCreativeInventory.
public void sendCreativeInventory() {
// main inventory
// ContainerId.CREATIVE.getId();
// InventoryContentPacket inventoryContentPacket = new InventoryContentPacket();
// inventoryContentPacket.windowId = ContainerId.INVENTORY.getId();
// Slot[] inventory = new Slot[36];
// for(int index = 0; index < inventory.length; index++) {
// inventory[index] = new Slot(0, 0, 0);
// }
// inventoryContentPacket.items = inventory;
// sendPacket(inventoryContentPacket);
//
// // ? inventory
// InventoryContentPacket inventoryContentPacket2 = new InventoryContentPacket();
// inventoryContentPacket2.windowId = ContainerId.ARMOR.getId();
// Slot[] inventory2 = new Slot[4];
// for(int index = 0; index < inventory2.length; index++) {
// inventory2[index] = new Slot(0, 0, 0);
// }
// inventoryContentPacket2.items = inventory2;
// sendPacket(inventoryContentPacket2);
// creative inventory
InventoryContentPacket inventoryContentPacket3 = new InventoryContentPacket();
inventoryContentPacket3.windowId = ContainerId.CREATIVE.getId();
inventoryContentPacket3.items = BlockEnum.getCreativeBlocks().stream().toArray(Slot[]::new);
sendPacket(inventoryContentPacket3);
}
use of org.dragonet.protocol.packets.InventoryContentPacket in project DragonProxy by DragonetMC.
the class InventoryTranslatorRegister method sendPlayerInventory.
public static PEPacket[] sendPlayerInventory(UpstreamSession session) {
CachedWindow win = session.getWindowCache().getPlayerInventory();
// Translate and send
InventoryContentPacket ret = new InventoryContentPacket();
ret.windowId = ContainerId.INVENTORY.getId();
ret.items = new Slot[40];
// hotbar
for (int i = 36; i < 45; i++) ret.items[i - 36] = ItemBlockTranslator.translateSlotToPE(win.slots[i]);
// inventory
for (int i = 9; i < 36; i++) // TODO: Add NBT support
ret.items[i] = ItemBlockTranslator.translateSlotToPE(win.slots[i]);
// armors
for (int i = 5; i < 9; i++) ret.items[i + 31] = ItemBlockTranslator.translateSlotToPE(win.slots[i]);
// TODO: Add armor support
return new PEPacket[] { ret };
}
Aggregations