From cc3f092185dc5802e8581f4f90cc7a4702a98f37 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Fri, 5 Jan 2024 19:33:21 -0300 Subject: [PATCH] Changes in rotation code and bamboo rotation --- mods/CORE/mcl_util/init.lua | 22 ++++------------------ mods/ITEMS/mcl_bamboo/bamboo_base.lua | 26 +------------------------- 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 6ec86d05c..4541c603e 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -160,7 +160,7 @@ function mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing, infini return end local undef = minetest.registered_nodes[unode.name] - if undef and undef.on_rightclick then + if undef and undef.on_rightclick and not invert_wall then undef.on_rightclick(pointed_thing.under, unode, placer, itemstack, pointed_thing) return @@ -198,25 +198,11 @@ function mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing, infini local p2 if is_y then - if invert_wall then - if fdir == 3 or fdir == 1 then - p2 = 12 - else - p2 = 6 - end - end + p2 = 0 elseif is_x then - if invert_wall then - p2 = 0 - else - p2 = 12 - end + p2 = 12 elseif is_z then - if invert_wall then - p2 = 0 - else - p2 = 6 - end + p2 = 6 end minetest.set_node(pos, {name = wield_name, param2 = p2}) diff --git a/mods/ITEMS/mcl_bamboo/bamboo_base.lua b/mods/ITEMS/mcl_bamboo/bamboo_base.lua index 0cbea4361..33e0cebaa 100644 --- a/mods/ITEMS/mcl_bamboo/bamboo_base.lua +++ b/mods/ITEMS/mcl_bamboo/bamboo_base.lua @@ -280,31 +280,7 @@ local bamboo_block_def = { _mcl_blast_resistance = 3, _mcl_hardness = 2, _mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block. - on_place = function(itemstack, placer, pointed_thing) - if not pointed_thing then - return itemstack - end - - if pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node. - return itemstack - end - - local pos = pointed_thing.under - - if mcl_bamboo.is_protected(pos, placer) then - return - end - - -- Use pointed node's on_rightclick function first, if present - local node = minetest.get_node(pointed_thing.under) - if placer and not placer:get_player_control().sneak then - if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then - return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end - end - - return minetest.item_place(itemstack, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under))) - end, + on_place = mcl_util.rotate_axis, } minetest.register_node("mcl_bamboo:bamboo_block", bamboo_block_def)