Closed Fourmisain closed 3 years ago
Some more information:
I could reproduce #26 with a "vanilla" client (only Fabric, Fabric API and Tiered) on every world load.
Interestingly, I couldn't reproduce it in the dev environment.
Was wondering why, so I tested EquipmentSlot.class.getField("MAINHAND")
on both; it failed when running normally, but succeeded in the dev environment, which can only mean that it's actually running the client "unobfuscated" (with yarn mappings).
I never use the dev env and I guess this is another reason to not use it on the daily.
Yep, just a simple mapping issue. It worked previously because I was never using my GSON
instance to serialize (and the data files had the proper slot name, which deserialized fine in-code), but I forgot to add the slot serializer after serializing in my sync packet.
Thanks for the fix!
Fixes #26.
My guess as to what's happening: Gson wants to ultimately serialize
EquipmentSlot
here https://github.com/Draylar/tiered/blob/cbaf6f6e4eb8f31b4e3006f8c1537c822cf99ac6/src/main/java/draylar/tiered/Tiered.java#L109 and by default uses the EnumTypeAdapter. This specifically runsSo
classOfT.getField(name)
searches for the fieldMAINHAND
inside the classEquipmentSlot
.What's the issue? Obfuscation. There is no field with the name
MAINHAND
, but it'sfield_6173
(in intermediary).The fix is to add a straight forward serializer for the enum.