From 615df7378a429236fcdd5c64304e86c6cb40b2b6 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 16 Mar 2024 09:21:39 +0000 Subject: [PATCH] Add API function to remove node watch --- mods/ENTITIES/mcl_minecarts/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 48ca22215..bf51ba593 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -764,6 +764,15 @@ local function register_entity(entity_id, def) watches[#watches+1] = pos end + function cart:remove_node_watch(pos) + local new_watches = {} + for _,node_pos in ipairs(watches) do + if node_pos ~= post then + new_watches[#new_watches] = node_pos + end + end + staticdata.node_watches = new_watches + end function cart:on_step(dtime) -- TODO: move to _mcl_minecarts_on_step handler and on_enter handler for hopper minecart