From bf3b98021fa6f780da90699b636ab2062c025eec Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 28 Dec 2024 16:35:48 -0600 Subject: [PATCH] Fix conversion of cart inventories to mod storage without duplicating items --- mods/ENTITIES/mcl_minecarts/carts.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mods/ENTITIES/mcl_minecarts/carts.lua b/mods/ENTITIES/mcl_minecarts/carts.lua index 64a862b8a..fb3b7f995 100644 --- a/mods/ENTITIES/mcl_minecarts/carts.lua +++ b/mods/ENTITIES/mcl_minecarts/carts.lua @@ -178,6 +178,13 @@ function DEFAULT_CART_DEF:on_activate(staticdata, dtime_s) local data = minetest.deserialize(staticdata) or {} if not data.uuid then data.uuid = mcl_util.assign_uuid(self.object) + + if data._items then + data.inventory = data._items + data._items = nil + data._inv_id = nil + data._inv_size = nil + end end self._seq = data.seq or 1 @@ -283,6 +290,9 @@ function DEFAULT_CART_DEF:on_step(dtime) staticdata = make_staticdata() self._staticdata = staticdata end + if self._items then + self._items = nil + end -- Update entity position local pos = mod.get_cart_position(staticdata)