Java 类net.minecraft.server.EnumItemSlot 实例源码

项目:CardinalPGM    文件:TitleRespawn.java   
private void playDeathAnimation(final Player player) {
    Bukkit.getScheduler().scheduleSyncDelayedTask(Cardinal.getInstance(), new Runnable() {
        @Override
        public void run() {
            EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();

            List<Packet> packets = new ArrayList<>();
            for (EnumItemSlot slot : EnumItemSlot.values()) {
                packets.add(new PacketPlayOutEntityEquipment(nmsPlayer.getId(), slot,
                        net.minecraft.server.ItemStack.a));  // Removes armor, otherwise, a client-side glitch makes items
            }
            packets.add(PacketUtils.createMetadataPacket(nmsPlayer.getId(), Watchers.getHealth(0)));
            packets.add(new PacketPlayOutEntityStatus(nmsPlayer, (byte) 3));

            for (Player online : Bukkit.getOnlinePlayers()) {
                if (!online.equals(player)){
                    for (Packet packet : packets) {
                        PacketUtils.sendPacket(online, packet);
                    }
                }
            }
        }
    }, 1L);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public ItemStack[] getArmorContents() {
    ItemStack[] armor = new ItemStack[]{
            getEquipment(EnumItemSlot.FEET),
            getEquipment(EnumItemSlot.LEGS),
            getEquipment(EnumItemSlot.CHEST),
            getEquipment(EnumItemSlot.HEAD),
    };
    return armor;
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
private void setDropChance(EnumItemSlot slot, float chance) {
    if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
        ((EntityInsentient) entity.getHandle()).dropChanceHand[slot.b()] = chance - 0.1F;
    } else {
        ((EntityInsentient) entity.getHandle()).dropChanceArmor[slot.b()] = chance - 0.1F;
    }
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
private float getDropChance(EnumItemSlot slot) {
    if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
        return ((EntityInsentient) entity.getHandle()).dropChanceHand[slot.b()] + 0.1F;
    } else {
        return ((EntityInsentient) entity.getHandle()).dropChanceArmor[slot.b()] + 0.1F;
    }
}
项目:ProjectAres    文件:NMSHacks.java   
public static Packet entityHelmetPacket(int entityId, org.bukkit.inventory.ItemStack helmet) {
    return new PacketPlayOutEntityEquipment(entityId, EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(helmet));
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
@Override
public ItemStack getItemInMainHand() {
    return getEquipment(EnumItemSlot.MAINHAND);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
@Override
public void setItemInMainHand(ItemStack item) {
    setEquipment(EnumItemSlot.MAINHAND, item);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
@Override
public ItemStack getItemInOffHand() {
    return getEquipment(EnumItemSlot.OFFHAND);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
@Override
public void setItemInOffHand(ItemStack item) {
    setEquipment(EnumItemSlot.OFFHAND, item);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public ItemStack getHelmet() {
    return getEquipment(EnumItemSlot.HEAD);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setHelmet(ItemStack helmet) {
    setEquipment(EnumItemSlot.HEAD, helmet);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public ItemStack getChestplate() {
    return getEquipment(EnumItemSlot.CHEST);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setChestplate(ItemStack chestplate) {
    setEquipment(EnumItemSlot.CHEST, chestplate);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public ItemStack getLeggings() {
    return getEquipment(EnumItemSlot.LEGS);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setLeggings(ItemStack leggings) {
    setEquipment(EnumItemSlot.LEGS, leggings);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public ItemStack getBoots() {
    return getEquipment(EnumItemSlot.FEET);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setBoots(ItemStack boots) {
    setEquipment(EnumItemSlot.FEET, boots);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setArmorContents(ItemStack[] items) {
    setEquipment(EnumItemSlot.FEET, items.length >= 1 ? items[0] : null);
    setEquipment(EnumItemSlot.LEGS, items.length >= 2 ? items[1] : null);
    setEquipment(EnumItemSlot.CHEST, items.length >= 3 ? items[2] : null);
    setEquipment(EnumItemSlot.HEAD, items.length >= 4 ? items[3] : null);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
private ItemStack getEquipment(EnumItemSlot slot) {
    return CraftItemStack.asBukkitCopy(entity.getHandle().getEquipment(slot));
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
private void setEquipment(EnumItemSlot slot, ItemStack stack) {
    entity.getHandle().setSlot(slot, CraftItemStack.asNMSCopy(stack));
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void clear() {
    for (EnumItemSlot slot : EnumItemSlot.values()) {
        setEquipment(slot, null);
    }
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
@Override
public float getItemInMainHandDropChance() {
   return getDropChance(EnumItemSlot.MAINHAND);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
@Override
public void setItemInMainHandDropChance(float chance) {
    setDropChance(EnumItemSlot.MAINHAND, chance);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
@Override
public float getItemInOffHandDropChance() {
    return getDropChance(EnumItemSlot.OFFHAND);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
@Override
public void setItemInOffHandDropChance(float chance) {
    setDropChance(EnumItemSlot.OFFHAND, chance);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public float getHelmetDropChance() {
    return getDropChance(EnumItemSlot.HEAD);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setHelmetDropChance(float chance) {
    setDropChance(EnumItemSlot.HEAD, chance);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public float getChestplateDropChance() {
    return getDropChance(EnumItemSlot.CHEST);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setChestplateDropChance(float chance) {
    setDropChance(EnumItemSlot.CHEST, chance);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public float getLeggingsDropChance() {
    return getDropChance(EnumItemSlot.LEGS);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setLeggingsDropChance(float chance) {
    setDropChance(EnumItemSlot.LEGS, chance);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public float getBootsDropChance() {
    return getDropChance(EnumItemSlot.FEET);
}
项目:SpigotSource    文件:CraftEntityEquipment.java   
public void setBootsDropChance(float chance) {
    setDropChance(EnumItemSlot.FEET, chance);
}
项目:SpigotSource    文件:CraftEquipmentSlot.java   
private static void set(EquipmentSlot type, EnumItemSlot value) {
    slots[type.ordinal()] = value;
    enums[value.ordinal()] = type;
}
项目:SpigotSource    文件:CraftEquipmentSlot.java   
public static EquipmentSlot getSlot(EnumItemSlot nms) {
    return enums[nms.ordinal()];
}
项目:SpigotSource    文件:CraftEquipmentSlot.java   
public static EnumItemSlot getNMS(EquipmentSlot slot) {
    return slots[slot.ordinal()];
}