PaperMC/nms-patches/ContainerHorse.patch
2019-04-23 12:00:00 +10:00

35 lines
1.1 KiB
Diff

--- a/net/minecraft/server/ContainerHorse.java
+++ b/net/minecraft/server/ContainerHorse.java
@@ -1,12 +1,32 @@
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 c;
private final EntityHorseAbstract d;
+ // 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(), c.getOwner().getInventory(), this);
+ }
+
public ContainerHorse(int i, PlayerInventory playerinventory, IInventory iinventory, final EntityHorseAbstract entityhorseabstract) {
super((Containers) null, i);
+ player = playerinventory;
+ // CraftBukkit end
this.c = iinventory;
this.d = entityhorseabstract;
boolean flag = true;