ServerCore

ServerCore

384k Downloads

Crash when an entity without a world is constructed

parzivail opened this issue ยท 0 comments

commented

A player originally reported this as a bug to my mod. Like some other mods, we use "dummy" Entities that are not attached to any world for rendering purposes. In such a scenario, the level property of the Entity will be null during construction. A fix would be to add a null check to the level access on this line:

For reference, here is where my dummy Entity is constructed: https://github.com/Parzivail-Modding-Team/GalaxiesParzisStarWarsMod/blob/9a7941f456a37ab1730fefae660499187d97cdd4/src/main/java/com/parzivail/pswg/client/render/camera/CameraHelper.java#L16

Additionally, here is its constructor: https://github.com/Parzivail-Modding-Team/GalaxiesParzisStarWarsMod/blob/9a7941f456a37ab1730fefae660499187d97cdd4/src/main/java/com/parzivail/pswg/client/render/camera/MutableCameraEntity.java#L16

Here is the crash log reported to me:

---- Minecraft Crash Report ----
// I bet Cylons wouldn't have this problem.

Time: 2/22/22, 11:39 PM
Description: Unexpected error

java.lang.ExceptionInInitializerError
	at net.minecraft.GameRenderer.handler$zki000$renderWorldHead(GameRenderer.java:2532)
	at net.minecraft.GameRenderer.renderWorld(GameRenderer.java)
	at net.minecraft.GameRenderer.render(GameRenderer.java:811)
	at net.minecraft.MinecraftClient.render(MinecraftClient.java:1117)
	at net.minecraft.MinecraftClient.run(MinecraftClient.java:733)
	at net.minecraft.client.main.Main.main(Main.java:238)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:416)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
Caused by: java.lang.NullPointerException: Cannot read field "isClient" because "this.world" is null
	at net.minecraft.Entity.handler$zlf000$setupActivationStates(Entity.java:6017)
	at net.minecraft.Entity.<init>(Entity.java:288)
	at com.parzivail.pswg.client.render.camera.MutableCameraEntity.<init>(MutableCameraEntity.java:18)
	at com.parzivail.pswg.client.render.camera.CameraHelper.<clinit>(CameraHelper.java:16)
	... 13 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at net.minecraft.GameRenderer.handler$zki000$renderWorldHead(GameRenderer.java:2532)
	at net.minecraft.GameRenderer.renderWorld(GameRenderer.java)

-- Affected level --
Details:
	All players: 1 total; [ClientPlayerEntity['TheRanker'/283, l='ClientLevel', x=-107.50, y=68.00, z=-87.50]]
	Chunk stats: 961, 436
	Level dimension: minecraft:overworld
	Level spawn location: World: (-112,67,-80), Section: (at 0,3,0 in -7,4,-5; chunk contains blocks -112,-64,-80 to -97,319,-65), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,-64,-512 to -1,319,-1)
	Level time: 19 game time, 19 day time
	Server brand: fabric
	Server type: Integrated singleplayer server
Stacktrace:
	at net.minecraft.ClientWorld.addDetailsToCrashReport(ClientWorld.java:408)
	at net.minecraft.MinecraftClient.addDetailsToCrashReport(MinecraftClient.java:2402)
	at net.minecraft.MinecraftClient.run(MinecraftClient.java:757)
	at net.minecraft.client.main.Main.main(Main.java:238)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:416)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)

-- Last reload --
Details:
	Reload number: 1
	Reload reason: initial
	Finished: Yes
	Packs: Default, Fabric Mods

