Darkhax-Minecraft / WAWLA

What Are We Looking At (WAWLA) is a mod aimed and drawing more attention to providing in-game documentation for players.
GNU Lesser General Public License v2.1
32 stars 22 forks source link

Crash from WAWLA asking for writeEntitytoNBT() in client-side code #75

Closed radfast closed 6 years ago

radfast commented 7 years ago

Hey, I'm one of the Galacticraft devs. When WAWLA is installed, we're occasionally having crashes reported to us which look like this:

java.lang.NullPointerException: Saving entity NBT at micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket.func_70014_b(EntityTieredRocket.java:459) at micdoodle8.mods.galacticraft.core.entities.EntityTier1Rocket.func_70014_b(EntityTier1Rocket.java:216) at net.minecraft.entity.Entity.func_189511_e(Entity.java:1582) at mcp.mobius.waila.api.impl.DataAccessorCommon.getNBTData(DataAccessorCommon.java:137) at net.darkhax.wawla.engine.waila.EntityProvider.getWailaOverride(EntityProvider.java:22) at mcp.mobius.waila.overlay.RayTracing.getIdentifierEntity(RayTracing.java:122) at mcp.mobius.waila.overlay.RayTracing.getTargetEntity(RayTracing.java:74) at mcp.mobius.waila.overlay.WailaTickHandler.tickClient(WailaTickHandler.java:107) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_668_WailaTickHandler_tickClient_ClientTickEvent.invoke(.dynamic)

UCHIJAAAA Waila{1.7.0} [Waila] (Waila-1.7.0-B3_1.9.4.jar)
UCHIJAAAA icse{1.1.0.0} [I Can See Everything] (Wawla-1.10.2-2.3.1.213.jar)
UCHIJAAAA wawla{2.3.1.213} [What Are We Looking At] (Wawla-1.10.2-2.3.1.213.jar)

I guess you know that func_70014_b is Entity.writeEntityToNBT(). The reason for the crash is our mod is definitely not expecting to have .writeEntityToNBT() called in client-side code. For our entities, some of the relevant fields which a server saves to the NBT data may be null client-side or there may be other issues calling this client-side.

I don't know if there's anything you can do about this from WAWLA's side, or maybe this was already fixed?

If we should be reporting the issue to WAILA devs, please can you point me to their 1.10.2 repository, right now I can't find it, only TehNut's fork / port...

Darkhax commented 7 years ago

Hello,

One of the issues with Waila/Hwyla is that there is an expectancy that all tile entities can have their nbt saved client side. This issue has come up a fair bit in the past. It's generally been decided that it's expected that all tile entities should by syncable whenever, and if you add some very specific conditional stuff, you should check for that condition rather than assuming.

radfast commented 7 years ago

This is for an entity, not a tile entity, if that makes a difference?

Can you point to community discussion where this has "generally been decided" as we weren't aware of that? I'm not even sure what NBT data we could be assigning client-side, that probably can't be done completely in terms of the way our mod works, and I don't much fancy figuring it out for our 25+ entity classes.

AFAIK vanilla and Forge only call writeEntityToNBT() from server-side code, and it's only your mod/Waila which attempt to call it client-side.

Since you're aware that not every mod is expecting to have writeToNBT methods called client-side, I certainly think your mod (or Waila?) should surround that call with try/catch statements and fail silently there.