-
-
Notifications
You must be signed in to change notification settings - Fork 391
Fix super entity changer with location #7394
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
base: dev/feature
Are you sure you want to change the base?
Fix super entity changer with location #7394
Conversation
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 don't really see the point of this change. Why does the entity changer need a special Internal mode to allow it to be teleported via changing the coords? Why not just have it implement SET and allow the exact same thing, AND setting the location directly. More to the point, is that even safe behavior at all? Teleportation isn't necessarily instant, affects things like passengers, and I think it's better done explicitly rather than hidden behind setting locations/coordinates.
Because using SET calls the changer again, resulting in an un-needed iteration, and to avoid possible concurrency within the changer. Other syntaxes will need to use this change mode they can also re-apply their similar methodology. Skript has had this way of manipulating the underlying element of an expression since the beginning. See WrapperExpression, see blocks, see enchant, see lore and see this coordinate expression that has been trying to do it, but ultimately fails because it doesn't have the fixes that are present in this pull request. RandomSK had a fix for this known coordinate expression issue back in 1.7 |
How would implementing SET result in an un-needed iteration? It would follow the exact same path you've made for INTERNAL. I still have concerns about a changer causing a teleportation, too. |
It'll recollect all the expressions again |
Elaborate, please, I'm not sure what you mean. |
If the original intake change mode is ADD, and you use the SET again on the coordinate expression. It'll then go through the SET change mode of the coordinate expression, and then go to the ClassInfo changer. INTERNAL goes from ADD on coordinate straight to the classinfo, no need to call SET on the coordinate expression again. |
SET isn't called again on the coord expression previously, either. The child expression (the entity, in this case) is what it's called on. |
Another example of proper usage of the INTERNAL changemode would be lore. You can add and remove lore using ItemMeta to add to the lore list, so after manipulation it would be beneficial to add a lore and not set the whole lore list again. |
How does INTERNAL work there, too? does it suddenly act like ADD instead of SET? Either way, if you add to the lore list, you'll still have to call SET on the source expression since you're not sure if you got a copy or the true itemstack from the expression. I don't see the benefit there either. INTERNAL feels like an ambiguous mode that doesn't actually do anything new. |
INTERNAL allows for non user access in this case. We don't want the entity changer to be allowed to use SET with the location, they should be using the teleport effect, but when it comes to adding coordinates to a location, Skript was setup to allow the entity location to also be manipulated and then teleport said entity, but it doesn't work. So what this fix does is uses the INTERNAL change mode to do the teleportation, without allowing the user to set the entity location, while still keeping the underlying ability to add to a location. Using SET with a location and the entity changer, would not be possible without allowing the user to also do so. |
Okay that makes sense. I'm still concerned about the suitability of a teleport changer at all, and I don't like that INTERNAL is a separate mode that doesn't say anything about what it does. I would rather see internal changers be flagged separately, like |
INTERNAL is only a SET, and well, it's for internal use only. It has JavaDocs and I don't see it be confusing. Similar to the internal only usage annotation. All other changers boil down to a SET like you said originally about using SET after the ADD and REMOVE. So you don't need to add every other changer element when it's coming from those.
Is so much easier than needing to get and manipulate the location and then put through the teleport effect. |
But like you said earlier, even though the example of lore isn't great, an internal ADD method could be quite useful for some situations to prevent having to recreate something and call SET. I think it's more flexible and forward-thinking that way. If others disagree, I am fine with it being INTERNAL_SET, but just INTERNAL alone is way too ambiguous. However, the core problem this is solving, setting entity locations, is still one i don't think should be solved like this. teleportations should be done knowing that the entity is being teleported, ie, using the teleport effect. |
Description
Notes:
last spawned wither
will work now. Re-add local variable type hints #5457 adds a solution to this. Example is the source of the variable{_wither}
should be the entity, but the source is always the converted Location.Target Minecraft Versions: any
Requirements: none
Related Issues: #6686