Balm (Forge Edition)

Balm (Forge Edition)

24M Downloads

Use Fabric ModelResolver or ModelModifier.OnLoad for loadDynamicModel

BlayTheNinth opened this issue ยท 1 comments

commented

Currently, the fabric_enableGetOrLoadModelGuard may result in a crash (so far only observed with Sodium, Indium and Quilt) because AbstractCachedDynamicModel uses the ModelBakery to resolve base models.

It should be possible to instead use ModelResolver or ModelModifier.OnLoad to supply a custom resolver to AbstractCachedDynamicModel so it can use the context that Fabric wants us to use.

Blocks TwelveIterationMods/CookingForBlockheads#679

commented

I believe I got a crash of this but not using Quilt. If you need more information let me know

Fabric Loader: 0.15.3
Minecraft Version: 1.20.1
Mod Version : 7.2.1

---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.

Time: 2024-01-11 15:24:21
Description: Encountered exception while building chunk meshes

java.lang.IllegalStateException: ModelLoader#getOrLoadModel called from a ModelResolver or ModelModifier.OnBake instance. This is not allowed to prevent errors during model loading. Use getOrLoadModel from the context instead.
	at net.minecraft.class_1088.handler$gej000$fabric-model-loading-api-v1$fabric_preventNestedGetOrLoadModel(class_1088.java:4134)
	at net.minecraft.class_1088.method_4726(class_1088.java)
	at net.blay09.mods.balm.fabric.client.rendering.FabricBalmModels.getUnbakedModelOrMissing(FabricBalmModels.java:145)
	at net.blay09.mods.balm.common.client.rendering.AbstractCachedDynamicModel.method_4707(AbstractCachedDynamicModel.java:82)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer.getGeometry(BlockRenderer.java:90)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer.renderModel(BlockRenderer.java:72)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask.redirect$hco000$indium$onRenderBlock(ChunkBuilderMeshingTask.java:1045)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask.execute(ChunkBuilderMeshingTask.java:103)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask.execute(ChunkBuilderMeshingTask.java:39)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.executor.ChunkJobTyped.execute(ChunkJobTyped.java:44)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.executor.ChunkBuilder$WorkerRunnable.run(ChunkBuilder.java:186)
	at java.base/java.lang.Thread.run(Thread.java:833)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at net.minecraft.class_1088.handler$gej000$fabric-model-loading-api-v1$fabric_preventNestedGetOrLoadModel(class_1088.java:4134)
	at net.minecraft.class_1088.method_4726(class_1088.java)
	at net.blay09.mods.balm.fabric.client.rendering.FabricBalmModels.getUnbakedModelOrMissing(FabricBalmModels.java:145)
	at net.blay09.mods.balm.common.client.rendering.AbstractCachedDynamicModel.method_4707(AbstractCachedDynamicModel.java:82)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer.getGeometry(BlockRenderer.java:90)

-- Block being rendered --
Details:
	Block: Block{cookingforblockheads:fridge}[color=white,facing=west,flipped=false,has_color=false,ice_unit=false,model=large_upper,preservation_chamber=false]
	Block location: World: (8393,75,-3668), Section: (at 9,11,12 in 524,4,-230; chunk contains blocks 8384,-64,-3680 to 8399,319,-3665), Region: (16,-8; contains chunks 512,-256 to 543,-225, blocks 8192,-64,-4096 to 8703,319,-3585)
	Chunk section: RenderSection at chunk (524, 4, -230) from (8384, 64, -3680) to (8399, 79, -3665)
	Render context volume: class_3341{minX=8382, minY=62, minZ=-3682, maxX=8401, maxY=81, maxZ=-3663}
Stacktrace:
	at me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask.execute(ChunkBuilderMeshingTask.java:103)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask.execute(ChunkBuilderMeshingTask.java:39)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.executor.ChunkJobTyped.execute(ChunkJobTyped.java:44)
	at me.jellysquid.mods.sodium.client.render.chunk.compile.executor.ChunkBuilder$WorkerRunnable.run(ChunkBuilder.java:186)
	at java.base/java.lang.Thread.run(Thread.java:833)