Tr4nter / auto-plant-crop

MIT License
2 stars 1 forks source link

Game Crash While in Main Menu #18

Closed m-sarabi closed 5 months ago

m-sarabi commented 5 months ago

summary

I changed the autoplantcropsDelay to a big number (to effectively disable the replanting as I only wanted the cancelBreakUnlessAged functionality, then quit the single-player game, while in the Main Title Menu (the Minecraft logo, not paused) a few minutes later game crashed (it couldn't replant because the game was not loaded anymore)

The issue

The game crashes while in the Main Title Menu and waiting to replant.

Steps to reproduce

Crash log

[20:40:27] [Render thread/ERROR]: Unreported exception thrown!
java.lang.NullPointerException: Cannot invoke "net.minecraft.class_746.method_31548()" because "client.field_1724" is null
    at tr4nt.autoplantcrops.Utils.Utils.switchToItem(Utils.java:55) ~[auto-plant-crops-1.1.8.jar:?]
    at tr4nt.autoplantcrops.scheduler.Ticker.lambda$onStartTick$0(Ticker.java:38) ~[auto-plant-crops-1.1.8.jar:?]
    at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
    at tr4nt.autoplantcrops.scheduler.Ticker.onStartTick(Ticker.java:25) ~[auto-plant-crops-1.1.8.jar:?]
    at net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents.lambda$static$0(ClientTickEvents.java:34) ~[fabric-lifecycle-events-v1-2.2.3+eabbae364f-a9a67aeb5a6be7d3.jar:?]
    at net.minecraft.class_310.handler$blp000$fabric-lifecycle-events-v1$onStartTick(class_310.java:8772) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1574(class_310.java) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1523(class_310.java:1289) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1514(class_310.java:888) ~[client-intermediary.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:265) ~[fabric-loader-0.15.6-1.20.4.jar:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.15.6.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.15.6.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.15.6.jar:?]
[20:40:28] [Thread-10/INFO]: Saving

Related feature request (Please)

Add the functionality of cancelBreakUnlessAged to not be affected by toggling the mod on/off so we can use only that feature if needed.

Thanks for creating this great mod.

Tr4nter commented 5 months ago

Fixed, and added autoReplant option, you can turn this off + every other options except cancelBreakUnlessAged if you want the desired result

new version download link https://modrinth.com/mod/auto-plant-crops/version/1.1.9