You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.
There are cases where you may wish to unpick any number of constants and literals as a math operation in place of a single literal. An example in Minecraft would be with entity events, wherein Mojang use the following values:
PERMISSION_LEVEL_SET_TO_0 = 24; // Permission level was set to 0 on the serverPERMISSION_LEVEL_SET_TO_1 = 25; // Permission level was set to 1 on the serverPERMISSION_LEVEL_SET_TO_2 = 26; // Permission level was set to 2 on the serverPERMISSION_LEVEL_SET_TO_3 = 27; // Permission level was set to 3 on the serverPERMISSION_LEVEL_SET_TO_4 = 28; // Permission level was set to 4 on the server
But when analyzing the deserialization of the event, the permission level is determined as event - 24, which leads to the suspicion that they in fact only have one constant,
PERMISSION_LEVEL_SET = 24; // Permission level was updated on the server
And that they serialize in the following forms at call sites:
PERMISSION_LEVEL_SET + 0; // Permission level was set to 0 on the serverPERMISSION_LEVEL_SET + 1; // Permission level was set to 1 on the serverPERMISSION_LEVEL_SET + 2; // Permission level was set to 2 on the serverPERMISSION_LEVEL_SET + 3; // Permission level was set to 3 on the serverPERMISSION_LEVEL_SET + 4; // Permission level was set to 4 on the server
To recreate this form, explicit support will be needed for this kind of unpicking.
The text was updated successfully, but these errors were encountered:
Are there any other examples of this kind of format, in Minecraft or otherwise? It's not the most intuitive thing when read IMO. I'm pretty sure this will be somewhat tricky to implement, so if it's just used this once in some questionable quality code, I'd rather not implement it.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There are cases where you may wish to unpick any number of constants and literals as a math operation in place of a single literal. An example in Minecraft would be with entity events, wherein Mojang use the following values:
But when analyzing the deserialization of the event, the permission level is determined as
event - 24
, which leads to the suspicion that they in fact only have one constant,And that they serialize in the following forms at call sites:
To recreate this form, explicit support will be needed for this kind of unpicking.
The text was updated successfully, but these errors were encountered: