Farming hud improvements
Add coins per hour.
Fix the mouse not unlocking when the option is turned off.
Refactor item price calculations.
Farming Hud
Conflicts with #683. Will wait until after #683 is merged.
Add cultivating counter and use normal counter as fallback.
Fix the merge conflict on #683’s side, so all good to review now.
Got a crash with this that I can't reproduce, happened right after joining my garden:
[15:15:00] [Render thread/ERROR]: Unreported exception thrown!
java.lang.ExceptionInInitializerError: null
at de.hysky.skyblocker.skyblock.garden.LowerSensitivity.lambda$init$0(LowerSensitivity.java:22) ~[skyblocker-1.20.2+1.20.6.jar:?]
at net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents.lambda$static$6(ClientTickEvents.java:63) ~[fabric-lifecycle-events-v1-2.3.4+c5fc38b3b0-b28198e202c52719.jar:?]
at MC/net.minecraft.client.world.ClientWorld.handler$bai000$fabric-lifecycle-events-v1$tickWorldAfterBlockEntities(ClientWorld.java:4108) ~[client-intermediary.jar:?]
at MC/net.minecraft.client.world.ClientWorld.tickEntities(ClientWorld.java:266) ~[client-intermediary.jar:?]
at MC/net.minecraft.client.MinecraftClient.tick(MinecraftClient.java:2007) ~[client-intermediary.jar:?]
at MC/net.minecraft.client.MinecraftClient.render(MinecraftClient.java:1281) ~[client-intermediary.jar:?]
at MC/net.minecraft.client.MinecraftClient.run(MinecraftClient.java:888) [client-intermediary.jar:?]
at net.minecraft.client.main.Main.main(Main.java:265) [client-intermediary.jar:?]
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) [fabric-loader-0.15.11.jar:?]
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.15.11.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.15.11.jar:?]
at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:100) [NewLaunch.jar:?]
at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) [NewLaunch.jar:?]
at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) [NewLaunch.jar:?]
Caused by: java.lang.NullPointerException: Cannot read field "text" because "de.hysky.skyblocker.skyblock.garden.FarmingHud.counterType" is null
at de.hysky.skyblocker.skyblock.garden.FarmingHud.counterText(FarmingHud.java:111) ~[skyblocker-1.20.2+1.20.6.jar:?]
at de.hysky.skyblocker.skyblock.garden.FarmingHudWidget.updateContent(FarmingHudWidget.java:63) ~[skyblocker-1.20.2+1.20.6.jar:?]
at de.hysky.skyblocker.skyblock.tabhud.widget.Widget.update(Widget.java:53) ~[skyblocker-1.20.2+1.20.6.jar:?]
at de.hysky.skyblocker.skyblock.garden.FarmingHudWidget.<init>(FarmingHudWidget.java:55) ~[skyblocker-1.20.2+1.20.6.jar:?]
at de.hysky.skyblocker.skyblock.garden.FarmingHudWidget.<clinit>(FarmingHudWidget.java:48) ~[skyblocker-1.20.2+1.20.6.jar:?]
... 14 more
---- Minecraft Crash Report ----
// Don't do that.
Time: 2024-05-24 15:15:01
Description: Unexpected error
java.lang.ExceptionInInitializerError
at de.hysky.skyblocker.skyblock.garden.LowerSensitivity.lambda$init$0(LowerSensitivity.java:22)
at net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents.lambda$static$6(ClientTickEvents.java:63)
at MC//net.minecraft.client.world.ClientWorld.handler$bai000$fabric-lifecycle-events-v1$tickWorldAfterBlockEntities(ClientWorld.java:4108)
at MC//net.minecraft.client.world.ClientWorld.tickEntities(ClientWorld.java:266)
at MC//net.minecraft.client.MinecraftClient.tick(MinecraftClient.java:2007)
at MC//net.minecraft.client.MinecraftClient.render(MinecraftClient.java:1281)
at MC//net.minecraft.client.MinecraftClient.run(MinecraftClient.java:888)
at net.minecraft.client.main.Main.main(Main.java:265)
at app//net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
at app//net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
at app//net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
at app//org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:100)
at app//org.prismlauncher.EntryPoint.listen(EntryPoint.java:129)
at app//org.prismlauncher.EntryPoint.main(EntryPoint.java:70)
Caused by: java.lang.NullPointerException: Cannot read field "text" because "de.hysky.skyblocker.skyblock.garden.FarmingHud.counterType" is null
at de.hysky.skyblocker.skyblock.garden.FarmingHud.counterText(FarmingHud.java:111)
at de.hysky.skyblocker.skyblock.garden.FarmingHudWidget.updateContent(FarmingHudWidget.java:63)
at de.hysky.skyblocker.skyblock.tabhud.widget.Widget.update(Widget.java:53)
at de.hysky.skyblocker.skyblock.garden.FarmingHudWidget.<init>(FarmingHudWidget.java:55)
at de.hysky.skyblocker.skyblock.garden.FarmingHudWidget.<clinit>(FarmingHudWidget.java:48)
... 14 more
All fixed up, including the crash.
Not something added by this PR but perhaps you could fix it too:
Farming with low FPS causes the counters to be all messed up
This can probably be fixed by updating counters on another event such as
ClientTickEvents.END_CLIENT_TICK and using HudRenderEvents.AFTER_MAIN_HUD to only render the widget from the updated values, but I haven't tested out anything and might be completely wrong.
I tried switching over to ClientTickEvents.END_CLIENT_TICK but since it updates slower, block per second shows 21. I tried reproducing what you're experiencing but couldn't.
Untested.
Tested btw.
Farming Hud
Just found out that the cultivating counter disappears after 100m. That got me thinking, would it be possible to calculate crops/min using bps (or blocks per min if necessary) and multiplying that by average drops per crop * (1+(fortune/100)) and then save the amount ever farmed somewhere?
Just found out that the cultivating counter disappears after 100m. That got me thinking, would it be possible to calculate crops/min using bps (or blocks per min if necessary) and multiplying that by average drops per crop * (1+(fortune/100)) and then save the amount ever farmed somewhere?
is there a need to? It is still here, just not displayed
is there a need to? It is still here, just not displayed
I checked it out and indeed, the nbt is still there after reaching lvl X. But the current cultivating counter implementation depends on the lore, so it would necessitate a change regardless.
All done.