Reply To: Broken Loot Chests

Home Forums MeseCraft Discussion Support Broken Loot Chests Reply To: Broken Loot Chests

    • Member

    Where I’m at so far…

    I think the problem is the Geomoria mod, as included in Mesecraft.  I’m not 100% positive, but I think it’s creating chests using a voxel manipulator without calling the chest constructor.  This leaves the node without associated inventory meta data.  I have no idea what code is supposed to fill the chest with loot, but I suspect that it chokes on the missing inventory meta.  Perhaps that code (if I can find it) could also use a patch (might be the simpler fix, actually).

    (I’m not playing on a “potato”, but not that far off.  If I’m wrong about the cause of the bug, it could be some race condition brought about by limited RAM or the speed of my aging processor.)


    “The purpose of [VoxelManip] is for fast, low-level, bulk access to reading and writing Map content. As such, setting map nodes through VoxelManip will lack many of the higher level features and concepts you may be used to with other methods of setting nodes. For example, nodes will not have their construction and destruction callbacks run, and no rollback information is logged.”
    From the intro at —

    • init.lua:33 – defines local treasure_chest = ‘default:chest’
    • plans.lua defines geomoria_mod.plans which specifies where “treasure” might be located
    • mapgen.lua:63 creates local vm, emin, emax = minetest.get_mapgen_object(“voxelmanip”)
    • mapgen.lua:71 creates local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
    • mapgen.lua:128 calls geomorph, which reads and implements the plans.  It passes area as a parameter, along with a table named data.
      local write, wetness = geomoria_mod.geomorph(minp, maxp, data, p2data, area, node, heightmap)
    • geomorph.lua:221 Decides randomly whether to create treasure, based on the value in the plan
    • geomorph.lua:225 Takes a detour back to init.lua for geomoria_mod.treasure_chest_hook(…) — this should be a no-op, but might get froggy if another mod uses this hook.  I don’t think so.  A search doesn’t show any other references to it in the mesecraft folder.
    • geomorph.lua:228 records an area:index in the table named data (created in mapgen.lua) pointing to the content id of treasure_chest (aka default:chest; see mapgen.lua:29-38 for “node”)
    • mapgen.lua:188 writes changes from data to the vm– vm:set_data(data)

    I’m speculating that stepping through the data table after mapgen.lua:188 looking for chests and calling  the constructor might solve this.  minetest.registered_nodes[“default:chest”].on_construct(pos)

    On second thought, the call to geomorph could carry another table with locations of nodes that need their constructors called.  That might provide solutions to other node types besides chests if further bugs are found, and would be a lot more efficient than iterating through the entirety of the data table looking for the odd chest here or there.

    Continuing my exploration…