Java 类org.bukkit.entity.Horse.Style 实例源码

项目:Skript    文件:HorseData.java   
@Override
protected boolean deserialize(final String s) {
    final String[] split = s.split(",");
    if (split.length != 3)
        return false;
    try {
        variant = split[0].isEmpty() ? null : Variant.valueOf(split[0]);
        color = split[1].isEmpty() ? null : Color.valueOf(split[1]);
        style = split[2].isEmpty() ? null : Style.valueOf(split[2]);
    } catch (final IllegalArgumentException e) {
        return false;
    }
    return true;
}
项目: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;
}
项目: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, EntityType.HORSE);
    horse.setVariant(type.getVariant());
    horse.setColor(color);
    horse.setStyle(style);
    horse.setTamed(tame);
    horse.setCarryingChest(chest);
    return horse;
}
项目:CraftoPlugin    文件:StoredEntityType.java   
StoredEntityType(final int id, final String name) {
    this.id = id;
    this.name = Check.notNull(name, "The name cannot be null!");

    if (name.startsWith("HORSE_")) {
        this.type = EntityType.HORSE;
        this.style = Optional.of(Style.valueOf(name.replaceFirst("HORSE_", "")));
    }
    else {
        this.type = EntityType.valueOf(name);
        this.style = Optional.empty();
    }
}
项目:NucleusFramework    文件:HorseAnimal.java   
@Override
public void deserialize(IDataNode dataNode) throws DeserializeException {
    _color = dataNode.getEnum("color", Color.WHITE, Color.class);
    _variant = dataNode.getEnum("variant", Variant.HORSE, Variant.class);
    _style = dataNode.getEnum("style", Style.NONE, Style.class);
    _domestication = dataNode.getInteger("dom");
    _maxDomestication = dataNode.getInteger("max-dom");
    _hasChest = dataNode.getBoolean("chest");
    _jumpStrength = dataNode.getDouble("jump", 1.0D);
}
项目:NucleusFramework    文件:HorseAnimal.java   
@Override
public void deserialize(LoreMetaMap metaMap) {

    LoreMetaItem colorItem = metaMap.get("color");
    if (colorItem != null)
        _color = colorItem.enumValue(Color.class);

    LoreMetaItem variantItem = metaMap.get("variant");
    if (variantItem != null)
        _variant = variantItem.enumValue(Variant.class);

    LoreMetaItem styleItem = metaMap.get("style");
    if (styleItem != null)
        _style = styleItem.enumValue(Style.class);

    LoreMetaItem domItem = metaMap.get("dom");
    if (domItem != null)
        _domestication = domItem.intValue();

    LoreMetaItem maxDomItem = metaMap.get("max-dom");
    if (maxDomItem != null)
        _maxDomestication = maxDomItem.intValue();

    LoreMetaItem chestItem = metaMap.get("chest");
    if (chestItem != null)
        _hasChest = chestItem.booleanValue();

    LoreMetaItem jumpItem = metaMap.get("jump");
    if (jumpItem != null)
        _jumpStrength = jumpItem.doubleValue();
}
项目:MineKart    文件:HorseMountData.java   
@Override
public void loadData(ConfigurationSection section) {
    this.colour = Color.valueOf(section.getString("color", Color.BLACK.name()));
    this.style = Style.valueOf(section.getString("style", Style.NONE.name()));
    this.variant = Variant.valueOf(section.getString("variant", Variant.HORSE.name()));
    super.loadData(section);
}
项目:EchoPet    文件:HorsePet.java   
@Override
public void setStyle(Style style){
    ((IEntityHorsePet) getEntityPet()).setStyle(style);
    this.style = style;
   }
项目:EchoPet    文件:HorsePet.java   
@Override
public Style getStyle(){
    return this.style;
   }
项目:SwornAPI    文件:SpecialEntities.java   
LivingEntity spawnHorse(Location loc, HorseType type, Horse.Color color,
Horse.Style style, boolean tame, boolean chest);
项目:CraftoPlugin    文件:StoredEntityType.java   
/** TODO: Documentation */
public Optional<Style> getStyle() { return this.style; }
项目:MineKart    文件:HorseMountData.java   
public Style getHorseStyle() {
    return style;
}
项目:SwornAPI    文件:SpecialEntities.java   
/**
 * Spawns a Horse at a given location with the given properties.
 * @param loc Location to spawn at
 * @param variant Horse Variant, null if random
 * @param color Horse Color, null if random
 * @param style Horse Style, null if random
 * @param tame Whether or not the Horse is tamed
 * @param chest Whether or not the Horse is carrying a chest
 * @return The Horse
 */
public static LivingEntity spawnHorse(Location loc, HorseType type,
        Horse.Color color, Horse.Style style, boolean tame, boolean chest)
{
    if (type == null) type = randomElement(HorseType.values());
    if (color == null) color = randomElement(Horse.Color.values());
    if (style == null) style = randomElement(Horse.Style.values());

    return provider.spawnHorse(loc, type, color, style, tame, chest);
}
项目:BedrockAPI    文件:Horse.java   
Horse.Style getStyle();
项目:BedrockAPI    文件:Horse.java   
void setStyle(Horse.Style style);