-- System Details --
Details:
	Minecraft Version: 1.18.1
	Minecraft Version ID: 1.18.1
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 17.0.1, Microsoft
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft
	Memory: 1124109312 bytes (1072 MiB) / 3164602368 bytes (3018 MiB) up to 4294967296 bytes (4096 MiB)
	CPUs: 8
	Processor Vendor: GenuineIntel
	Processor Name: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
	Identifier: Intel64 Family 6 Model 58 Stepping 9
	Microarchitecture: Ivy Bridge (Client)
	Frequency (GHz): 3.40
	Number of physical packages: 1
	Number of physical CPUs: 4
	Number of logical CPUs: 8
	Graphics card #0 name: NVIDIA GeForce GTX 750 Ti
	Graphics card #0 vendor: NVIDIA (0x10de)
	Graphics card #0 VRAM (MB): 2048.00
	Graphics card #0 deviceId: 0x1380
	Graphics card #0 versionInfo: DriverVersion=30.0.15.1123
	Memory slot #0 capacity (MB): 8192.00
	Memory slot #0 clockSpeed (GHz): 1.33
	Memory slot #0 type: DDR3
	Memory slot #1 capacity (MB): 4096.00
	Memory slot #1 clockSpeed (GHz): 1.33
	Memory slot #1 type: DDR3
	Memory slot #2 capacity (MB): 8192.00
	Memory slot #2 clockSpeed (GHz): 1.33
	Memory slot #2 type: DDR3
	Memory slot #3 capacity (MB): 4096.00
	Memory slot #3 clockSpeed (GHz): 1.33
	Memory slot #3 type: DDR3
	Virtual memory max (MB): 31025.58
	Virtual memory used (MB): 18126.77
	Swap memory total (MB): 6503.66
	Swap memory used (MB): 978.28
	JVM Flags: 4 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx4096m -Xms256m
	Fabric Mods: 
		cardinal-components-base: Cardinal Components API (base) 4.0.1
		cardinal-components-entity: Cardinal Components API (entities) 4.0.1
		cloth-basic-math: cloth-basic-math 0.6.0
		cloth-config: Cloth Config v6 6.1.48
		com_electronwill_night-config_core: core 3.6.4
		com_electronwill_night-config_toml: toml 3.6.4
		fabric: Fabric API 0.46.4+1.18
		fabric-api-base: Fabric API Base 0.4.2+d7c144a865
		fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.5.3+d7c144a865
		fabric-biome-api-v1: Fabric Biome API (v1) 6.0.2+d7c144a865
		fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.10+3ac43d9565
		fabric-command-api-v1: Fabric Command API (v1) 1.1.7+d7c144a865
		fabric-commands-v0: Fabric Commands (v0) 0.2.6+b4f4f6cd65
		fabric-containers-v0: Fabric Containers (v0) 0.1.19+d7c144a865
		fabric-content-registries-v0: Fabric Content Registries (v0) 0.4.8+d7c144a865
		fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.1.9+3ac43d9565
		fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.10+a1d9bbf565
		fabric-entity-events-v1: Fabric Entity Events (v1) 1.4.6+d7c144a865
		fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.4.17+d7c144a865
		fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.9+d7c144a865
		fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.11+d7c144a865
		fabric-item-api-v1: Fabric Item API (v1) 1.3.1+691a79b565
		fabric-item-groups-v0: Fabric Item Groups (v0) 0.3.6+3ac43d9565
		fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.9+d7c144a865
		fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.7+b4f4f6cd65
		fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 1.4.13+713c266865
		fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.0.9+d7c144a865
		fabric-mining-level-api-v1: Fabric Mining Level API (v1) 1.0.6+d7c144a865
		fabric-mining-levels-v0: Fabric Mining Levels (v0) 0.1.11+b4f4f6cd65
		fabric-models-v0: Fabric Models (v0) 0.3.4+d7c144a865
		fabric-networking-api-v1: Fabric Networking API (v1) 1.0.19+d7c144a865
		fabric-networking-v0: Fabric Networking (v0) 0.3.6+b4f4f6cd65
		fabric-object-builder-api-v1: Fabric Object Builder API (v1) 1.11.4+d7c144a865
		fabric-object-builders-v0: Fabric Object Builders (v0) 0.7.12+d7c144a865
		fabric-particles-v1: Fabric Particles (v1) 0.2.10+526dc1ac65
		fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.9.2+ad01bfbd65
		fabric-renderer-api-v1: Fabric Renderer API (v1) 0.4.11+b0b66fc365
		fabric-renderer-indigo: Fabric Renderer - Indigo 0.4.15+6825030165
		fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.10+b4f4f6cd65
		fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.5+d7c144a865
		fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 0.1.19+3ac43d9565
		fabric-rendering-v0: Fabric Rendering (v0) 1.1.12+b4f4f6cd65
		fabric-rendering-v1: Fabric Rendering (v1) 1.10.6+713c266865
		fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 1.0.2+d7c144a865
		fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.4.14+713c266865
		fabric-screen-api-v1: Fabric Screen API (v1) 1.0.8+d7c144a865
		fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.1.12+d7c144a865
		fabric-structure-api-v1: Fabric Structure API (v1) 2.1.3+d7c144a865
		fabric-tag-extensions-v0: Fabric Tag Extensions (v0) 1.2.8+d7c144a865
		fabric-textures-v0: Fabric Textures (v0) 1.0.10+3ac43d9565
		fabric-tool-attribute-api-v1: Fabric Tool Attribute API (v1) 1.3.8+fb3b57b465
		fabric-transfer-api-v1: Fabric Transfer API (v1) 1.5.9+d7c144a865
		fabricloader: Fabric Loader 0.13.3
		java: OpenJDK 64-Bit Server VM 17
		libzoomer: LibZoomer 0.3.0+1.17.1
		minecraft: Minecraft 1.18.1
		pswg: Galaxies: Parzi's Star Wars Mod 0.0.60+1.18.1
		servercore: ServerCore 1.2.7-1.18.1
	Launched Version: fabric-loader-0.13.3-1.18.1
	Backend library: LWJGL version 3.2.2 build 10
	Backend API: NVIDIA GeForce GTX 750 Ti/PCIe/SSE2 GL version 3.2.0 NVIDIA 511.23, NVIDIA Corporation
	Window size: 1680x1027
	GL Caps: Using framebuffer using OpenGL 3.2
	GL debug messages: 
	Using VBOs: Yes
	Is Modded: Definitely; Client brand changed to 'fabric'; Server brand changed to 'fabric'
	Type: Integrated Server (map_client.txt)
	Graphics mode: fancy
	Resource Packs: Fabric Mods
	Current Language: English (US)
	CPU: 8x Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
	Server Running: true
	Player Count: 1 / 8; [ServerPlayerEntity['TheRanker'/283, l='ServerLevel[New World]', x=-107.50, y=68.00, z=-87.50]]
	Data Packs: vanilla, Fabric Mods