MiniHUD Update Port

MiniHUD Update Port

1.4k Downloads

1.21.4: Crash with InvPreviewBGColor on a wandering trader

MeeniMc opened this issue ยท 4 comments

commented

New option "VillagerInventoryPreviewBGColor" can crash the game when pointing at a wandering trader.

  1. Activate option "InventoryPreviewEnabled"
  2. Activate option "VillagerInventoryPreviewBGColor"
  3. Hold key "Inventory Preview Key"
  4. point at a Wandering Trader

Same scenario with BGColor disabled works as expected.

ime: 2025-03-02 23:54:32
Description: Unexpected error

java.lang.NullPointerException: Cannot invoke "net.minecraft.class_3852.equals(Object)" because "profession" is null
	at knot//fi.dy.masa.malilib.render.RenderUtils.getVillagerColor(RenderUtils.java:1712)
	at knot//fi.dy.masa.malilib.render.RenderUtils.setVillagerBackgroundTintColor(RenderUtils.java:1697)
	at knot//fi.dy.masa.malilib.render.RenderUtils.setVillagerBackgroundTintColor(RenderUtils.java:1690)
	at knot//fi.dy.masa.malilib.render.InventoryOverlayScreen.method_25394(InventoryOverlayScreen.java:216)
	at knot//fi.dy.masa.malilib.interfaces.IInventoryOverlayHandler.renderInventoryOverlay(IInventoryOverlayHandler.java:86)
	at knot//fi.dy.masa.minihud.renderer.InventoryOverlayHandler.getRenderContext(InventoryOverlayHandler.java:125)
	at knot//fi.dy.masa.minihud.event.RenderHandler.onRenderGameOverlayPostAdvanced(RenderHandler.java:206)
	at knot//fi.dy.masa.malilib.event.RenderEventHandler.onRenderGameOverlayPost(RenderEventHandler.java:108)
	at net.minecraft.class_329.handler$ghn000$malilib$onGameOverlayPost(fi/dy/masa/malilib/mixin/MixinInGameHud.java [mixins.malilib.json]:33)
	at knot//net.minecraft.class_329.method_1753$mixinextras$wrapped$222(class_329.java:235)
	at knot//net.minecraft.class_329.mixinextras$bridge$method_1753$mixinextras$wrapped$222$223(class_329.java)
	at net.minecraft.class_329.wrapMethod$fgb000$iris$handleHudHidingScreens(net/irisshaders/iris/mixin/gui/MixinGui.java [mixins.iris.json]:44)
	at knot//net.minecraft.class_329.method_1753(class_329.java)
	at knot//net.minecraft.class_757.mixinextras$bridge$method_1753$138(class_757.java)
	at net.minecraft.class_757.md97375b$immediatelyfast$lambda$hudBatching$0$0(net/raphimc/immediatelyfast/injection/mixins/hud_batching/MixinGameRenderer.java [immediatelyfast-common.mixins.json]:37)
	at knot//net.raphimc.immediatelyfast.feature.batching.BatchingBuffers.runBatched(BatchingBuffers.java:56)
	at net.minecraft.class_757.wrapOperation$fbp000$immediatelyfast$hudBatching(net/raphimc/immediatelyfast/injection/mixins/hud_batching/MixinGameRenderer.java [immediatelyfast-common.mixins.json]:37)
	at knot//net.minecraft.class_757.method_3192(class_757.java:533)
	at knot//net.minecraft.class_310.method_1523(class_310.java:1341)
	at knot//net.minecraft.class_310.method_1514(class_310.java:922)
	at knot//net.minecraft.client.main.Main.main(Main.java:267)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:105)
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129)
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:70)

commented

Are you using 1.21.4 or 1.21 ?

commented

[โœ”] malilib-fabric-1.21.4-0.23.2
[โœ”] minihud-fabric-1.21.4-0.34.4

full log if you want to see
https://mclo.gs/3kYUIC9

commented

It's a fairly simple fix. I'll add it to the repo, and also added an extra check for if the setting is enabled. It doesn't happen with the feature disabled, correct ?

It really was just a silly feature that I've added since I've added the trades to the Inventory Preview. The code was already in place for doing it, except I just needed to add the function to match the profession to a color afterwards. It's really not too 'useful' of a feature, but I just figured it's just a little extra thing.

commented

I would suggest that if this feature is important to you, download the build artifacts:
https://github.com/sakura-ryoko/malilib/actions/runs/13624905064/job/38080354261

If it was a more critical fix ... I'd push an update. The offending code is under MaLiLib, not MiniHUD.