Wilyicaro / BetterFurnacesReforged

8 stars 14 forks source link

[Bug] Color Upgrade Game Crash/Corrupted #158

Open muggleorwizard opened 5 months ago

muggleorwizard commented 5 months ago

Better Furnaces Reforged Version

1.20.1-1.1.3

Mod Loader Version

Forge 47.2.20

Bug/Glitch Occurrence Context

A bug report from a user playing my modpack: They tried putting the "Color upgrade" into the "Ultimate Forge" which crashed their game.

Crash Report

https://pastebin.com/csUAKWbj

What happened wrong?

Game crashed and world was corrupted.

KevinMoonglow commented 1 month ago

After encountering this myself, I've worked out that this happens because it's not checking for null before trying to read the NBT from the color upgrade.

This can happen if you cheat in the item with REI and insert it directly without it entering the user's inventory, but it can also happen in survival if you autocraft the color upgrade and insert it with something like a deployer from Create.

This one is pretty nasty because it renders the world unusable. Each time you try to load back it, it immediately tries to render the furnace and crashes the game again. And with the right mods, it's technically possible to trigger this in survival. To recover the world if you didn't have a recent backup, one would have to either use an external editor to remove/edit the offending furnace, or load the world without Better furnaces, which would delete all items and blocks from the mod.

Here's the relevant portion of the stack trace from my own Fabric 1.20.1 modpack:

java.lang.NullPointerException: Cannot invoke "net.minecraft.class_2487.method_10550(String)" because "nbt" is null
    at wily.betterfurnaces.blockentity.SmeltingBlockEntity.getColor(SmeltingBlockEntity.java:585)
    at wily.betterfurnaces.client.renderer.FurnaceRenderer.render(FurnaceRenderer.java:39)
    at wily.betterfurnaces.client.renderer.FurnaceRenderer.method_3569(FurnaceRenderer.java:19)
    at net.minecraft.class_824.method_23079(class_824.java:90)
    at net.minecraft.class_824.method_23081(class_824.java:79)
    at net.minecraft.class_824.method_3554(class_824.java:104)
    at net.minecraft.class_824.method_3555(class_824.java:79)
    at me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.renderBlockEntity(SodiumWorldRenderer.java:367)
    at me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.redirect$doc000$iris$addToList(SodiumWorldRenderer.java:583)
    at me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.renderBlockEntities(SodiumWorldRenderer.java:306)
    at me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.redirect$ibi000$valkyrienskies$renderShipBlockEntities(SodiumWorldRenderer.java:1596)
    at me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.renderBlockEntities(SodiumWorldRenderer.java:269)
    at net.minecraft.class_761.handler$hbh000$sodium$onRenderBlockEntities(class_761.java:22099)
    at net.minecraft.class_761.method_22710(class_761.java:1372)
    at net.minecraft.class_757.method_3188(class_757.java:1110)
    at net.minecraft.class_757.method_3192(class_757.java:880)
    at net.minecraft.class_310.method_1523(class_310.java:1219)
    at net.minecraft.class_310.method_1514(class_310.java:802)
    at net.minecraft.client.main.Main.main(Main.java:250)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
    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:100)
    at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129)
    at org.prismlauncher.EntryPoint.main(EntryPoint.java:70)