Armor Statues [Forge & Fabric]

Armor Statues [Forge & Fabric]

1M Downloads

[Crash]: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_3966.method_17784()" because "entityHitResult" is null

Luke100000 opened this issue ยท 2 comments

commented

Mod Loader (Required)

Fabric

Minecraft Version (Required)

1.19.2

Mod Version (Required)

4.0.2

Notes (Required)

When trying to interact with an Immersive Paintings Entity (https://github.com/Luke100000/ImmersivePaintings) a suppressed error is thrown, preventing further actions:

java.lang.NullPointerException: Cannot invoke "net.minecraft.class_3966.method_17784()" because "entityHitResult" is null
	at fuzs.armorstatues.ArmorStatuesFabric.lambda$registerHandlers$0(ArmorStatuesFabric.java:30) ~[ArmorStatues-v4.0.2-1.19.2-Fabric.jar:?]
	at net.fabricmc.fabric.api.event.player.UseEntityCallback.lambda$static$0(UseEntityCallback.java:57) ~[fabric-events-interaction-v0-0.4+562bff6e90-12406b410890a6fe.jar:?]
	at net.minecraft.class_3244$1.handler$cln000$onPlayerInteractEntity(class_3244.java:1815) ~[client-intermediary.jar:?]
	at net.minecraft.class_3244$1.method_34219(class_3244.java) ~[client-intermediary.jar:?]
	at net.minecraft.class_2824$class_5909.method_34213(class_2824.java:116) ~[client-intermediary.jar:?]
	at net.minecraft.class_2824.method_34209(class_2824.java:66) ~[client-intermediary.jar:?]
	at net.minecraft.class_3244.method_12062(class_3244.java:1668) ~[client-intermediary.jar:?]
	at net.minecraft.class_2824.method_12251(class_2824.java:53) ~[client-intermediary.jar:?]
	at net.minecraft.class_2824.method_11054(class_2824.java:13) ~[client-intermediary.jar:?]
	at net.minecraft.class_2600.method_11072(class_2600.java:22) ~[client-intermediary.jar:?]
	at net.minecraft.class_3738.run(class_3738.java:18) ~[client-intermediary.jar:?]
	at net.minecraft.class_1255.method_18859(class_1255.java:157) ~[client-intermediary.jar:?]
	at net.minecraft.class_4093.method_18859(class_4093.java:23) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:776) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:159) ~[client-intermediary.jar:?]
	at net.minecraft.class_1255.method_16075(class_1255.java:131) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:758) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:752) ~[client-intermediary.jar:?]
	at net.minecraft.class_1255.method_18857(class_1255.java:140) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:737) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:669) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:257) ~[client-intermediary.jar:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]

Happening here:
https://github.com/Fuzss/armorstatues/blob/1.19/Fabric/src/main/java/fuzs/armorstatues/ArmorStatuesFabric.java

It seems entityHitResult can indeed be null. I was not able to spot an issue on my side, and I don't think a null check would hurt anyways.

UPDATE: player just appended that it happens with other entities too, it is not directly related to the painting. I assume some mod produces nulls.

commented

Thanks for the report!
This is an issue with the latest version of Fabric Api (which is 0.72.0+1.19.2).
The hitResult could indeed never be null in previous versions, see here: FabricMC/fabric#1260
But this is changed now due to this commit: FabricMC/fabric@3baeb27
So yeah, I'll add a null check.

commented

Fixed in v4.0.3.