--- a/net/minecraft/world/inventory/ContainerHorse.java +++ b/net/minecraft/world/inventory/ContainerHorse.java @@ -11,6 +11,11 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +// CraftBukkit start +import org.bukkit.craftbukkit.inventory.CraftInventoryView; +import org.bukkit.inventory.InventoryView; +// CraftBukkit end + public class ContainerHorse extends Container { static final MinecraftKey SADDLE_SLOT_SPRITE = MinecraftKey.withDefaultNamespace("container/slot/saddle"); @@ -22,13 +27,28 @@ private static final int SLOT_BODY_ARMOR = 1; private static final int SLOT_HORSE_INVENTORY_START = 2; + // CraftBukkit start + org.bukkit.craftbukkit.inventory.CraftInventoryView bukkitEntity; + PlayerInventory player; + + @Override + public InventoryView getBukkitView() { + if (bukkitEntity != null) { + return bukkitEntity; + } + + return bukkitEntity = new CraftInventoryView(player.player.getBukkitEntity(), horseContainer.getOwner().getInventory(), this); + } + public ContainerHorse(int i, PlayerInventory playerinventory, IInventory iinventory, final EntityHorseAbstract entityhorseabstract, int j) { super((Containers) null, i); + player = playerinventory; + // CraftBukkit end this.horseContainer = iinventory; this.armorContainer = entityhorseabstract.getBodyArmorAccess(); this.horse = entityhorseabstract; iinventory.startOpen(playerinventory.player); - this.addSlot(new Slot(this, iinventory, 0, 8, 18) { + this.addSlot(new Slot(iinventory, 0, 8, 18) { // CraftBukkit - decompile error @Override public boolean mayPlace(ItemStack itemstack) { return itemstack.is(Items.SADDLE) && !this.hasItem() && entityhorseabstract.isSaddleable(); @@ -46,7 +66,7 @@ }); MinecraftKey minecraftkey = entityhorseabstract instanceof EntityLlama ? ContainerHorse.LLAMA_ARMOR_SLOT_SPRITE : ContainerHorse.ARMOR_SLOT_SPRITE; - this.addSlot(new ArmorSlot(this, this.armorContainer, entityhorseabstract, EnumItemSlot.BODY, 0, 8, 36, minecraftkey) { + this.addSlot(new ArmorSlot(this.armorContainer, entityhorseabstract, EnumItemSlot.BODY, 0, 8, 36, minecraftkey) { // CraftBukkit - decompile error @Override public boolean mayPlace(ItemStack itemstack) { return entityhorseabstract.isEquippableInSlot(itemstack, EnumItemSlot.BODY);