Java 类org.bukkit.entity.ChestedHorse 实例源码

项目:buildinggame    文件:ChestMenu.java   
/**
 * {@inheritDoc}
 */
public ChestMenu(Plot plot, ChestedHorse chestedHorse) {
    super(plot, chestedHorse);

    //chest
    ItemStack chest = new ItemStack(Material.CHEST);
    ItemMeta chestMeta = chest.getItemMeta();
    chestMeta.setDisplayName(ChatColor.GREEN + "Set/Remove chest");
    chest.setItemMeta(chestMeta);

    insertItem(chest, event -> {
        chestedHorse.setCarryingChest(!chestedHorse.isCarryingChest());

        event.setCancelled(true);
    }, 0);
}
项目:SonarPet    文件:EntityHorsePet.java   
@Override
public void setChested(boolean flag) {
    if (Versioning.NMS_VERSION.compareTo(NmsVersion.v1_11_R1) >= 0) {
        if (!(getBukkitEntity() instanceof ChestedHorse)) {
            /*
             * To fail silently, or to throw an exception; that is the question.
             * Whether is nobler to be confusing and get a bug report,
             * or be annoying and get a bug report?
             */
            return;
        }
    }
    getEntity().setCarryingChest(flag);
}
项目:SwornAPI    文件:SpecialEntities.java   
@Override
public LivingEntity spawnHorse(Location loc, HorseType type, Color color, Style style, boolean tame, boolean chest)
{
    Horse horse = (Horse) loc.getWorld().spawnEntity(loc, type.getEntity());
    horse.setColor(color);
    horse.setStyle(style);
    horse.setTamed(tame);

    if (chest && horse instanceof ChestedHorse)
        ((ChestedHorse) horse).setCarryingChest(true);

    return horse;
}
项目:SonarPet    文件:NMSEntityHorseImpl.java   
@Override
public void setCarryingChest(boolean flag) {
    if (getBukkitEntity() instanceof ChestedHorse) {
        ((ChestedHorse) getBukkitEntity()).setCarryingChest(flag);
    }
}
项目:SonarPet    文件:NMSEntityHorseImpl.java   
@Override
public void setCarryingChest(boolean flag) {
    if (getBukkitEntity() instanceof ChestedHorse) {
        ((ChestedHorse) getBukkitEntity()).setCarryingChest(flag);
    }
}
项目:SimpleEgg    文件:LorePacker.java   
/**
 * Assembles an ArrayList of the properties for the specified Entity that
 * is to be used for a spawn egg. All instanceof checks are done internally
 * by the LorePackager, so no type checking is required prior to calling
 * this method. Null Entities will throw an IllegalArgumentException. <b>The
 * actual ArrayList is returned by {@link #getLore() LorePacker.getLore()}.
 * </b>
 * @param livingEntity - The Entity to assemble a lore for.
 * @return An ArrayList of Strings
 * @throws IllegalArgumentException If entity parameter is null
 */
public LorePacker(LivingEntity livingEntity) throws IllegalArgumentException {
    if (livingEntity == null) {
        throw new IllegalArgumentException("Can't assemble lore for a null entity!");
    }

    lore = new ArrayList<String>();
    // This needs to always be on top of an egg's lore
    lore.add("Identifier: SimpleEgg." + livingEntity.getType().getEntityClass().getSimpleName() + "." + Main.getSelf().getDescription().getVersion());
    lore.addAll(livingEntity(livingEntity));

    if (livingEntity instanceof Ageable) {
        lore.addAll(ageable((Ageable) livingEntity));

        if (livingEntity instanceof Sheep) {
            lore.addAll(sheep((Sheep) livingEntity));
        } else if (livingEntity instanceof Pig) {
            lore.addAll(pig((Pig) livingEntity));
        } else if (livingEntity instanceof Rabbit) {
            lore.addAll(rabbit((Rabbit) livingEntity));
        } else if (livingEntity instanceof Villager) {
            lore.addAll(villager((Villager) livingEntity));
        } else if (livingEntity instanceof Tameable) {
            lore.addAll(tameable((Tameable) livingEntity));

            if (livingEntity instanceof AbstractHorse) {
                lore.addAll(abstractHorse((AbstractHorse) livingEntity));

                if (livingEntity instanceof Horse) {
                    lore.addAll(horse((Horse) livingEntity));
                } else if (livingEntity instanceof ChestedHorse) {
                    lore.addAll(chestedHorse((ChestedHorse) livingEntity));

                    if (livingEntity instanceof Llama) {
                        lore.addAll(llama((Llama) livingEntity));
                    }
                }
            } else if (livingEntity instanceof Sittable) {
                lore.addAll(sittable((Sittable) livingEntity));

                if (livingEntity instanceof Wolf) {
                    lore.addAll(wolf((Wolf) livingEntity));
                } else if (livingEntity instanceof Ocelot) {
                    lore.addAll(ocelot((Ocelot) livingEntity));
                } else if (livingEntity instanceof Parrot) {
                    lore.addAll(parrot((Parrot) livingEntity));
                }
            }
        }
    } else if (livingEntity instanceof Slime) {
        lore.addAll(slime((Slime) livingEntity));
    } else if (livingEntity instanceof Creeper) {
        lore.addAll(creeper((Creeper) livingEntity));
    } else if (livingEntity instanceof Zombie) {
        lore.addAll(zombie((Zombie) livingEntity));

        if (livingEntity instanceof PigZombie) {
            lore.addAll(pigZombie((PigZombie) livingEntity));
        } else if (livingEntity instanceof ZombieVillager) {
            lore.addAll(zombieVillager((ZombieVillager) livingEntity));
        }
    } else if (livingEntity instanceof Spellcaster) {
        lore.addAll(spellCaster((Spellcaster) livingEntity));
    } else if (livingEntity instanceof IronGolem) {
        lore.addAll(ironGolem((IronGolem) livingEntity));
    } else if (livingEntity instanceof Snowman) {
        lore.addAll(snowman((Snowman) livingEntity));
    }
}