Java Code Examples for cn.nukkit.network.protocol.types.ContainerIds#NONE
The following examples show how to use
cn.nukkit.network.protocol.types.ContainerIds#NONE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerCursorInventory.java From Jupiter with GNU General Public License v3.0 | 6 votes |
public void sendSlot(int index, Player... target) { InventorySlotPacket pk = new InventorySlotPacket(); pk.slot = index; pk.item = this.getItem(index); for (Player p : target) { if (p == this.getHolder()) { pk.inventoryId = ContainerIds.CURSOR; p.dataPacket(pk); } else { int id; if ((id = p.getWindowId(this)) == ContainerIds.NONE) { this.close(p); continue; } pk.inventoryId = id; p.dataPacket(pk); } } }
Example 2
Source File: CraftingTransaction.java From Nukkit with GNU General Public License v3.0 | 6 votes |
protected void sendInventories() { super.sendInventories(); /* * TODO: HACK! * we can't resend the contents of the crafting window, so we force the client to close it instead. * So people don't whine about messy desync issues when someone cancels CraftItemEvent, or when a crafting * transaction goes wrong. */ ContainerClosePacket pk = new ContainerClosePacket(); pk.windowId = ContainerIds.NONE; source.getServer().getScheduler().scheduleDelayedTask(new Task() { @Override public void onRun(int currentTick) { source.dataPacket(pk); } }, 20); this.source.resetCraftingGridType(); }
Example 3
Source File: PlayerUIInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override public void sendSlot(int index, Player... target) { InventorySlotPacket pk = new InventorySlotPacket(); pk.slot = index; pk.item = this.getItem(index); for (Player p : target) { if (p == this.getHolder()) { pk.inventoryId = ContainerIds.UI; p.dataPacket(pk); } else { int id; if ((id = p.getWindowId(this)) == ContainerIds.NONE) { this.close(p); continue; } pk.inventoryId = id; p.dataPacket(pk); } } }
Example 4
Source File: PlayerUIInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override public void sendContents(Player... target) { InventoryContentPacket pk = new InventoryContentPacket(); pk.slots = new Item[this.getSize()]; for (int i = 0; i < this.getSize(); ++i) { pk.slots[i] = this.getItem(i); } for (Player p : target) { if (p == this.getHolder()) { pk.inventoryId = ContainerIds.UI; p.dataPacket(pk); } else { int id; if ((id = p.getWindowId(this)) == ContainerIds.NONE) { this.close(p); continue; } pk.inventoryId = id; p.dataPacket(pk); } } }
Example 5
Source File: PlayerCursorInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void sendSlot(int index, Player... target) { InventorySlotPacket pk = new InventorySlotPacket(); pk.slot = index; pk.item = this.getItem(index); for (Player p : target) { if (p == this.getHolder()) { pk.inventoryId = ContainerIds.CURSOR; p.dataPacket(pk); } else { int id; if ((id = p.getWindowId(this)) == ContainerIds.NONE) { this.close(p); continue; } pk.inventoryId = id; p.dataPacket(pk); } } }
Example 6
Source File: CraftingTransaction.java From Nukkit with GNU General Public License v3.0 | 5 votes |
protected void sendInventories() { super.sendInventories(); /* * TODO: HACK! * we can't resend the contents of the crafting window, so we force the client to close it instead. * So people don't whine about messy desync issues when someone cancels CraftItemEvent, or when a crafting * transaction goes wrong. */ ContainerClosePacket pk = new ContainerClosePacket(); pk.windowId = ContainerIds.NONE; this.source.dataPacket(pk); this.source.resetCraftingGridType(); }
Example 7
Source File: CraftingTransaction.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public void sendInventories() { ContainerClosePacket pk = new ContainerClosePacket(); pk.windowId = ContainerIds.NONE; this.source.dataPacket(pk); }