From 3df3e957e272fd6354b98714b41ed4a24db17936 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 18 Mar 2021 12:41:39 +0100 Subject: [PATCH] Make nodes usable when wielding an end crystal --- mods/ITEMS/mcl_end/end_crystal.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_end/end_crystal.lua b/mods/ITEMS/mcl_end/end_crystal.lua index c07ff79306..8686f1de0c 100644 --- a/mods/ITEMS/mcl_end/end_crystal.lua +++ b/mods/ITEMS/mcl_end/end_crystal.lua @@ -77,7 +77,7 @@ minetest.register_entity("mcl_end:crystal", { _exploded = false, _hittable_by_projectile = true }) - + minetest.register_craftitem("mcl_end:crystal", { inventory_image = "mcl_end_crystal_item.png", description = S("End Crystal"), @@ -86,9 +86,14 @@ minetest.register_craftitem("mcl_end:crystal", { if pointed_thing.type == "node" then local pos = minetest.get_pointed_thing_position(pointed_thing) local node = minetest.get_node(pos).name + 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 if find_crystal(pos) then return itemstack end if node == "mcl_core:obsidian" or node == "mcl_core:bedrock" then - if not minetest.is_creative_enabled(placer:get_player_name()) then + if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() end spawn_crystal(pos) @@ -110,5 +115,5 @@ minetest.register_craft({ {"mcl_core:glass", "mcl_mobitems:ghast_tear", "mcl_core:glass"}, } }) - + minetest.register_alias("mcl_end_crystal:end_crystal", "mcl_end:crystal")