-
-
Notifications
You must be signed in to change notification settings - Fork 417
Make visual effects serializable #7114
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
Make visual effects serializable #7114
Conversation
|
also you can remove the license from the top of the files |
Co-authored-by: Efy <35348263+Efnilite@users.noreply.github.com>
d95d3cb to
b2c231e
Compare
sovdeeth
left a comment
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.
Does this handle types with data, like vibrations or dust particles? Also, I'd like to see some regression tests if possible.
| @Override | ||
| public Fields serialize(VisualEffectType visualEffectType) { | ||
| Fields fields = new Fields(); | ||
| fields.putObject("id", visualEffectType.getId()); |
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.
doing a quick look thru the VisualEffectType code, I see this regarding IDs
public String getId() {
return effect.getDeclaringClass().getSimpleName() + "." + effect.name();
}The issue here is the ID is the class name and enum name.
Problem comes from the fact Mojang has changed particle names several times in the last few versions.
And as of I believe 1.21 Bukkit has changed a whole bunch of the enums.
That said, this is not version safe.
|
Closing due to inactivity |
Description
Started by @TPGamesNL in PR #4123 (the commit has been cherry-picked and the author has been kept for credits), providing a serializer for
VisualEffectTypeallows to serializeVisualEffectcorrectly. In fact, this should have been handled bysimpleClassLoaders, where this specific class was originally registered.However, the
Yggdrasil#getSerializermethod did not return a serializer: aSimpleClassResolverextends fromClassResolverand not from aYggdrasilSerializerlike the others. A fix is therefore to directly register this serializer at the root ofclassResolvers.https://github.com/SkriptLang/Skript/blob/master/src/main/java/ch/njol/yggdrasil/Yggdrasil.java
Target Minecraft Versions: any
Requirements: none
Related Issues: #4196