Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ public class EntityVariant extends EntityProperty<ElementTag> {
// @name variant
// @input ElementTag
// @description
// Controls which variant a chicken, copper golem, cow, pig, or wolf is.
// Controls which variant a chicken, copper golem, cow, pig, wolf, or zombie nautilus is.
// A list of valid chicken variants can be found at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Chicken.Variant.html>.
// A list of valid copper golem variants can be found at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/CopperGolem.CopperWeatherState.html>.
// A list of valid cow variants can be found at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Cow.Variant.html>.
// A list of valid pig variants can be found at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Pig.Variant.html>.
// A list of valid wolf variants can be found at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Wolf.Variant.html>.
// A list of valid zombie nautilus variants can be found at <@link url https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/ZombieNautilus.Variant.html>.
// -->

public static boolean describes(EntityTag entityTag) {
Expand All @@ -49,7 +50,8 @@ public static boolean describes(EntityTag entityTag) {
|| (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_21) && (entity instanceof Chicken
|| entity instanceof CopperGolem
|| entity instanceof Cow
|| entity instanceof Pig));
|| entity instanceof Pig
|| entity instanceof ZombieNautilus));
}

@Override
Expand All @@ -76,6 +78,9 @@ else if (COW_GET_VARIANT != null && getEntity() instanceof Cow cow) {
else if (getEntity() instanceof Pig pig) {
return new ElementTag(Utilities.namespacedKeyToString(pig.getVariant().getKey()), true);
}
else if (getEntity() instanceof ZombieNautilus zombieNautilus) {
return new ElementTag(Utilities.namespacedKeyToString(zombieNautilus.getVariant().getKey()), true);
}
}
return null;
}
Expand Down Expand Up @@ -115,6 +120,12 @@ else if (getEntity() instanceof Pig pig) {
pig.setVariant(pigVariant);
}
}
else if (getEntity() instanceof ZombieNautilus zombieNautilus) {
ZombieNautilus.Variant zombieNautilusVariant= Utilities.elementToRequiredEnumLike(variant, ZombieNautilus.Variant.class, mechanism);
if (zombieNautilusVariant != null) {
zombieNautilus.setVariant(zombieNautilusVariant);
}
}
}
}

Expand Down