Skip to content

Conversation

@MC-Samuel
Copy link
Contributor

Redo of #2758 using NMS rather than Spigot's method.

Comment on lines 519 to 521
public ElementTag getArmadilloState(Armadillo entity) {
throw new UnsupportedOperationException();
}
Copy link
Member

Choose a reason for hiding this comment

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

Should create an "API" enum of our own and take/return that (see for example BlockHelper#get/setPushReaction), that way we don't directly depend on Mojang's internal enum names and can easily notice once there's changes and/or avoid them entirely because we control the naming.


@Override
public void setPropertyValue(ElementTag param, Mechanism mechanism) {
NMSHandler.entityHelper.setArmadilloState(as(Armadillo.class), mechanism, param);
Copy link
Member

Choose a reason for hiding this comment

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

Once we have our own enum, can handle input checking here instead of in each NMS impl


@Override
public ElementTag getArmadilloState(org.bukkit.entity.Armadillo entity) {
net.minecraft.world.entity.animal.armadillo.Armadillo armadillo = (Armadillo) ((CraftEntity) entity).getHandle();
Copy link
Member

Choose a reason for hiding this comment

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

Why are you using the FQN here if you have it imported & use it normally in the cast?

case ROLLING -> Armadillo.ArmadilloState.ROLLING;
case SCARED -> Armadillo.ArmadilloState.SCARED;
case UNROLLING -> Armadillo.ArmadilloState.UNROLLING;
});
Copy link
Member

Choose a reason for hiding this comment

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

I think this is formatted badly?

// @description
// Controls the current state of an armadillo.
// Valid states are IDLE, ROLLING, SCARED, and UNROLLING.
// The entity may roll or unroll due to normal vanilla conditions. If this is not desired, disable <@link mechanism EntityTag.has_ai>.
Copy link
Member

Choose a reason for hiding this comment

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

Technically @link property is nicer here for if we ever make these more concrete than just redirecting to a mech link.


@Override
public boolean isDefaultValue(ElementTag val) {
return NMSHandler.entityHelper.getArmadilloState(as(Armadillo.class)).equals(ArmadilloState.IDLE);
Copy link
Member

Choose a reason for hiding this comment

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

Ideally this should check the value for being idle I think, technically it doesn't strictly always check the current value here (as in, in the future this might be used to check if some other random element is the default value).

@tal5 tal5 merged commit 35af462 into DenizenScript:dev Jan 27, 2026
1 check passed
@MC-Samuel MC-Samuel deleted the armadillo branch January 27, 2026 01:24
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