Wondiws98 Posted April 12, 2025 Report Posted April 12, 2025 Currently trying to make a content mod which allows the user to melt beeswax into ingots for storage and because i think it's cool. It is achieved by making usage of the metal smelting feature of the game. I've got everything working beautifully except for the fact that when the ingot mold shatters after being wetted, the "metal" texture of the shattered mold shape is invisible. Which is weird because the "metal" texture of the unshattered mold is rendered properly. I started digging in the source code of "BlockEntityIngotMold" and discovered that it essentially gets the "shattered" metal texture the same way as it does for the "unshattered" metal texture. Which is by getting the last part of the code of the smelted item which it assumes is the metal, in my case it's "beeswax". I had already included my beeswax texture in the folder where the code looks for the texture (game:block/metal/ingot/beeswax). When a mold shatters, this error is printed in client-debug: 12.4.2025 13:54:54 [Error] Exception thrown during OnTesselation() of block entity Vintagestory.GameContent.BlockEntityIngotMold@512028/116/512021. Block will probably not be rendered as intended. 12.4.2025 13:54:54 [Error] Exception: Value cannot be null. (Parameter 'Unable to find a texture for texture code 'metal' in shatteredmold. Giving up. Sorry.') at Vintagestory.Client.NoObf.ShapeTesselator.TesselateShapeElement(Int32 indexForLogging, MeshData meshdata, ShapeElement element, TesselationMetaData meta) in VintagestoryLib\Client\Render\Tesselation\ShapeTesselator.cs:line 400 at Vintagestory.Client.NoObf.ShapeTesselator.TesselateShapeElements(MeshData meshdata, ShapeElement[] elements, TesselationMetaData meta) in VintagestoryLib\Client\Render\Tesselation\ShapeTesselator.cs:line 309 at Vintagestory.Client.NoObf.ShapeTesselator.TesselateShape(Shape shapeBase, MeshData& modeldata, Vec3f wholeMeshRotation, Vec3f wholeMeshOffset, Single wholeMeshScale, TesselationMetaData meta) in VintagestoryLib\Client\Render\Tesselation\ShapeTesselator.cs:line 250 at Vintagestory.GameContent.BlockEntityIngotMold.EnsureShatteredMeshesLoaded_Patch2(BlockEntityIngotMold this) at Vintagestory.GameContent.BlockEntityIngotMold.OnTesselation_Patch2(BlockEntityIngotMold this, ITerrainMeshPool mesher, ITesselatorAPI tesselator) at Vintagestory.Client.NoObf.JsonTesselator.Tesselate(TCTCache vars) in VintagestoryLib\Client\Render\Tesselation\ChunkTesselator\JsonTesselator.cs:line 162 I started a code project just to debug and pin down the source of my problem and can confirm that the path and domain of the texture it uses is indeed "game:block/metal/ingot/beeswax". While digging deeper i discovered that the issue is related to when the "ShapeTesselator" tries to get the "TextureAtlasPosition" with the texture code "metal". The issue is driving me absolutely nuts and it got even weirder... It magically started working after right after while debugging i ran the command "/time csm 1" which was not intentional. So i created and new world and tried shattering an ingot mold full of beeswax and it was not rendering properly. So now i have a world where it is consistently rendered properly and another one where it's just is not, even after running the previously mentioned command. HOW is that even possible? HOW can it not be the same? Is there something i missed? What am i not taking into account? Is it possible that I've discovered an api bug? Thanks to anyone knowledgeable enough to point me in the right direction I've hit a brick wall.
Recommended Posts