
[Bug]: NullPointerException: Cannot invoke.
SirTwsted opened this issue ยท 1 comments
### Forge/Neoforge version:
21.1.164
### Minecraft version:
1.21.1
### Mod version:
smarterfarmers-1.21-2.2.2-neoforge.jar
### Java version:
21.0.3
### [Code-Crash Info]:
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.player.Player.getLuck()" because the return value of "net.neoforged.neoforge.event.level.BlockEvent$BlockToolModificationEvent.getPlayer()" is null at de.ellpeck.actuallyadditions.mod.items.Worm.onHoe(Worm.java:83)
### Additional Information:
Actually Additions mod is trying to access the player's luck (getLuck()) during a block tool modification event (probably tilling soil with a hoe or similar action).
The code assumes there is always a player involved, but in this case, getPlayer() returned null (no player present), leading to the crash.
In the stack trace:
The event is triggered by the Smarter Farmers mod, which lets villagers farm autonomously.
A villager (not a player) tried to use a hoe (possibly the Actually Additions "Worm" item), triggering Actually Additions code that expects a player, not a villager.
Since villagers are not players, getPlayer() is null, causing the crash.
Which Mods Are Involved?
๐ 1. - Actually Additions (actuallyadditions-1.3.18+mc1.21.1.jar)
๐ 2. - Smarter Farmers (smarterfarmers-1.21-2.2.2-neoforge.jar)
Pastebin Crash Report: (has a 1-year expiration date)
๐๐๐
https://pastebin.com/FExwFgQW
I also already posted an "Issue" with Actually Additions Mod Developers.
So both of your groups know whats going on.
Located here:
๐๐๐
Ellpeck/ActuallyAdditions#1489
Thank you
๐ฅฐ