From 224bbff56bc6231f005fe4aae3226a3a8fbb025f Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 15 Oct 2022 00:37:29 +0200 Subject: [PATCH] Open minecart inv with regular rightclick --- mods/ENTITIES/mcl_entity_invs/init.lua | 6 +++--- mods/ENTITIES/mcl_minecarts/init.lua | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_entity_invs/init.lua b/mods/ENTITIES/mcl_entity_invs/init.lua index 8ea4821edd..cc2badec0c 100644 --- a/mods/ENTITIES/mcl_entity_invs/init.lua +++ b/mods/ENTITIES/mcl_entity_invs/init.lua @@ -102,7 +102,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end) -function mcl_entity_invs.register_inv(entity_name,show_name,size,no_on_righclick) +function mcl_entity_invs.register_inv(entity_name,show_name,size,no_on_righclick,no_sneak) assert(minetest.registered_entities[entity_name],"mcl_entity_invs.register_inv called with invalid entity: "..tostring(entity_name)) minetest.registered_entities[entity_name]._inv_size = size minetest.registered_entities[entity_name]._inv_title = show_name @@ -125,9 +125,9 @@ function mcl_entity_invs.register_inv(entity_name,show_name,size,no_on_righclick if not no_on_righclick then local old_rc = minetest.registered_entities[entity_name].on_rightclick minetest.registered_entities[entity_name].on_rightclick = function(self,clicker) - if clicker:get_player_control().sneak then + if no_sneak or clicker:get_player_control().sneak then mcl_entity_invs.show_inv_form(self,clicker,"") - return + if not no_sneak then return end end if old_rc then return old_rc(self,clicker) end end diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index cc32c7c511..992442b7a7 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -678,7 +678,7 @@ register_minecart( "mcl_minecarts_minecart_chest.png", {"mcl_minecarts:minecart", "mcl_chests:chest"}, nil, nil, true) -mcl_entity_invs.register_inv("mcl_minecarts:chest_minecart","Minecart",27) +mcl_entity_invs.register_inv("mcl_minecarts:chest_minecart","Minecart",27,false,true) -- Minecart with Furnace register_minecart(