@Override public ItemStack getItem(int slot) { if (slot == -999) { return null; } return CraftItemStack.asCraftMirror(container.getSlot(slot).getStack()); }
/** * Sends the contents of an inventory slot to the client-side Container. This doesn't have to * match the actual contents of that slot. Args: Container, slot number, slot contents */ public void sendSlotContents(Container p_71111_1_, int p_71111_2_, ItemStack p_71111_3_) { if (!(p_71111_1_.getSlot(p_71111_2_) instanceof SlotCrafting)) { if (!this.isChangingQuantityOnly) { this.playerNetServerHandler.sendPacket( new S2FPacketSetSlot(p_71111_1_.windowId, p_71111_2_, p_71111_3_)); } } }
@Override public void setItem(int slot, ItemStack item) { net.minecraft.item.ItemStack stack = CraftItemStack.asNMSCopy(item); if (slot != -999) { container.getSlot(slot).putStack(stack); } else { player.getHandle().dropPlayerItemWithRandomChoice(stack, false); } }
/** update the crafting window inventory with the items in the list */ public void updateCraftingInventory(Container container, List<ItemStack> items) { this.sendSlotContents(container, 0, container.getSlot(0).getStack()); }