Skip to content

Commit

Permalink
deprecate horse variants
Browse files Browse the repository at this point in the history
  • Loading branch information
mergu committed Jan 17, 2018
1 parent 59471a4 commit 5e66f8a
Showing 1 changed file with 11 additions and 7 deletions.
Expand Up @@ -56,9 +56,9 @@ private String getColor() {
EntityType type = colored.getBukkitEntityType();

if (type == EntityType.HORSE) {
return ((Horse) colored.getBukkitEntity()).getColor().name() + "|" +
((Horse) colored.getBukkitEntity()).getStyle().name() + "|" +
((Horse) colored.getBukkitEntity()).getVariant().name();
Horse horse = (Horse) colored.getBukkitEntity();
return horse.getColor().name() + "|" + horse.getStyle().name() +
(NMSHandler.getVersion().isAtMost(NMSVersion.v1_10_R1) ? "|" + horse.getVariant().name() : "");
}

else if (type == EntityType.SHEEP) {
Expand Down Expand Up @@ -113,13 +113,14 @@ public String getPropertyId() {
// This is a quick rundown of the styling information used to create a horse,
// used for both <@link tag e@entity.color> and <@link mechanism e@entity.color>.
//
// The output/input is formatted as COLOR|STYLE|VARIANT
// The output/input is formatted as COLOR|STYLE(|VARIANT)
// Where color is:
// BLACK, BROWN, CHESTNUT, CREAMY, DARK_BROWN, GRAY, or WHITE.
// and where style is:
// WHITE, WHITE_DOTS, WHITEFIELD, BLACK_DOTS, or NONE.
// and where variant is:
// DONKEY, MULE, SKELETON_HORSE, UNDEAD_HORSE, or HORSE.
// NOTE: HORSE VARIANTS DEPRECATED SINCE 1.11, use spawn instead
// -->

// <--[language]
Expand Down Expand Up @@ -152,7 +153,8 @@ public String getAttribute(Attribute attribute) {
// @description
// If the entity can have a color, returns the entity's color.
// Currently, only Horse, Wolf, Ocelot, Sheep, Rabbit, and Parrot type entities can have a color.
// For horses, the output is COLOR|STYLE|VARIANT, see <@link language horse types>.
// For horses, the output is COLOR|STYLE(|VARIANT), see <@link language horse types>.
// NOTE: HORSE VARIANTS DEPRECATED SINCE 1.11, use spawn instead
// For ocelots, the types are BLACK_CAT, RED_CAT, SIAMESE_CAT, or WILD_OCELOT.
// For rabbit types, see <@link language rabbit types>.
// For parrots, the types are BLUE, CYAN, GRAY, GREEN, or RED.
Expand All @@ -175,7 +177,8 @@ public void adjust(Mechanism mechanism) {
// @description
// Changes the entity's color.
// Currently, only Horse, Wolf, Ocelot, Sheep, Rabbit, and Parrot type entities can have a color.
// For horses, the input is COLOR|STYLE|VARIANT, see <@link language horse types>
// For horses, the input is COLOR|STYLE(|VARIANT), see <@link language horse types>
// NOTE: HORSE VARIANTS DEPRECATED SINCE 1.11, use spawn instead
// For ocelots, the types are BLACK_CAT, RED_CAT, SIAMESE_CAT, or WILD_OCELOT.
// For rabbit types, see <@link language rabbit types>.
// For parrots, the types are BLUE, CYAN, GRAY, GREEN, or RED.
Expand All @@ -197,7 +200,8 @@ public void adjust(Mechanism mechanism) {
((Horse) colored.getBukkitEntity())
.setStyle(Horse.Style.valueOf(horse_info.get(1).toUpperCase()));
}
if (horse_info.size() > 2 && new Element(horse_info.get(2)).matchesEnum(Horse.Variant.values())) {
if (NMSHandler.getVersion().isAtMost(NMSVersion.v1_10_R1)
&& horse_info.size() > 2 && new Element(horse_info.get(2)).matchesEnum(Horse.Variant.values())) {
((Horse) colored.getBukkitEntity())
.setVariant(Horse.Variant.valueOf(horse_info.get(2).toUpperCase()));
}
Expand Down

0 comments on commit 5e66f8a

Please sign in to comment.