Skip to content

Updated Variant property to include chickens, cows, and pigs for 1.21+#2717

Merged
tal5 merged 3 commits intoDenizenScript:devfrom
MC-Samuel:variant-expansion
May 8, 2025
Merged

Updated Variant property to include chickens, cows, and pigs for 1.21+#2717
tal5 merged 3 commits intoDenizenScript:devfrom
MC-Samuel:variant-expansion

Conversation

@MC-Samuel
Copy link
Copy Markdown
Contributor

No description provided.

mcmonkey4eva
mcmonkey4eva previously approved these changes Apr 10, 2025
public ElementTag getPropertyValue() {
return new ElementTag(Utilities.namespacedKeyToString(as(Wolf.class).getVariant().getKey()));
if (getEntity() instanceof Wolf wolf) {
return new ElementTag(Utilities.namespacedKeyToString(wolf.getVariant().getKeyOrThrow()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did Wolf.Variant#getKeyOrThrow exist on 1.20.6?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, pretty sure you can't use that either way - Paper doesn't have these Spigot changes

Comment on lines +52 to +58
Wolf.Variant entityVariety = Utilities.elementToEnumlike(variant, Wolf.Variant.class);
if (entityVariety != null) {
wolf.setVariant(entityVariety);
}
else {
mechanism.echoError("Invalid wolf variant specified: " + variant);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use the new 01a7819 here.
Also for the naming, generally you'd name it after the object type, so Variant instead Variety and probably wolf instead of entity - wolfVariant.

return new ElementTag(Utilities.namespacedKeyToString(wolf.getVariant().getKey()));
}
else if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_21) && getEntity() instanceof Chicken chicken) {
return new ElementTag(Utilities.namespacedKeyToString(chicken.getVariant().getKey()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be plain-text elements

@MC-Samuel MC-Samuel requested a review from tal5 May 3, 2025 23:22
@tal5 tal5 merged commit 75f7c61 into DenizenScript:dev May 8, 2025
1 check passed
@MC-Samuel MC-Samuel deleted the variant-expansion branch May 9, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants