mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
Fix EntityEquipment for armor stands and redirect the getters/setters to use it
This commit is contained in:
parent
dbdf6cacbf
commit
40aaa31c49
@ -3,7 +3,6 @@ package org.bukkit.craftbukkit.entity;
|
|||||||
import net.minecraft.server.EntityArmorStand;
|
import net.minecraft.server.EntityArmorStand;
|
||||||
import net.minecraft.server.Vector3f;
|
import net.minecraft.server.Vector3f;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -11,12 +10,6 @@ import org.bukkit.util.EulerAngle;
|
|||||||
|
|
||||||
public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
||||||
|
|
||||||
private static final int HAND = 0;
|
|
||||||
private static final int FEET = 1;
|
|
||||||
private static final int LEGS = 2;
|
|
||||||
private static final int CHEST = 3;
|
|
||||||
private static final int HEAD = 4;
|
|
||||||
|
|
||||||
public CraftArmorStand(CraftServer server, EntityArmorStand entity) {
|
public CraftArmorStand(CraftServer server, EntityArmorStand entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
@ -38,52 +31,52 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItemInHand() {
|
public ItemStack getItemInHand() {
|
||||||
return CraftItemStack.asBukkitCopy(getHandle().getEquipment(HAND));
|
return getEquipment().getItemInHand();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setItemInHand(ItemStack item) {
|
public void setItemInHand(ItemStack item) {
|
||||||
getHandle().setEquipment(HAND, CraftItemStack.asNMSCopy(item));
|
getEquipment().setItemInHand(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getBoots() {
|
public ItemStack getBoots() {
|
||||||
return CraftItemStack.asBukkitCopy(getHandle().getEquipment(FEET));
|
return getEquipment().getBoots();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBoots(ItemStack item) {
|
public void setBoots(ItemStack item) {
|
||||||
getHandle().setEquipment(FEET, CraftItemStack.asNMSCopy(item));
|
getEquipment().setBoots(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getLeggings() {
|
public ItemStack getLeggings() {
|
||||||
return CraftItemStack.asBukkitCopy(getHandle().getEquipment(LEGS));
|
return getEquipment().getLeggings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLeggings(ItemStack item) {
|
public void setLeggings(ItemStack item) {
|
||||||
getHandle().setEquipment(LEGS, CraftItemStack.asNMSCopy(item));
|
getEquipment().setLeggings(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getChestplate() {
|
public ItemStack getChestplate() {
|
||||||
return CraftItemStack.asBukkitCopy(getHandle().getEquipment(CHEST));
|
return getEquipment().getChestplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setChestplate(ItemStack item) {
|
public void setChestplate(ItemStack item) {
|
||||||
getHandle().setEquipment(CHEST, CraftItemStack.asNMSCopy(item));
|
getEquipment().setChestplate(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getHelmet() {
|
public ItemStack getHelmet() {
|
||||||
return CraftItemStack.asBukkitCopy(getHandle().getEquipment(HEAD));
|
return getEquipment().getHelmet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHelmet(ItemStack item) {
|
public void setHelmet(ItemStack item) {
|
||||||
getHandle().setEquipment(HEAD, CraftItemStack.asNMSCopy(item));
|
getEquipment().setHelmet(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,6 +7,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.server.DamageSource;
|
import net.minecraft.server.DamageSource;
|
||||||
|
import net.minecraft.server.EntityArmorStand;
|
||||||
import net.minecraft.server.EntityArrow;
|
import net.minecraft.server.EntityArrow;
|
||||||
import net.minecraft.server.EntityEgg;
|
import net.minecraft.server.EntityEgg;
|
||||||
import net.minecraft.server.EntityEnderDragon;
|
import net.minecraft.server.EntityEnderDragon;
|
||||||
@ -67,7 +68,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
|
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
|
|
||||||
if (entity instanceof EntityInsentient) {
|
if (entity instanceof EntityInsentient || entity instanceof EntityArmorStand) {
|
||||||
equipment = new CraftEntityEquipment(this);
|
equipment = new CraftEntityEquipment(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user