MarkusBordihn / BOs-Easy-NPC

Create easily NPC for your world or for your mod.
Other
20 stars 8 forks source link

[Bug] Crash to launcher with Project MMO (1.20.1) #101

Closed dooblykid closed 7 months ago

dooblykid commented 8 months ago

Just spawned an NPC in on my server, when I right clicked it, it crashed my game to the launcher. The crash report has 3 suspected mods, this one, better 3rd person camera, and Project MMO. I could not begin to understand why these 3 mods together could cause this issue. Here's the log file from my client, the server log did not provide meaningful information. (Edit) After testing it still crashes without Better 3rd person so the issue is possibly with project mmo

crash-2024-03-15_23.40.10-client.txt

Also heres the debug log after enabling the easy-npc debug config. As before the server debug didnt output anything so its most likely client side. debug.log

MarkusBordihn commented 8 months ago

Thanks for the detailed report.

The crashes are causing by Project MMO, but should be easily fix on my side.

Project MMO is storing all entity data on a right click, I guess to add some additional data from their side. At the time of point they are try to storing the data, some data are not generated and so the game crashes.

I will add "empty" default values and additional checks for such cases to make sure no crashes happen, if any 3rd party mod tries to store and modify the Easy NPC data.

MarkusBordihn commented 8 months ago

I performed some tests. The former version seems to work fine like 1.18.2 but it seems that they have an issue with 1.20.1 where they are trying to read server side data from the client side which cause this crashes.

[12:42:39] [Render thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: Saving entity NBT
    Index: 9
    Listeners:
        0: HIGHEST
        1: ASM: class de.markusbordihn.easynpc.entity.EasyNPCEntityEvents handleEntityInteractHIGHEST(Lnet/minecraftforge/event/entity/player/PlayerInteractEvent$EntityInteract;)V
        2: HIGH
        3: ASM: class com.simibubi.create.content.contraptions.minecart.MinecartCouplingItem handleInteractionWithMinecart(Lnet/minecraftforge/event/entity/player/PlayerInteractEvent$EntityInteract;)V
        4: NORMAL
        5: ASM: class com.simibubi.create.content.equipment.extendoGrip.ExtendoGripItem notifyServerOfLongRangeInteractions(Lnet/minecraftforge/event/entity/player/PlayerInteractEvent$EntityInteract;)V
        6: ASM: class com.simibubi.create.content.contraptions.mounted.MinecartContraptionItem wrenchCanBeUsedToPickUpMinecartContraptions(Lnet/minecraftforge/event/entity/player/PlayerInteractEvent$EntityInteract;)V
        7: LOWEST
        8: ASM: class de.markusbordihn.easynpc.entity.EasyNPCEntityEvents handleEntityInteractLOWEST(Lnet/minecraftforge/event/entity/player/PlayerInteractEvent$EntityInteract;)V
        9: ASM: class harmonised.pmmo.events.EventHandler onEntityInteract(Lnet/minecraftforge/event/entity/player/PlayerInteractEvent$EntityInteract;)V
net.minecraft.ReportedException: Saving entity NBT

Reference: https://github.com/Caltinor/Project-MMO-2.0/issues/493

Nyfaria commented 8 months ago

This is not PMMOs fault. It is the fault of the Entity for not properly saving the data. The method PMMO calls is a client side method. Vanilla uses it to get a proper spawn egg when ctrl-middle clicking as well, and doing so on this same entity without PMMO installed will give you the same crash.

MarkusBordihn commented 8 months ago

@Nyfaria Thanks a lot for the feedback. Fair enough, lets say it more than unexpected for me that a mod requests to serialize and save all of the data of an NPC on a right click on the client side.

I will add additional checks to make sure that pure server-side data are not stored when requesting the data on the client side.