mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
SPIGOT-7666: Fix access to llama and horse special slot
By: md_5 <git@md-5.net>
This commit is contained in:
parent
54f230de84
commit
317917800c
4 changed files with 16 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue