PaperMC/nms-patches/ContainerHorse.patch

34 lines
1.1 KiB
Diff

--- a/net/minecraft/server/ContainerHorse.java
+++ b/net/minecraft/server/ContainerHorse.java
@@ -1,11 +1,31 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.inventory.InventoryView;
+// CraftBukkit end
+
public class ContainerHorse extends Container {
private final IInventory a;
private final EntityHorseAbstract f;
+ // 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(), a.getOwner().getInventory(), this);
+ }
+
public ContainerHorse(IInventory iinventory, final IInventory iinventory1, final EntityHorseAbstract entityhorseabstract, EntityHuman entityhuman) {
+ player = (PlayerInventory) iinventory;
+ // CraftBukkit end
this.a = iinventory1;
this.f = entityhorseabstract;
boolean flag = true;