[CRASH] Crash when opening a chest that is immediately replaced with air
#225 创建于 2026年8月11日
仓库指标
- 星标
- (34 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Loader and its version
0.19.3
OptiGUI version
2.3.0-beta.10+26.2
Steps to reproduce
Steps to reproduce
- Install Minecraft 26.2 Fabric.
- Install OptiGUI 2.3.0-beta.10+26.2.
- Install the HAUL datapack by Jake.
- Place a chest.
- Pick up the chest by shift-right click while not holding any item (including in offhand).
- The datapack immediately removes the chest block and puts the chest into the player's inventory, crashing the game when OptiGUI is installed
Expected behavior OptiGUI should handle the situation gracefully when the block associated with an open container is no longer a chest.
For example, if the block state is minecraft:air, the large-chest selector could simply treat it as not being a large chest rather than attempting to read ChestType.
Actual behavior
OptiGUI calls getValue(ChestType) on an minecraft:air block state, which does not contain the type property, resulting in an IllegalArgumentException and a client crash.
Game logs
java.lang.IllegalArgumentException: Cannot get property EnumProperty{name=type, clazz=class net.minecraft.world.level.block.state.properties.ChestType, values=[SINGLE, LEFT, RIGHT]} as it does not exist in Block{minecraft:air} at net.minecraft.world.level.block.state.StateHolder.getValue(StateHolder.java:102)
at opekope2.optigui.internal.selector.LargeChestSelector.isChestLarge(ChestSelectors.kt:23)
at opekop e2.optigui.internal.selector.LargeChestSelector$createFilter$1.invoke(ChestSelectors.kt:13)
at opekope2.optigui.filter.PreProcessorFilter.evaluate(PreProcessorFilter.kt:21)
at opekope2.optigui.filter.ConjunctionFilter.evaluate(ConjunctionFilter.kt:21)
at opekope2.optigui.filter.PostProcessorFilter.evaluate(PostProcessorFilter.kt:33)
at opekope2.optigui.filter.FirstMatchFilter.evaluate(FirstMatchFilter.kt:22)
at opekope2.optigui.internal.filter.ContainerMapFilter.evaluate(ContainerMapFilter.kt:10)
at opekope2.optigui.internal.TextureReplacer.replaceTexture(TextureReplacer.kt:117)
at net.minecraft.client.gui.GuiGraphicsExtractor.blit(GuiGraphicsExtractor.java)
at net.minecraft.client.gui.screens.inventory.ContainerScreen.extractBackground(ContainerScreen.java:26)
Anything else
OptiGUI crashes the client when rendering a chest inventory if the physical chest block is immediately removed/replaced with air by a server-side datapack.
The datapack involved is HAUL by Jake, which allows players to pick up chests and barrels. When a chest is picked up, the datapack removes the chest block from the world and places the chest into the player's inventory.
Modrinth: https://modrinth.com/datapack/haul-data-pack
This creates a situation where the chest inventory screen can still be open/rendering while the block at the chest's position is already minecraft:air.
OptiGUI's LargeChestSelector attempts to read the ChestType property from that block state, causing an IllegalArgumentException because minecraft:air does not have the type property.
It would be helpful if LargeChestSelector checked that the block state actually has the ChestType property (or otherwise verified that the block is a chest) before calling getValue(ChestType).
Thank you!