-
-
Notifications
You must be signed in to change notification settings - Fork 113
Added EntityTag.State Property for Armadillo Rolling #2802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| public ElementTag getArmadilloState(Armadillo entity) { | ||
| throw new UnsupportedOperationException(); | ||
| } |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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; | ||
| }); |
There was a problem hiding this comment.
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?
plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityState.java
Show resolved
Hide resolved
| // @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>. |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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).
Redo of #2758 using NMS rather than Spigot's method.