Skip to content

Moved 8 entity types from EntityTag.color to EntityTag.variant#2817

Open
MC-Samuel wants to merge 3 commits into
DenizenScript:devfrom
MC-Samuel:variant_moving_1
Open

Moved 8 entity types from EntityTag.color to EntityTag.variant#2817
MC-Samuel wants to merge 3 commits into
DenizenScript:devfrom
MC-Samuel:variant_moving_1

Conversation

@MC-Samuel

Copy link
Copy Markdown
Contributor

Part 1 of moving some entity variants/types/colors from EntityTag.color to EntityTag.variant. The goal is to have EntityTag.color as primarily a DyeColor or ColorTag input rather than the current mix of DyeColors, ColorTags, ElementTags, and ListTags.
Also added EntityTag.allowed_variants to show what variants an entity can be.

case LLAMA, TRADER_LLAMA -> as(Llama.class).getColor().name();
case PARROT -> as(Parrot.class).getVariant().name();
case RABBIT -> {
BukkitImplDeprecations.colorToVariantProperty.warn();

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 should obey the includeDeprecated param (as the backsupport is only for tag usage, not property output).
But, it would also be good to provide the warnings with the TagContext - I would say replace the includeDeprecated param with a nullable TagContext and then base it on that.

if (getEntity() instanceof Wolf wolf) {
Entity entity = getEntity();
if (entity instanceof Fox fox) {
Fox.Type foxVariant = Utilities.elementToRequiredEnumLike(variant, Fox.Type.class, mechanism);

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.

I think most of these actually are just enums? Can use the normal Mechanism#requireEnum logic for those

// If the entity can have a variant, returns the list of allowed variants.
// See also <@link tag EntityTag.variant>.
// -->
PropertyParser.registerTag(EntityVariant.class, ListTag.class, "allowed_variants", (attribute, object) -> {

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.

This can probably be a static tag

…changed getColor to take an attribute and fire deprecation message if attribute is not null
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.

2 participants