Fix horse saddle API broken in 1.21.5 update
This commit is contained in:
parent
63df70ec06
commit
3f917b07bb
@ -37,10 +37,12 @@
|
||||
public abstract class EntityLiving extends Entity implements Attackable {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -246,6 +276,19 @@
|
||||
@@ -245,7 +275,20 @@
|
||||
protected BehaviorController<?> brain;
|
||||
protected boolean skipDropExperience;
|
||||
private final EnumMap<EnumItemSlot, Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>>> activeLocationDependentEnchantments;
|
||||
protected final EntityEquipment equipment;
|
||||
- protected final EntityEquipment equipment;
|
||||
+ public final EntityEquipment equipment;
|
||||
+ // CraftBukkit start
|
||||
+ public int expToDrop;
|
||||
+ public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
@ -111,6 +111,6 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
|
||||
|
||||
@Override
|
||||
public AbstractHorseInventory getInventory() {
|
||||
return new CraftInventoryAbstractHorse(getHandle().inventory);
|
||||
return new CraftInventoryAbstractHorse(getHandle().inventory, getHandle().equipment);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.world.entity.EnumItemSlot;
|
||||
import net.minecraft.world.entity.animal.horse.EntityHorse;
|
||||
import net.minecraft.world.entity.animal.horse.HorseColor;
|
||||
import net.minecraft.world.entity.animal.horse.HorseStyle;
|
||||
@ -60,7 +59,7 @@ public class CraftHorse extends CraftAbstractHorse implements Horse {
|
||||
|
||||
@Override
|
||||
public HorseInventory getInventory() {
|
||||
return new CraftInventoryHorse(getHandle().inventory, getHandle().createEquipmentSlotContainer(EnumItemSlot.BODY));
|
||||
return new CraftInventoryHorse(getHandle().inventory, getHandle().equipment);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.world.entity.EnumItemSlot;
|
||||
import net.minecraft.world.entity.animal.horse.EntityLlama;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryLlama;
|
||||
@ -35,7 +34,7 @@ public class CraftLlama extends CraftChestedHorse implements Llama {
|
||||
|
||||
@Override
|
||||
public LlamaInventory getInventory() {
|
||||
return new CraftInventoryLlama(getHandle().inventory, getHandle().createEquipmentSlotContainer(EnumItemSlot.BODY));
|
||||
return new CraftInventoryLlama(getHandle().inventory, getHandle().equipment);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,22 +1,28 @@
|
||||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import net.minecraft.world.IInventory;
|
||||
import net.minecraft.world.entity.EntityEquipment;
|
||||
import net.minecraft.world.entity.EnumItemSlot;
|
||||
import org.bukkit.inventory.AbstractHorseInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CraftInventoryAbstractHorse extends CraftInventory implements AbstractHorseInventory {
|
||||
|
||||
public CraftInventoryAbstractHorse(IInventory inventory) {
|
||||
protected final EntityEquipment equipment;
|
||||
|
||||
public CraftInventoryAbstractHorse(IInventory inventory, EntityEquipment equipment) {
|
||||
super(inventory);
|
||||
this.equipment = equipment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSaddle() {
|
||||
return getItem(0);
|
||||
net.minecraft.world.item.ItemStack item = equipment.get(EnumItemSlot.SADDLE);
|
||||
return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSaddle(ItemStack stack) {
|
||||
setItem(0, stack);
|
||||
equipment.set(EnumItemSlot.SADDLE, CraftItemStack.asNMSCopy(stack));
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,25 @@
|
||||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import net.minecraft.world.IInventory;
|
||||
import net.minecraft.world.entity.EntityEquipment;
|
||||
import net.minecraft.world.entity.EnumItemSlot;
|
||||
import org.bukkit.inventory.HorseInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CraftInventoryHorse extends CraftInventoryAbstractHorse implements HorseInventory {
|
||||
|
||||
private final IInventory bodyArmorInventory;
|
||||
|
||||
public CraftInventoryHorse(IInventory inventory, IInventory bodyArmorInventory) {
|
||||
super(inventory);
|
||||
this.bodyArmorInventory = bodyArmorInventory;
|
||||
public CraftInventoryHorse(IInventory inventory, EntityEquipment equipment) {
|
||||
super(inventory, equipment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getArmor() {
|
||||
net.minecraft.world.item.ItemStack item = bodyArmorInventory.getItem(0);
|
||||
net.minecraft.world.item.ItemStack item = equipment.get(EnumItemSlot.BODY);
|
||||
return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArmor(ItemStack stack) {
|
||||
bodyArmorInventory.setItem(0, CraftItemStack.asNMSCopy(stack));
|
||||
equipment.set(EnumItemSlot.BODY, CraftItemStack.asNMSCopy(stack));
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,25 @@
|
||||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import net.minecraft.world.IInventory;
|
||||
import net.minecraft.world.entity.EntityEquipment;
|
||||
import net.minecraft.world.entity.EnumItemSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.LlamaInventory;
|
||||
|
||||
public class CraftInventoryLlama extends CraftInventoryAbstractHorse implements LlamaInventory {
|
||||
|
||||
private final IInventory bodyArmorInventory;
|
||||
|
||||
public CraftInventoryLlama(IInventory inventory, IInventory bodyArmorInventory) {
|
||||
super(inventory);
|
||||
this.bodyArmorInventory = bodyArmorInventory;
|
||||
public CraftInventoryLlama(IInventory inventory, EntityEquipment equipment) {
|
||||
super(inventory, equipment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDecor() {
|
||||
net.minecraft.world.item.ItemStack item = bodyArmorInventory.getItem(0);
|
||||
net.minecraft.world.item.ItemStack item = equipment.get(EnumItemSlot.BODY);
|
||||
return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDecor(ItemStack stack) {
|
||||
bodyArmorInventory.setItem(0, CraftItemStack.asNMSCopy(stack));
|
||||
equipment.set(EnumItemSlot.BODY, CraftItemStack.asNMSCopy(stack));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user