To replicate: Run or join a multiplayer game with WildAnimals enabled. Press F5 and click the drop down in the top left.
To troubleshoot: Follow the stacktrace or consider running in debug mode with a breakpoint close to where the NPE happens. Figure out what the null is and harden the code so the game won't crash - just log a useful error instead :-)
Results in the following crash log on the client:
12:55:47.947 [main] ERROR o.t.e.event.internal.EventSystemImpl - Failed to invoke event
java.lang.NullPointerException: null
at org.terasology.logic.behavior.nui.BehaviorEditorScreen$4.get(BehaviorEditorScreen.java:124)
at org.terasology.logic.behavior.nui.BehaviorEditorScreen$4.get(BehaviorEditorScreen.java:121)
at org.terasology.rendering.nui.widgets.UIDropdown.getOptions(UIDropdown.java:163)
at org.terasology.rendering.nui.widgets.UIDropdown$1.onMouseClick(UIDropdown.java:64)
at org.terasology.rendering.nui.internal.CanvasImpl.processMouseClick(CanvasImpl.java:243)
at org.terasology.rendering.nui.internal.NUIManagerInternal.mouseButtonEvent(NUIManagerInternal.java:606)
at org.terasology.rendering.nui.internal.NUIManagerInternalMethodAccess.invoke(Unknown Source)
at org.terasology.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:531)
at org.terasology.entitySystem.event.internal.EventSystemImpl.sendConsumableEvent(EventSystemImpl.java:301)
at org.terasology.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:280)
at org.terasology.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:204)
at org.terasology.input.InputSystem.send(InputSystem.java:496)
at org.terasology.input.InputSystem.sendMouseEvent(InputSystem.java:469)
at org.terasology.input.InputSystem.processMouseButtonInput(InputSystem.java:212)
at org.terasology.input.InputSystem.processMouseInput(InputSystem.java:191)
at org.terasology.input.InputSystem.update(InputSystem.java:134)
at org.terasology.engine.modes.StateIngame.handleInput(StateIngame.java:192)
at org.terasology.engine.subsystem.lwjgl.LwjglInput.postUpdate(LwjglInput.java:55)
at org.terasology.engine.TerasologyEngine.tick(TerasologyEngine.java:467)
at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:421)
at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:397)
at org.terasology.engine.Terasology.main(Terasology.java:156)
12:55:47.960 [main] ERROR o.terasology.engine.TerasologyEngine - Uncaught exception, attempting clean game shutdown
Still present as per the March 2020 play test
Found that this is still present as of July 16 2020. Attempted to apply the fix outlined in PR by kaen for #4076 and found that this issue persists even after.
Seems like the context object lacks the BehaviorSystem class when using a client in multiplayer, so when the BehaviorEditor is initialized, it gets a null behaviorSystem field. This causes the error when you go to get Interpreters from the behaviorSystem
Adding some more information here why #4088 got closed and what another take on this issue might be.
Option 1: If the behavior editor screen needs to interact with the code running as authority then the editor should probably only be availabale on the authority system. We could "fix" the crash by at least checking whether the injected system is non-null, and gracefully fail otherwise. We could evene show a meaningful message in that case stating that in order to use the behavior editor you'll need to be running as the host.
This could also be a short-term solution, even if _Option 2_ is considered.
Option 2: If the behvior editor can work with minimal to none interaction with code that actually needs to be run on the authority system the system coude could be split up into _authority_ and _client_ systems. This would involve a coordination overhead for sending events around between client and system, but would potentially allow a clean implemenation of the behavior editor based on the client system. @AndyTechGuy did recently figure out how to enable things for multiplayer, introducing server and client events and replicating data.
@IsaiahBlanks I hope you're still up for the challenge here, _Option 1_ would definitely make for a better experience!
@skaldarnar Definitely still up to the challenge! I would be interested in implementing Option 2, but for now I can set up option 1 as a temporary fix/ permanent fix if it turns out to be the more graceful solution
馃憤 let's start with _Option 1_ and make it not crash anymore. You could straight on continue with _Option 2_ as follow up (in which case I'd recommend a chat with @AndyTechGuy and do some conceptual work on how the system, events, and components should be structured before diving into coding) 馃槈