[1.11.2] HWYLA not working like WAILA
capnkirok opened this issue · 17 comments
Issue Description:
HWYLA is showing incorrect values for animals (always Hungry / Thirsty) on 1.11.2. When using WAILA they are alway correct
https://github.com/capnkirok/animania/issues/484
What happens:
What you expected to happen:
Show correct values
Steps to reproduce:
- Install animania, crafstudio, HWYLA,
- See animals always hungry, thirsty
- Install WAILA instead. Rejoice.
...
Affected Versions (Do not use "latest"):
- Hwyla: Hwyla-1.8.17-B31_1.11.jar
- Minecraft: 1.11.2
- Forge: latest recommended
Possible Conflicting Mods (Provide their version, as well)
Can you set a breakpoint at line 70 in WailaEntityAnimalProviderBase
and make sure the entity tag has the proper data?
Hey @TehNut my friend. I will reach out once I close a hot burning fire of a bug I'm working on now. Will do some testing before I do. Thx.
@capnkirok Any updates?
Hey ... FYI, I finally opened up Animania:
https://github.com/capnkirok/animaniamod
I rewrote packet handling mid-1.11 which may have removed your edge case. Either way, the current code is "invalid" in both Waila and Hwyla since the client is not guaranteed to know the proper data.
In here, https://github.com/capnkirok/animaniamod/blob/1.12/src/main/java/com/animania/compat/waila/provider/WailaEntityAnimalProviderBase.java, why are you overriding the fed and watered vales sent by the server? All the checks you do (which could easily be cleaned up by using an interface, btw) should be done in getNBTData instead of getWailaBody. getWailaBody is only called client-side, so your getters are relying on whatever the client knows, which is probably wrong.
Hey @TehNut. Well, I didn't write this particular piece of code, but I see your point. What's strange to me, even with this oversight, is that this implementation works with WAILA but not with HWYLA, which was the original post.
Let me see if I can fix it based on your tip (no pun intended).
@TehNut I will take you up on your offer. I tried a few different methods and came up with nothing. And it works in WAILA, like I said. So, I am guessing your packet fix is probably what did it, as you suggest.
Okay I did some digging and spotted the issue. This is a fun one.
So first off, Entity#getEntityData()
is custom data. Not what you're serializing in Entity#writeEntityToNBT()
. If you look inside getEntityData()
, you can see it nullchecks itself and if it's null, it sets itself to a new empty compound and returns that. Otherwise it returns whatever was there. Unless somebody else has called that before, it will always be null, so you will always get an empty tag from it.
The reason it works with Waila is because Waila is missing the Entity NBT provider call here. Like, it literally never makes use of it. Ever. This means that you setting Fed
and Watered
to default values from an empty tag here are never called.
The reason it doesn't work in Hwyla is because I do make the provider calls. So your provider is setting the values to 0 since that is the default.