diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java index 1f465ea9fc..61f1fef5ba 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java @@ -59,7 +59,7 @@ public class CraftHorse extends CraftAbstractHorse implements Horse { @Override public HorseInventory getInventory() { - return new CraftInventoryHorse(getHandle().inventory); + return new CraftInventoryHorse(getHandle().inventory, getHandle().getBodyArmorAccess()); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java index 8ded196b25..9082667bcd 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java @@ -34,7 +34,7 @@ public class CraftLlama extends CraftChestedHorse implements Llama { @Override public LlamaInventory getInventory() { - return new CraftInventoryLlama(getHandle().inventory); + return new CraftInventoryLlama(getHandle().inventory, getHandle().getBodyArmorAccess()); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java index c3599b29c0..478ac8cb8a 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java @@ -6,17 +6,21 @@ import org.bukkit.inventory.ItemStack; public class CraftInventoryHorse extends CraftInventoryAbstractHorse implements HorseInventory { - public CraftInventoryHorse(IInventory inventory) { + private final IInventory bodyArmorInventory; + + public CraftInventoryHorse(IInventory inventory, IInventory bodyArmorInventory) { super(inventory); + this.bodyArmorInventory = bodyArmorInventory; } @Override public ItemStack getArmor() { - return getItem(1); + net.minecraft.world.item.ItemStack item = bodyArmorInventory.getItem(0); + return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item); } @Override public void setArmor(ItemStack stack) { - setItem(1, stack); + bodyArmorInventory.setItem(0, CraftItemStack.asNMSCopy(stack)); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryLlama.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryLlama.java index ee10a79b69..729b334696 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryLlama.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryLlama.java @@ -6,17 +6,21 @@ import org.bukkit.inventory.LlamaInventory; public class CraftInventoryLlama extends CraftInventoryAbstractHorse implements LlamaInventory { - public CraftInventoryLlama(IInventory inventory) { + private final IInventory bodyArmorInventory; + + public CraftInventoryLlama(IInventory inventory, IInventory bodyArmorInventory) { super(inventory); + this.bodyArmorInventory = bodyArmorInventory; } @Override public ItemStack getDecor() { - return getItem(1); + net.minecraft.world.item.ItemStack item = bodyArmorInventory.getItem(0); + return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item); } @Override public void setDecor(ItemStack stack) { - setItem(1, stack); + bodyArmorInventory.setItem(0, CraftItemStack.asNMSCopy(stack)); } }