From 0842bab48b1c24f113c61606a294f5bcdf2e1315 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Wed, 29 Feb 2012 13:56:35 -0500 Subject: [Bleeding] Implementation of inventory framework. Addresses BUKKIT-856 See the corresponding Bukkit commit for details. Implementation details: - Any packets that include an itemstack will send air stacks as null; maybe this will even eliminate the client crash that occurs if the client receives an air stack - Better handling of null itemstacks in general (ie less converting them to air stacks) - Inventory.setContents() can now take an array smaller than the inventory without error - Player.updateInventory() should now correctly update the result slot in a crafting inventory Some small credit goes to Afforess (initial implementation of openInventory() methods) and Drakia (initial implementation of InventoryOpenEvent and InventoryCloseEvent). --- .../net/minecraft/server/InventoryCraftResult.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/main/java/net/minecraft/server/InventoryCraftResult.java') diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java index 154b603a..537f22ae 100644 --- a/src/main/java/net/minecraft/server/InventoryCraftResult.java +++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java @@ -1,5 +1,14 @@ package net.minecraft.server; +// CraftBukkit start +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.craftbukkit.entity.CraftHumanEntity; +import org.bukkit.entity.HumanEntity; +import org.bukkit.inventory.InventoryHolder; +// CraftBukkit end + public class InventoryCraftResult implements IInventory { private ItemStack[] items = new ItemStack[1]; @@ -8,6 +17,16 @@ public class InventoryCraftResult implements IInventory { public ItemStack[] getContents() { return this.items; } + public InventoryHolder getOwner() { + return null; // Result slots don't get an owner + } + + // Don't need a transaction; the InventoryCrafting keeps track of it for us + public void onOpen(CraftHumanEntity who) {} + public void onClose(CraftHumanEntity who) {} + public List getViewers() { + return new ArrayList(); + } // CraftBukkit end public InventoryCraftResult() {} -- cgit v1.2.3