0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 04:16:17 +00:00
craftbukkit/nms-patches/net/minecraft/world/inventory/ContainerHorse.patch
2024-10-23 02:15:00 +11:00

54 lines
2.3 KiB
Diff

--- a/net/minecraft/world/inventory/ContainerHorse.java
+++ b/net/minecraft/world/inventory/ContainerHorse.java
@@ -10,6 +10,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 {
private final IInventory horseContainer;
@@ -18,13 +23,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();
@@ -35,7 +55,7 @@
return entityhorseabstract.isSaddleable();
}
});
- this.addSlot(new ArmorSlot(this, this.armorContainer, entityhorseabstract, EnumItemSlot.BODY, 0, 8, 36, (MinecraftKey) null) {
+ this.addSlot(new ArmorSlot(this.armorContainer, entityhorseabstract, EnumItemSlot.BODY, 0, 8, 36, (MinecraftKey) null) { // CraftBukkit - decompile error
@Override
public boolean mayPlace(ItemStack itemstack) {
return entityhorseabstract.isEquippableInSlot(itemstack, EnumItemSlot.BODY);