2018-01-23 01:53:43 +01:00
|
|
|
-- Building blocks and decorative nodes
|
2021-05-29 16:12:33 +02:00
|
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
|
|
|
|
2018-01-23 01:53:43 +01:00
|
|
|
minetest.register_node("mcl_end:dragon_egg", {
|
2019-03-08 00:00:09 +01:00
|
|
|
description = S("Dragon Egg"),
|
2019-03-09 17:01:36 +01:00
|
|
|
_doc_items_longdesc = S("A dragon egg is a decorative item which can be placed."),
|
2018-01-23 01:53:43 +01:00
|
|
|
tiles = {
|
|
|
|
"mcl_end_dragon_egg.png",
|
|
|
|
"mcl_end_dragon_egg.png",
|
|
|
|
"mcl_end_dragon_egg.png",
|
|
|
|
"mcl_end_dragon_egg.png",
|
|
|
|
"mcl_end_dragon_egg.png",
|
|
|
|
"mcl_end_dragon_egg.png",
|
|
|
|
},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
is_ground_content = false,
|
|
|
|
paramtype = "light",
|
|
|
|
light_source = 1,
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.375, -0.5, -0.375, 0.375, -0.4375, 0.375},
|
|
|
|
{-0.5, -0.4375, -0.5, 0.5, -0.1875, 0.5},
|
|
|
|
{-0.4375, -0.1875, -0.4375, 0.4375, 0, 0.4375},
|
|
|
|
{-0.375, 0, -0.375, 0.375, 0.125, 0.375},
|
|
|
|
{-0.3125, 0.125, -0.3125, 0.3125, 0.25, 0.3125},
|
|
|
|
{-0.25, 0.25, -0.25, 0.25, 0.3125, 0.25},
|
|
|
|
{-0.1875, 0.3125, -0.1875, 0.1875, 0.375, 0.1875},
|
|
|
|
{-0.125, 0.375, -0.125, 0.125, 0.4375, 0.125},
|
|
|
|
{-0.0625, 0.4375, -0.0625, 0.0625, 0.5, 0.0625},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "regular",
|
|
|
|
},
|
2022-04-21 21:02:43 +02:00
|
|
|
groups = {handy = 1, falling_node = 1, deco_block = 1, not_in_creative_inventory = 1, dig_by_piston = 1 },
|
2018-01-23 01:53:43 +01:00
|
|
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
2020-04-17 21:40:13 +02:00
|
|
|
_mcl_blast_resistance = 9,
|
2018-01-23 01:53:43 +01:00
|
|
|
_mcl_hardness = 3,
|
2022-04-21 21:02:43 +02:00
|
|
|
on_punch = function(pos, node, puncher)
|
|
|
|
if not minetest.is_protected(pos, puncher:get_player_name()) then
|
|
|
|
local max_dist = vector.new(15, 7, 15)
|
|
|
|
local positions = minetest.find_nodes_in_area(vector.subtract(pos, max_dist), vector.add(pos, max_dist), "air", false)
|
|
|
|
if #positions > 0 then
|
|
|
|
local tpos = positions[math.random(#positions)]
|
|
|
|
minetest.remove_node(pos)
|
|
|
|
minetest.set_node(tpos, node)
|
|
|
|
minetest.check_for_falling(tpos)
|
|
|
|
end
|
2021-04-06 17:20:11 +02:00
|
|
|
end
|
|
|
|
end,
|
2018-01-23 01:53:43 +01:00
|
|
|
})
|