Smarter Farmers (farmers replant)

Smarter Farmers (farmers replant)

24M Downloads

[Bug]: NullPointerException: Cannot invoke.

SirTwsted opened this issue ยท 1 comments

commented

### 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
๐Ÿฅฐ

commented

their issue. They shouldnt make such assumptions, ever. The player is clearly marked as nullable in themethod signature right here

Image