mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-14 23:21:07 +01:00
Update mcl_crimson to use bonemealing API
This commit is contained in:
parent
1e0f7618ba
commit
a4f1ccd0ee
1 changed files with 41 additions and 31 deletions
|
@ -83,17 +83,20 @@ minetest.register_node("mcl_crimson:warped_fungus", {
|
||||||
light_source = 1,
|
light_source = 1,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_rightclick = function(pos, node, pointed_thing, player, itemstack)
|
_mcl_on_bonemealing = function(pointed_thing, player)
|
||||||
if pointed_thing:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then
|
local pos = pointed_thing.under
|
||||||
local nodepos = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0))
|
||||||
|
|
||||||
if nodepos.name == "mcl_crimson:warped_nylium" or nodepos.name == "mcl_nether:netherrack" then
|
if nodepos.name == "mcl_crimson:warped_nylium" or nodepos.name == "mcl_nether:netherrack" then
|
||||||
local random = math.random(1, 5)
|
local random = math.random(1, 5)
|
||||||
if random == 1 then
|
if random == 1 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
generate_warped_tree(pos)
|
generate_warped_tree(pos)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
return false
|
||||||
end,
|
end,
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
})
|
})
|
||||||
|
@ -102,6 +105,12 @@ mcl_flowerpots.register_potted_flower("mcl_crimson:warped_fungus", {
|
||||||
name = "warped_fungus",
|
name = "warped_fungus",
|
||||||
desc = S("Warped Fungus"),
|
desc = S("Warped Fungus"),
|
||||||
image = "mcl_crimson_warped_fungus.png",
|
image = "mcl_crimson_warped_fungus.png",
|
||||||
|
_mcl_on_bonemealing = function(pt,user)
|
||||||
|
local n = has_nylium_neighbor(pt.under)
|
||||||
|
if n then
|
||||||
|
minetest.set_node(pt.under,n)
|
||||||
|
end
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("mcl_crimson:twisting_vines", {
|
minetest.register_node("mcl_crimson:twisting_vines", {
|
||||||
|
@ -393,6 +402,11 @@ minetest.register_node("mcl_crimson:warped_nylium", {
|
||||||
_mcl_hardness = 0.4,
|
_mcl_hardness = 0.4,
|
||||||
_mcl_blast_resistance = 0.4,
|
_mcl_blast_resistance = 0.4,
|
||||||
_mcl_silk_touch_drop = true,
|
_mcl_silk_touch_drop = true,
|
||||||
|
_mcl_on_bonemealing = function(pt,user)
|
||||||
|
local node = minetest.get_node(pt.under)
|
||||||
|
spread_nether_plants(pt.under,node)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
--Stem bark, stripped stem and bark
|
--Stem bark, stripped stem and bark
|
||||||
|
@ -525,17 +539,21 @@ minetest.register_node("mcl_crimson:crimson_fungus", {
|
||||||
fixed = { -3/16, -0.5, -3/16, 3/16, -2/16, 3/16 },
|
fixed = { -3/16, -0.5, -3/16, 3/16, -2/16, 3/16 },
|
||||||
},
|
},
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_rightclick = function(pos, node, pointed_thing, player)
|
_mcl_on_bonemealing = function(pointed_thing, player)
|
||||||
if pointed_thing:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then
|
local pos = pointed_thing.under
|
||||||
local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0))
|
local nodepos = minetest.get_node(vector.offset(pos, 0, -1, 0))
|
||||||
if nodepos.name == "mcl_crimson:crimson_nylium" or nodepos.name == "mcl_nether:netherrack" then
|
if nodepos.name == "mcl_crimson:crimson_nylium" or nodepos.name == "mcl_nether:netherrack" then
|
||||||
local random = math.random(1, 5)
|
local random = math.random(1, 5)
|
||||||
if random == 1 then
|
if random == 1 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
generate_crimson_tree(pos)
|
generate_crimson_tree(pos)
|
||||||
|
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
-- Failed to spread nylium
|
||||||
|
return false
|
||||||
end,
|
end,
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
})
|
})
|
||||||
|
@ -682,6 +700,11 @@ minetest.register_node("mcl_crimson:crimson_nylium", {
|
||||||
_mcl_hardness = 0.4,
|
_mcl_hardness = 0.4,
|
||||||
_mcl_blast_resistance = 0.4,
|
_mcl_blast_resistance = 0.4,
|
||||||
_mcl_silk_touch_drop = true,
|
_mcl_silk_touch_drop = true,
|
||||||
|
_mcl_on_bonemealing = function(pt,user)
|
||||||
|
local node = minetest.get_node(pt.under)
|
||||||
|
spread_nether_plants(pt.under,node)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -723,19 +746,6 @@ minetest.register_craft({
|
||||||
mcl_stairs.register_stair("crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", wood_stair_groups, false, S("Crimson Stair"))
|
mcl_stairs.register_stair("crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", wood_stair_groups, false, S("Crimson Stair"))
|
||||||
mcl_stairs.register_slab("crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", wood_slab_groups, false, S("Crimson Slab"))
|
mcl_stairs.register_slab("crimson_hyphae_wood", "mcl_crimson:crimson_hyphae_wood", wood_slab_groups, false, S("Crimson Slab"))
|
||||||
|
|
||||||
mcl_dye.register_on_bone_meal_apply(function(pt,user)
|
|
||||||
if not pt.type == "node" then return end
|
|
||||||
local node = minetest.get_node(pt.under)
|
|
||||||
if node.name == "mcl_nether:netherrack" then
|
|
||||||
local n = has_nylium_neighbor(pt.under)
|
|
||||||
if n then
|
|
||||||
minetest.set_node(pt.under,n)
|
|
||||||
end
|
|
||||||
elseif node.name == "mcl_crimson:warped_nylium" or node.name == "mcl_crimson:crimson_nylium" then
|
|
||||||
spread_nether_plants(pt.under,node)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Turn Crimson Nylium and Warped Nylium below solid block into Netherrack",
|
label = "Turn Crimson Nylium and Warped Nylium below solid block into Netherrack",
|
||||||
nodenames = {"mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium"},
|
nodenames = {"mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium"},
|
||||||
|
|
Loading…
Reference in a new issue