0
0
Fork 0

Heavily refactor nodes in mcl_core

This commit is contained in:
Wuzzy 2017-07-07 16:37:05 +02:00
parent 5312352e9e
commit 722d4cb500
7 changed files with 462 additions and 849 deletions

View File

@ -1042,37 +1042,3 @@ minetest.register_abm({
end end
}) })
------------------------
-- Create Color Glass --
------------------------
function mcl_core.add_glass(desc, recipeitem, colorgroup, color)
minetest.register_node("mcl_core:glass_"..color, {
description = desc,
_doc_items_longdesc = "Stained glass is a decorational and mostly transparent block which comes in various different colors.",
drawtype = "glasslike",
is_ground_content = false,
tiles = {"xpanes_pane_glass_"..color..".png"},
paramtype = "light",
sunlight_propagates = "true",
use_texture_alpha = true,
stack_max = 64,
-- TODO: Add color to groups
groups = {handy=1, glass=1, building_block=1, material_glass=1},
sounds = mcl_sounds.node_sound_glass_defaults(),
drop = "",
_mcl_blast_resistance = 1.5,
_mcl_hardness = 0.3,
})
minetest.register_craft({
output = 'mcl_core:glass_'..color..' 8',
recipe = {
{'mcl_core:glass','mcl_core:glass','mcl_core:glass'},
{'mcl_core:glass',recipeitem,'mcl_core:glass'},
{'mcl_core:glass','mcl_core:glass','mcl_core:glass'},
}
})
end

View File

@ -5,6 +5,10 @@ mcl_core.repair = 0.05
-- Load files -- Load files
dofile(minetest.get_modpath("mcl_core").."/functions.lua") dofile(minetest.get_modpath("mcl_core").."/functions.lua")
dofile(minetest.get_modpath("mcl_core").."/nodes.lua") dofile(minetest.get_modpath("mcl_core").."/nodes_base.lua")
dofile(minetest.get_modpath("mcl_core").."/nodes_cactuscane.lua")
dofile(minetest.get_modpath("mcl_core").."/nodes_trees.lua")
dofile(minetest.get_modpath("mcl_core").."/nodes_glass.lua")
dofile(minetest.get_modpath("mcl_core").."/nodes_misc.lua")
dofile(minetest.get_modpath("mcl_core").."/craftitems.lua") dofile(minetest.get_modpath("mcl_core").."/craftitems.lua")
dofile(minetest.get_modpath("mcl_core").."/crafting.lua") dofile(minetest.get_modpath("mcl_core").."/crafting.lua")

View File

@ -1,5 +1,3 @@
-- mods/default/nodes.lua
local WATER_ALPHA = 179 local WATER_ALPHA = 179
local WATER_VISC = 1 local WATER_VISC = 1
local LAVA_VISC = 7 local LAVA_VISC = 7
@ -8,37 +6,6 @@ local LAVA_VISC = 7
-- Node definitions -- Node definitions
-- --
minetest.register_node("mcl_core:barrier", {
description = "Barrier",
_doc_items_longdesc = "Barriers are invisble walkable blocks. They are used to create boundaries of adventure maps and the like. Monsters and animals won't appear on barriers, and fences do not connect to barriers. Other blocks can be built on barriers like on any other block.",
_doc_items_usagehelp = "When you hold a barrier in hand, you reveal all placed barriers in a short distance around you.",
drawtype = "airlike",
paramtype = "light",
inventory_image = "mcl_core_barrier.png",
wield_image = "mcl_core_barrier.png",
tiles = { "blank.png" },
stack_max = 64,
sunlight_propagates = true,
is_ground_content = false,
groups = {creative_breakable=1, not_in_creative_inventory = 1, not_solid = 1 },
on_blast = function() end,
drop = "",
_mcl_blast_resistance = 18000003,
_mcl_hardness = -1,
after_place_node = function (pos, placer, itemstack, pointed_thing)
if placer == nil then
return
end
minetest.add_particle({
pos = pos,
expirationtime = 1,
size = 8,
texture = "mcl_core_barrier.png",
playername = placer:get_player_name()
})
end,
})
-- The void below the bedrock. Void damage is handled in mcl_playerplus. -- The void below the bedrock. Void damage is handled in mcl_playerplus.
-- The void does not exist as a block in Minecraft but we register it as a -- The void does not exist as a block in Minecraft but we register it as a
-- block here to make things easier for us. -- block here to make things easier for us.
@ -656,692 +623,6 @@ minetest.register_node("mcl_core:brick_block", {
_mcl_hardness = 2, _mcl_hardness = 2,
}) })
minetest.register_node("mcl_core:bone_block", {
description = "Bone Block",
_doc_items_longdesc = "Bone blocks are decorational blocks and a compact storage of bone meal.",
tiles = {"mcl_core_bone_block_top.png", "mcl_core_bone_block_top.png", "mcl_core_bone_block_side.png"},
is_ground_content = false,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {pickaxey=1, building_block=1, material_stone=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
})
-- Oak --
minetest.register_node("mcl_core:tree", {
description = "Oak Wood",
_doc_items_longdesc = "The trunk of an oak tree.",
_doc_items_hidden = false,
tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:sapling", {
description = "Oak Sapling",
_doc_items_longdesc = "When placed on soil (such as dirt) and exposed to light, an oak sapling will grow into an oak tree after some time. If the tree can't grow because of darkness, the sapling will uproot.",
_doc_items_hidden = false,
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_sapling.png"},
inventory_image = "default_sapling.png",
wield_image = "default_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-6/16, -0.5, -6/16, 6/16, 0.5, 6/16}
},
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("stage", 0)
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return (nn=="mcl_core:dirt_with_grass" or nn=="mcl_core:dirt_with_grass_snow" or
nn=="mcl_core:podzol" or nn=="mcl_core:podzol_snow" or
nn=="mcl_core:dirt")
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
minetest.register_node("mcl_core:leaves", {
description = "Oak Leaves",
_doc_items_longdesc = "Oak leaves are grown from oak trees.",
_doc_items_hidden = false,
drawtype = "allfaces_optional",
place_param2 = 1, -- Prevent leafdecay for placed nodes
visual_scale = 1.3,
tiles = {"default_leaves.png"},
paramtype = "light",
stack_max = 64,
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
drop = {
max_items = 1,
items = {
{
-- player will get sapling with 1/20 chance
items = {'mcl_core:sapling'},
rarity = 20,
},
{
-- player will get apple with 1/200 chance
items = {'mcl_core:apple'},
rarity = 200,
},
}
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.2,
})
minetest.register_node("mcl_core:wood", {
description = "Oak Wood Planks",
_doc_items_longdesc = doc.sub.items.temp.build,
_doc_items_hidden = false,
tiles = {"default_wood.png"},
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
})
-- Dark oak --
minetest.register_node("mcl_core:darktree", {
description = "Dark Oak Wood",
_doc_items_longdesc = "The trunk of a dark oak tree.",
tiles = {"mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:darksapling", {
description = "Dark Oak Sapling",
_doc_items_longdesc = "When placed on soil (such as dirt) and exposed to light, a dark oak sapling will grow into a dark oak tree after some time. If the tree can't grow because of darkness, the sapling will uproot.",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"mcl_core_sapling_big_oak.png"},
inventory_image = "mcl_core_sapling_big_oak.png",
wield_image = "mcl_core_sapling_big_oak.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-5.5/16, -0.5, -5.5/16, 5.5/16, 0.5, 5.5/16}
},
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("stage", 0)
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return (nn=="mcl_core:dirt_with_grass" or nn=="mcl_core:dirt_with_grass_snow" or
nn=="mcl_core:podzol" or nn=="mcl_core:podzol_snow" or
nn=="mcl_core:dirt")
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
minetest.register_node("mcl_core:darkleaves", {
description = "Dark Oak Leaves",
_doc_items_longdesc = "Dark oak leaves are grown from dark oak trees.",
drawtype = "allfaces_optional",
place_param2 = 1, -- Prevent leafdecay for placed nodes
visual_scale = 1.3,
tiles = {"mcl_core_leaves_big_oak.png"},
paramtype = "light",
stack_max = 64,
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
drop = {
max_items = 1,
items = {
{
-- player will get sapling with 1/20 chance
items = {'mcl_core:darksapling'},
rarity = 20,
},
{
-- player will get apple with 1/200 chance
items = {'mcl_core:apple'},
rarity = 200,
},
}
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.2,
})
minetest.register_node("mcl_core:darkwood", {
description = "Dark Oak Wood Planks",
_doc_items_longdesc = doc.sub.items.temp.build,
tiles = {"mcl_core_planks_big_oak.png"},
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
})
-- Jungle tree --
minetest.register_node("mcl_core:jungletree", {
description = "Jungle Wood",
_doc_items_longdesc = "The trunk of a jungle tree. Cocoa beans can be placed on the side of it to plant a cocoa.",
tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
-- This is a bad bad workaround which is only done because cocoas are not wallmounted (but should)
-- As long cocoas only EVER stick to jungle trees, and nothing else, this is probably a lesser sin.
after_dig_node = function(pos, oldnode, oldmetadata, digger)
-- Drop attached cocoas
local posses = {
{ x = pos.x + 1, y = pos.y, z = pos.z },
{ x = pos.x - 1, y = pos.y, z = pos.z },
{ x = pos.x, y = pos.y, z = pos.z + 1 },
{ x = pos.x, y = pos.y, z = pos.z - 1 },
}
for p=1, #posses do
local node = minetest.get_node(posses[p])
local g = minetest.get_item_group(node.name, "cocoa")
if g and g >= 1 then
minetest.remove_node(posses[p])
local drops = minetest.get_node_drops(node.name, "")
for d=1, #drops do
minetest.add_item(posses[p], drops[d])
end
end
end
end,
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:junglewood", {
description = "Jungle Wood Planks",
_doc_items_longdesc = doc.sub.items.temp.build,
tiles = {"default_junglewood.png"},
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:jungleleaves", {
description = "Jungle Leaves",
_doc_items_longdesc = "Jungle leaves are grown from jungle trees.",
drawtype = "allfaces_optional",
place_param2 = 1, -- Prevent leafdecay for placed nodes
visual_scale = 1.3,
tiles = {"default_jungleleaves.png"},
paramtype = "light",
stack_max = 64,
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
drop = {
max_items = 1,
items = {
{
items = {'mcl_core:junglesapling'},
rarity = 40,
},
}
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.2,
})
minetest.register_node("mcl_core:junglesapling", {
description = "Jungle Sapling",
_doc_items_longdesc = "When placed on soil (such as dirt) and exposed to light, a jungle sapling will grow into a jungle tree after some time. If the tree can't grow because of darkness, the sapling will uproot.",
drawtype = "plantlike",
place_param2 = 1, -- Prevent leafdecay for placed nodes
visual_scale = 1.0,
tiles = {"default_junglesapling.png"},
inventory_image = "default_junglesapling.png",
wield_image = "default_junglesapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16}
},
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("stage", 0)
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return (nn=="mcl_core:dirt_with_grass" or nn=="mcl_core:dirt_with_grass_snow" or
nn=="mcl_core:podzol" or nn=="mcl_core:podzol_snow" or
nn=="mcl_core:dirt")
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
-- Acacia --
minetest.register_node("mcl_core:acaciatree", {
description = "Acacia Wood",
_doc_items_longdesc = "The trunk of an acacia.",
tiles = {"default_acacia_tree_top.png", "default_acacia_tree_top.png", "default_acacia_tree.png"},
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:acaciawood", {
description = "Acacia Wood Planks",
_doc_items_longdesc = doc.sub.items.temp.build,
tiles = {"default_acacia_wood.png"},
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:acacialeaves", {
description = "Acacia Leaves",
_doc_items_longdesc = "Acacia leaves are grown from acacia trees.",
drawtype = "allfaces_optional",
place_param2 = 1, -- Prevent leafdecay for placed nodes
visual_scale = 1.3,
tiles = {"default_acacia_leaves.png"},
paramtype = "light",
stack_max = 64,
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
drop = {
max_items = 1,
items = {
{
items = {'mcl_core:acaciasapling'},
rarity = 20,
},
}
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.2,
})
minetest.register_node("mcl_core:acaciasapling", {
description = "Acacia Sapling",
_doc_items_longdesc = "When placed on soil (such as dirt) and exposed to light, an acacia sapling will grow into an acacia tree after some time. If the tree can't grow because of darkness, the sapling will uproot.",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_acacia_sapling.png"},
inventory_image = "default_acacia_sapling.png",
wield_image = "default_acacia_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("stage", 0)
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return (nn=="mcl_core:dirt_with_grass" or nn=="mcl_core:dirt_with_grass_snow" or
nn=="mcl_core:podzol" or nn=="mcl_core:podzol_snow" or
nn=="mcl_core:dirt")
end),
node_placement_prediction = "",
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
-- Spruce --
minetest.register_node("mcl_core:sprucetree", {
description = "Spruce Wood",
_doc_items_longdesc = "The trunk of a spruce tree.",
tiles = {"mcl_core_log_spruce_top.png", "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png"},
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:sprucewood", {
description = "Spruce Wood Planks",
_doc_items_longdesc = doc.sub.items.temp.build,
tiles = {"mcl_core_planks_spruce.png"},
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:spruceleaves", {
description = "Spruce Leaves",
_doc_items_longdesc = "Spruce leaves are grown from spruce trees.",
drawtype = "allfaces_optional",
place_param2 = 1, -- Prevent leafdecay for placed nodes
visual_scale = 1.3,
tiles = {"mcl_core_leaves_spruce.png"},
paramtype = "light",
stack_max = 64,
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
drop = {
max_items = 1,
items = {
{
-- player will get sapling with 1/20 chance
items = {'mcl_core:sprucesapling'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {''},
}
}
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.2,
})
minetest.register_node("mcl_core:sprucesapling", {
description = "Spruce Sapling",
_doc_items_longdesc = "When placed on soil (such as dirt) and exposed to light, a spruce sapling will grow into a spruce tree after some time. If the tree can't grow because of darkness, the sapling will uproot.",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"mcl_core_sapling_spruce.png"},
inventory_image = "mcl_core_sapling_spruce.png",
wield_image = "mcl_core_sapling_spruce.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("stage", 0)
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return (nn=="mcl_core:dirt_with_grass" or nn=="mcl_core:dirt_with_grass_snow" or
nn=="mcl_core:podzol" or nn=="mcl_core:podzol_snow" or
nn=="mcl_core:dirt")
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
-- Birch
minetest.register_node("mcl_core:birchtree", {
description = "Birch Wood",
_doc_items_longdesc = "The trunk of a birch tree.",
tiles = {"mcl_core_log_birch_top.png", "mcl_core_log_birch_top.png", "mcl_core_log_birch.png"},
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:birchwood", {
description = "Birch Wood Planks",
_doc_items_longdesc = doc.sub.items.temp.build,
tiles = {"mcl_core_planks_birch.png"},
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:birchleaves", {
description = "Birch Leaves",
_doc_items_longdesc = "Birch leaves are grown from birch trees.",
drawtype = "allfaces_optional",
place_param2 = 1, -- Prevent leafdecay for placed nodes
visual_scale = 1.3,
tiles = {"mcl_core_leaves_birch.png"},
paramtype = "light",
stack_max = 64,
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
drop = {
max_items = 1,
items = {
{
-- player will get sapling with 1/20 chance
items = {'mcl_core:birchsapling'},
rarity = 20,
},
}
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.2,
})
minetest.register_node("mcl_core:birchsapling", {
description = "Birch Sapling",
_doc_items_longdesc = "When placed on soil (such as dirt) and exposed to light, a birch sapling will grow into a birch tree after some time. If the tree can't grow because of darkness, the sapling will uproot.",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"mcl_core_sapling_birch.png"},
inventory_image = "mcl_core_sapling_birch.png",
wield_image = "mcl_core_sapling_birch.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-6/16, -0.5, -6/16, 6/16, 0.5, 6/16}
},
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("stage", 0)
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return (nn=="mcl_core:dirt_with_grass" or nn=="mcl_core:dirt_with_grass_snow" or
nn=="mcl_core:podzol" or nn=="mcl_core:podzol_snow" or
nn=="mcl_core:dirt")
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
minetest.register_node("mcl_core:cactus", {
description = "Cactus",
_doc_items_longdesc = "This is a piece of cactus commonly found in dry areas, especially deserts. Over time, cacti will grow up to 3 blocks high on sand or red sand. A cactus hurts living beings touching it with a damage of 1 HP every half second. When a cactus block is broken, all cactus blocks connected above it will break as well.",
_doc_items_usagehelp = "A cactus can only be placed on top of another cactus or any sand.",
drawtype = "nodebox",
tiles = {"default_cactus_top.png", "mcl_core_cactus_bottom.png", "default_cactus_side.png","default_cactus_side.png","default_cactus_side.png","default_cactus_side.png"},
is_ground_content = true,
stack_max = 64,
groups = {handy=1, attached_node=1, plant=1, deco_block=1, dig_by_piston=1, enderman_takable=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
paramtype = "light",
sunlight_propagates = true,
node_placement_prediction = "",
node_box = {
type = "fixed",
fixed = {
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16}, -- Main body
{-8/16, -8/16, -7/16, 8/16, 8/16, -7/16}, -- Spikes
{-8/16, -8/16, 7/16, 8/16, 8/16, 7/16}, -- Spikes
{-7/16, -8/16, -8/16, -7/16, 8/16, 8/16}, -- Spikes
{7/16, -8/16, 8/16, 7/16, 8/16, -8/16}, -- Spikes
},
},
collision_box = {
type = "fixed",
fixed = {-7/16, -8/16, -7/16, 7/16, 7/16, 7/16}, -- Main body. slightly lower than node box
},
selection_box = {
type = "fixed",
fixed = {
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16},
},
},
-- Only allow to place cactus on sand or cactus
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
return (node_below.name == "mcl_core:cactus" or minetest.get_item_group(node_below.name, "sand") == 1)
end),
_mcl_blast_resistance = 2,
_mcl_hardness = 0.4,
})
minetest.register_node("mcl_core:reeds", {
description = "Sugar Canes",
_doc_items_longdesc = "Sugar canes are a plant which has some uses in crafting. Sugar canes will slowly grow up to 3 blocks when they are next to water and are placed on a grass block, dirt, sand, red sand, podzol or coarse dirt. When a sugar cane is broken, all sugar canes connected above will break as well.",
_doc_items_usagehelp = "Sugar canes can only be placed on blocks on which they would grow.",
drawtype = "plantlike",
tiles = {"default_papyrus.png"},
inventory_image = "mcl_core_reeds.png",
wield_image = "mcl_core_reeds.png",
paramtype = "light",
walkable = false,
is_ground_content = true,
node_box = {
type = "fixed",
fixed = {
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16}, -- Main Body
{-8/16, -8/16, -7/16, 8/16, 8/16, -7/16}, -- Spikes
{-8/16, -8/16, 7/16, 8/16, 8/16, 7/16}, -- Spikes
{-7/16, -8/16, -8/16, -7/16, 8/16, 8/16}, -- Spikes
{7/16, -8/16, 8/16, 7/16, 8/16, -8/16}, -- Spikes
},
},
selection_box = {
type = "fixed",
fixed = {
{-6/16, -8/16, -6/16, 6/16, 8/16, 6/16},
},
},
stack_max = 64,
groups = {dig_immediate=3, craftitem=1, plant=1, non_mycelium_plant=1, dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
on_place = mcl_util.generate_on_place_plant_function(function(place_pos, place_node)
local soil_pos = {x=place_pos.x, y=place_pos.y-1, z=place_pos.z}
local soil_node = minetest.get_node_or_nil(soil_pos)
if not soil_node then return false end
local snn = soil_node.name -- soil node name
-- Placement rules:
-- * On group:soil_sugarcane
-- * Next to water or frosted ice
if minetest.get_item_group(snn, "soil_sugarcane") == 0 then
return false
end
local posses = {
{ x=0, y=0, z=1},
{ x=0, y=0, z=-1},
{ x=1, y=0, z=0},
{ x=-1, y=0, z=0},
}
for p=1, #posses do
local checknode = minetest.get_node(vector.add(soil_pos, posses[p]))
if minetest.get_item_group(checknode.name, "water") ~= 0 or minetest.get_item_group(checknode.name, "frosted_ice") ~= 0 then
-- Water found! Sugar canes are happy! :-)
return true
end
end
-- No water found! Sugar canes are not amuzed and refuses to be placed. :-(
return false
end),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
minetest.register_node("mcl_core:bedrock", { minetest.register_node("mcl_core:bedrock", {
description = "Bedrock", description = "Bedrock",
@ -1357,71 +638,6 @@ minetest.register_node("mcl_core:bedrock", {
_mcl_hardness = -1, _mcl_hardness = -1,
}) })
minetest.register_node("mcl_core:slimeblock", {
description = "Slime Block",
_doc_items_longdesc = "Slime blocks are very bouncy and prevent fall damage.",
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}
},
tiles = {"mcl_core_slime.png"},
paramtype = "light",
use_texture_alpha = true,
sunlight_propagates = true,
stack_max = 64,
-- According to Minecraft Wiki, bouncing off a slime block from a height off 255 blocks should result in a bounce height of 50 blocks
-- bouncy=44 makes the player bounce up to 49.6. This value was chosen by experiment.
-- bouncy=80 was chosen because it is higher than 66 (bounciness of bed)
groups = {dig_immediate=3, bouncy=80,fall_damage_add_percent=-100,deco_block=1},
sounds = {
dug = {name="slimenodes_dug", gain=0.6},
place = {name="slimenodes_place", gain=0.6},
footstep = {name="slimenodes_step", gain=0.3},
},
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
minetest.register_node("mcl_core:glass", {
description = "Glass",
_doc_items_longdesc = "A decorational and mostly transparent block.",
drawtype = "glasslike",
is_ground_content = false,
tiles = {"default_glass.png"},
paramtype = "light",
sunlight_propagates = true,
stack_max = 64,
groups = {handy=1, glass=1, building_block=1, material_glass=1},
sounds = mcl_sounds.node_sound_glass_defaults(),
drop = "",
_mcl_blast_resistance = 1.5,
_mcl_hardness = 0.3,
})
---- colored glass
mcl_core.add_glass( "Red Stained Glass", "mcl_dye:red", "basecolor_red", "red")
mcl_core.add_glass( "Green Stained Glass", "mcl_dye:dark_green", "unicolor_dark_green", "green")
mcl_core.add_glass( "Blue Stained Glass", "mcl_dye:blue", "basecolor_blue", "blue")
mcl_core.add_glass( "Light Blue Stained Glass", "mcl_dye:lightblue", "unicolor_light_blue", "light_blue")
mcl_core.add_glass( "Black Stained Glass", "mcl_dye:black", "basecolor_black", "black")
mcl_core.add_glass( "White Stained Glass", "mcl_dye:white", "basecolor_white", "white")
mcl_core.add_glass( "Yellow Stained Glass", "mcl_dye:yellow", "basecolor_yellow", "yellow")
mcl_core.add_glass( "Brown Stained Glass", "mcl_dye:brown", "unicolor_dark_orange", "brown")
mcl_core.add_glass( "Orange Stained Glass", "mcl_dye:orange", "excolor_orange", "orange")
mcl_core.add_glass( "Pink Stained Glass", "mcl_dye:pink", "unicolor_light_red", "pink")
mcl_core.add_glass( "Grey Stained Glass", "mcl_dye:dark_grey", "unicolor_darkgrey", "gray")
mcl_core.add_glass( "Lime Stained Glass", "mcl_dye:green", "basecolor_green", "lime")
mcl_core.add_glass( "Light Grey Stained Glass", "mcl_dye:grey", "basecolor_grey", "silver")
mcl_core.add_glass( "Magenta Stained Glass", "mcl_dye:magenta", "basecolor_magenta", "magenta")
mcl_core.add_glass( "Purple Stained Glass", "mcl_dye:violet", "excolor_violet", "purple")
mcl_core.add_glass( "Cyan Stained Glass", "mcl_dye:cyan", "basecolor_cyan", "cyan")
minetest.register_node("mcl_core:ladder", { minetest.register_node("mcl_core:ladder", {
description = "Ladder", description = "Ladder",
_doc_items_longdesc = "A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks and not on glass, leaves, ice, slabs, glowstone, nor sea lanterns.", _doc_items_longdesc = "A piece of ladder which allows you to climb vertically. Ladders can only be placed on the side of solid blocks and not on glass, leaves, ice, slabs, glowstone, nor sea lanterns.",
@ -2081,31 +1297,6 @@ minetest.register_node("mcl_core:snowblock", {
_mcl_hardness = 0.2, _mcl_hardness = 0.2,
}) })
minetest.register_node("mcl_core:cobweb", {
description = "Cobweb",
_doc_items_longdesc = "Cobwebs can be walked through, but significantly slow you down.",
drawtype = "plantlike",
paramtype2 = "degrotate",
visual_scale = 1.1,
stack_max = 64,
tiles = {"mcl_core_web.png"},
inventory_image = "mcl_core_web.png",
paramtype = "light",
sunlight_propagates = true,
liquid_viscosity = 14,
liquidtype = "source",
liquid_alternative_flowing = "mcl_core:cobweb",
liquid_alternative_source = "mcl_core:cobweb",
liquid_renewable = false,
liquid_range = 0,
walkable = false,
groups = {swordy_cobweb=1,shearsy=1, deco_block=1, dig_by_piston=1, dig_by_water=1,destroy_by_lava_flow=1,},
drop = "mcl_mobitems:string",
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 20,
_mcl_hardness = 4,
})
-- Add entry aliases for the Help -- Add entry aliases for the Help
if minetest.get_modpath("doc") then if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_core:stone_with_redstone", "nodes", "mcl_core:stone_with_redstone_lit") doc.add_entry_alias("nodes", "mcl_core:stone_with_redstone", "nodes", "mcl_core:stone_with_redstone_lit")
@ -2116,8 +1307,3 @@ if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_core:mycelium", "nodes", "mcl_core:mycelium_snow") doc.add_entry_alias("nodes", "mcl_core:mycelium", "nodes", "mcl_core:mycelium_snow")
end end
-- Node aliases
minetest.register_alias("default:acacia_tree", "mcl_core:acaciatree")
minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves")

View File

@ -0,0 +1,110 @@
-- Cactus and Sugar Cane
minetest.register_node("mcl_core:cactus", {
description = "Cactus",
_doc_items_longdesc = "This is a piece of cactus commonly found in dry areas, especially deserts. Over time, cacti will grow up to 3 blocks high on sand or red sand. A cactus hurts living beings touching it with a damage of 1 HP every half second. When a cactus block is broken, all cactus blocks connected above it will break as well.",
_doc_items_usagehelp = "A cactus can only be placed on top of another cactus or any sand.",
drawtype = "nodebox",
tiles = {"default_cactus_top.png", "mcl_core_cactus_bottom.png", "default_cactus_side.png","default_cactus_side.png","default_cactus_side.png","default_cactus_side.png"},
is_ground_content = true,
stack_max = 64,
groups = {handy=1, attached_node=1, plant=1, deco_block=1, dig_by_piston=1, enderman_takable=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
paramtype = "light",
sunlight_propagates = true,
node_placement_prediction = "",
node_box = {
type = "fixed",
fixed = {
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16}, -- Main body
{-8/16, -8/16, -7/16, 8/16, 8/16, -7/16}, -- Spikes
{-8/16, -8/16, 7/16, 8/16, 8/16, 7/16}, -- Spikes
{-7/16, -8/16, -8/16, -7/16, 8/16, 8/16}, -- Spikes
{7/16, -8/16, 8/16, 7/16, 8/16, -8/16}, -- Spikes
},
},
collision_box = {
type = "fixed",
fixed = {-7/16, -8/16, -7/16, 7/16, 7/16, 7/16}, -- Main body. slightly lower than node box
},
selection_box = {
type = "fixed",
fixed = {
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16},
},
},
-- Only allow to place cactus on sand or cactus
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
return (node_below.name == "mcl_core:cactus" or minetest.get_item_group(node_below.name, "sand") == 1)
end),
_mcl_blast_resistance = 2,
_mcl_hardness = 0.4,
})
minetest.register_node("mcl_core:reeds", {
description = "Sugar Canes",
_doc_items_longdesc = "Sugar canes are a plant which has some uses in crafting. Sugar canes will slowly grow up to 3 blocks when they are next to water and are placed on a grass block, dirt, sand, red sand, podzol or coarse dirt. When a sugar cane is broken, all sugar canes connected above will break as well.",
_doc_items_usagehelp = "Sugar canes can only be placed on blocks on which they would grow.",
drawtype = "plantlike",
tiles = {"default_papyrus.png"},
inventory_image = "mcl_core_reeds.png",
wield_image = "mcl_core_reeds.png",
paramtype = "light",
walkable = false,
is_ground_content = true,
node_box = {
type = "fixed",
fixed = {
{-7/16, -8/16, -7/16, 7/16, 8/16, 7/16}, -- Main Body
{-8/16, -8/16, -7/16, 8/16, 8/16, -7/16}, -- Spikes
{-8/16, -8/16, 7/16, 8/16, 8/16, 7/16}, -- Spikes
{-7/16, -8/16, -8/16, -7/16, 8/16, 8/16}, -- Spikes
{7/16, -8/16, 8/16, 7/16, 8/16, -8/16}, -- Spikes
},
},
selection_box = {
type = "fixed",
fixed = {
{-6/16, -8/16, -6/16, 6/16, 8/16, 6/16},
},
},
stack_max = 64,
groups = {dig_immediate=3, craftitem=1, plant=1, non_mycelium_plant=1, dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
on_place = mcl_util.generate_on_place_plant_function(function(place_pos, place_node)
local soil_pos = {x=place_pos.x, y=place_pos.y-1, z=place_pos.z}
local soil_node = minetest.get_node_or_nil(soil_pos)
if not soil_node then return false end
local snn = soil_node.name -- soil node name
-- Placement rules:
-- * On group:soil_sugarcane
-- * Next to water or frosted ice
if minetest.get_item_group(snn, "soil_sugarcane") == 0 then
return false
end
local posses = {
{ x=0, y=0, z=1},
{ x=0, y=0, z=-1},
{ x=1, y=0, z=0},
{ x=-1, y=0, z=0},
}
for p=1, #posses do
local checknode = minetest.get_node(vector.add(soil_pos, posses[p]))
if minetest.get_item_group(checknode.name, "water") ~= 0 or minetest.get_item_group(checknode.name, "frosted_ice") ~= 0 then
-- Water found! Sugar canes are happy! :-)
return true
end
end
-- No water found! Sugar canes are not amuzed and refuses to be placed. :-(
return false
end),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})

View File

@ -0,0 +1,67 @@
minetest.register_node("mcl_core:glass", {
description = "Glass",
_doc_items_longdesc = "A decorational and mostly transparent block.",
drawtype = "glasslike",
is_ground_content = false,
tiles = {"default_glass.png"},
paramtype = "light",
sunlight_propagates = true,
stack_max = 64,
groups = {handy=1, glass=1, building_block=1, material_glass=1},
sounds = mcl_sounds.node_sound_glass_defaults(),
drop = "",
_mcl_blast_resistance = 1.5,
_mcl_hardness = 0.3,
})
------------------------
-- Create Color Glass --
------------------------
function mcl_core.add_glass(desc, recipeitem, colorgroup, color)
minetest.register_node("mcl_core:glass_"..color, {
description = desc,
_doc_items_longdesc = "Stained glass is a decorational and mostly transparent block which comes in various different colors.",
drawtype = "glasslike",
is_ground_content = false,
tiles = {"xpanes_pane_glass_"..color..".png"},
paramtype = "light",
sunlight_propagates = "true",
use_texture_alpha = true,
stack_max = 64,
-- TODO: Add color to groups
groups = {handy=1, glass=1, building_block=1, material_glass=1},
sounds = mcl_sounds.node_sound_glass_defaults(),
drop = "",
_mcl_blast_resistance = 1.5,
_mcl_hardness = 0.3,
})
minetest.register_craft({
output = 'mcl_core:glass_'..color..' 8',
recipe = {
{'mcl_core:glass','mcl_core:glass','mcl_core:glass'},
{'mcl_core:glass',recipeitem,'mcl_core:glass'},
{'mcl_core:glass','mcl_core:glass','mcl_core:glass'},
}
})
end
---- colored glass
mcl_core.add_glass( "Red Stained Glass", "mcl_dye:red", "basecolor_red", "red")
mcl_core.add_glass( "Green Stained Glass", "mcl_dye:dark_green", "unicolor_dark_green", "green")
mcl_core.add_glass( "Blue Stained Glass", "mcl_dye:blue", "basecolor_blue", "blue")
mcl_core.add_glass( "Light Blue Stained Glass", "mcl_dye:lightblue", "unicolor_light_blue", "light_blue")
mcl_core.add_glass( "Black Stained Glass", "mcl_dye:black", "basecolor_black", "black")
mcl_core.add_glass( "White Stained Glass", "mcl_dye:white", "basecolor_white", "white")
mcl_core.add_glass( "Yellow Stained Glass", "mcl_dye:yellow", "basecolor_yellow", "yellow")
mcl_core.add_glass( "Brown Stained Glass", "mcl_dye:brown", "unicolor_dark_orange", "brown")
mcl_core.add_glass( "Orange Stained Glass", "mcl_dye:orange", "excolor_orange", "orange")
mcl_core.add_glass( "Pink Stained Glass", "mcl_dye:pink", "unicolor_light_red", "pink")
mcl_core.add_glass( "Grey Stained Glass", "mcl_dye:dark_grey", "unicolor_darkgrey", "gray")
mcl_core.add_glass( "Lime Stained Glass", "mcl_dye:green", "basecolor_green", "lime")
mcl_core.add_glass( "Light Grey Stained Glass", "mcl_dye:grey", "basecolor_grey", "silver")
mcl_core.add_glass( "Magenta Stained Glass", "mcl_dye:magenta", "basecolor_magenta", "magenta")
mcl_core.add_glass( "Purple Stained Glass", "mcl_dye:violet", "excolor_violet", "purple")
mcl_core.add_glass( "Cyan Stained Glass", "mcl_dye:cyan", "basecolor_cyan", "cyan")

View File

@ -0,0 +1,99 @@
minetest.register_node("mcl_core:bone_block", {
description = "Bone Block",
_doc_items_longdesc = "Bone blocks are decorational blocks and a compact storage of bone meal.",
tiles = {"mcl_core_bone_block_top.png", "mcl_core_bone_block_top.png", "mcl_core_bone_block_side.png"},
is_ground_content = false,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {pickaxey=1, building_block=1, material_stone=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
})
minetest.register_node("mcl_core:slimeblock", {
description = "Slime Block",
_doc_items_longdesc = "Slime blocks are very bouncy and prevent fall damage.",
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}
},
tiles = {"mcl_core_slime.png"},
paramtype = "light",
use_texture_alpha = true,
sunlight_propagates = true,
stack_max = 64,
-- According to Minecraft Wiki, bouncing off a slime block from a height off 255 blocks should result in a bounce height of 50 blocks
-- bouncy=44 makes the player bounce up to 49.6. This value was chosen by experiment.
-- bouncy=80 was chosen because it is higher than 66 (bounciness of bed)
groups = {dig_immediate=3, bouncy=80,fall_damage_add_percent=-100,deco_block=1},
sounds = {
dug = {name="slimenodes_dug", gain=0.6},
place = {name="slimenodes_place", gain=0.6},
footstep = {name="slimenodes_step", gain=0.3},
},
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
minetest.register_node("mcl_core:cobweb", {
description = "Cobweb",
_doc_items_longdesc = "Cobwebs can be walked through, but significantly slow you down.",
drawtype = "plantlike",
paramtype2 = "degrotate",
visual_scale = 1.1,
stack_max = 64,
tiles = {"mcl_core_web.png"},
inventory_image = "mcl_core_web.png",
paramtype = "light",
sunlight_propagates = true,
liquid_viscosity = 14,
liquidtype = "source",
liquid_alternative_flowing = "mcl_core:cobweb",
liquid_alternative_source = "mcl_core:cobweb",
liquid_renewable = false,
liquid_range = 0,
walkable = false,
groups = {swordy_cobweb=1,shearsy=1, deco_block=1, dig_by_piston=1, dig_by_water=1,destroy_by_lava_flow=1,},
drop = "mcl_mobitems:string",
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 20,
_mcl_hardness = 4,
})
minetest.register_node("mcl_core:barrier", {
description = "Barrier",
_doc_items_longdesc = "Barriers are invisble walkable blocks. They are used to create boundaries of adventure maps and the like. Monsters and animals won't appear on barriers, and fences do not connect to barriers. Other blocks can be built on barriers like on any other block.",
_doc_items_usagehelp = "When you hold a barrier in hand, you reveal all placed barriers in a short distance around you.",
drawtype = "airlike",
paramtype = "light",
inventory_image = "mcl_core_barrier.png",
wield_image = "mcl_core_barrier.png",
tiles = { "blank.png" },
stack_max = 64,
sunlight_propagates = true,
is_ground_content = false,
groups = {creative_breakable=1, not_in_creative_inventory = 1, not_solid = 1 },
on_blast = function() end,
drop = "",
_mcl_blast_resistance = 18000003,
_mcl_hardness = -1,
after_place_node = function (pos, placer, itemstack, pointed_thing)
if placer == nil then
return
end
minetest.add_particle({
pos = pos,
expirationtime = 1,
size = 8,
texture = "mcl_core_barrier.png",
playername = placer:get_player_name()
})
end,
})

View File

@ -0,0 +1,181 @@
-- Tree nodes: Wood, Wooden Planks, Sapling, Leaves
local register_tree_trunk = function(subname, description, longdesc, tiles, after_dig_node)
minetest.register_node("mcl_core:"..subname, {
description = description,
_doc_items_longdesc = longdesc,
_doc_items_hidden = false,
tiles = tiles,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
after_dig_node = after_dig_node,
})
end
local register_wooden_planks = function(subname, description, tiles)
minetest.register_node("mcl_core:"..subname, {
description = description,
_doc_items_longdesc = doc.sub.items.temp.build,
_doc_items_hidden = false,
tiles = tiles,
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
})
end
local register_leaves = function(subname, description, longdesc, tiles, drop1, drop1_rarity, drop2, drop2_rarity)
local drops
if drop2 then
drop = {
max_items = 1,
items = {
{
items = {drop1},
rarity = drop1_rarity,
},
{
items = {drop2},
rarity = drop2_rarity,
},
}
}
else
drop = {
max_items = 1,
items = {
{
items = {drop1},
rarity = drop1_rarity,
},
}
}
end
minetest.register_node("mcl_core:"..subname, {
description = description,
_doc_items_longdesc = longdesc,
_doc_items_hidden = false,
drawtype = "allfaces_optional",
place_param2 = 1, -- Prevent leafdecay for placed nodes
tiles = tiles,
paramtype = "light",
stack_max = 64,
groups = {handy=1,shearsy=1,swordy=1, leafdecay=4, flammable=2, leaves=1, deco_block=1, dig_by_piston=1},
drop = drop,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.2,
})
end
local register_sapling = function(subname, description, longdesc, texture, selbox)
minetest.register_node("mcl_core:"..subname, {
description = description,
_doc_items_longdesc = longdesc,
_doc_items_hidden = false,
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {texture},
inventory_image = texture,
wield_image = texture,
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = selbox
},
stack_max = 64,
groups = {dig_immediate=3, plant=1,sapling=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("stage", 0)
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return (nn=="mcl_core:dirt_with_grass" or nn=="mcl_core:dirt_with_grass_snow" or
nn=="mcl_core:podzol" or nn=="mcl_core:podzol_snow" or
nn=="mcl_core:dirt")
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
end
---------------------
-- This is a bad bad workaround which is only done because cocoas are not wallmounted (but should)
-- As long cocoas only EVER stick to jungle trees, and nothing else, this is probably a lesser sin.
local jungle_tree_after_dig_node = function(pos, oldnode, oldmetadata, digger)
-- Drop attached cocoas
local posses = {
{ x = pos.x + 1, y = pos.y, z = pos.z },
{ x = pos.x - 1, y = pos.y, z = pos.z },
{ x = pos.x, y = pos.y, z = pos.z + 1 },
{ x = pos.x, y = pos.y, z = pos.z - 1 },
}
for p=1, #posses do
local node = minetest.get_node(posses[p])
local g = minetest.get_item_group(node.name, "cocoa")
if g and g >= 1 then
minetest.remove_node(posses[p])
local drops = minetest.get_node_drops(node.name, "")
for d=1, #drops do
minetest.add_item(posses[p], drops[d])
end
end
end
end
register_tree_trunk("tree", "Oak Wood", "The trunk of an oak tree.", {"default_tree_top.png", "default_tree_top.png", "default_tree.png"})
register_tree_trunk("darktree", "Dark Oak Wood", "The trunk of a dark oak tree.", {"mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png"})
register_tree_trunk("acaciatree", "Acacia Wood", "The trunk of an acacia.", {"default_acacia_tree_top.png", "default_acacia_tree_top.png", "default_acacia_tree.png"})
register_tree_trunk("darktree", "Dark Oak Wood", "The trunk of a dark oak tree.", {"mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png"})
register_tree_trunk("sprucetree", "Spruce Wood", "The trunk of a spruce tree.", {"mcl_core_log_spruce_top.png", "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png"})
register_tree_trunk("birchtree", "Birch Wood", "The trunk of a birch tree.", {"mcl_core_log_birch_top.png", "mcl_core_log_birch_top.png", "mcl_core_log_birch.png"})
register_tree_trunk("jungletree", "Jungle Wood", "The trunk of a jungle tree.", {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, jungle_tree_after_dig_node)
register_wooden_planks("wood", "Oak Wood Planks", {"default_wood.png"})
register_wooden_planks("darkwood", "Dark Oak Wood Planks", {"mcl_core_planks_big_oak.png"})
register_wooden_planks("junglewood", "Jungle Wood Planks", {"default_junglewood.png"})
register_wooden_planks("sprucewood", "Spruce Wood Planks", {"mcl_core_planks_spruce.png"})
register_wooden_planks("acaciawood", "Acacia Wood Planks", {"default_acacia_wood.png"})
register_wooden_planks("birchwood", "Birch Wood Planks", {"mcl_core_planks_birch.png"})
register_sapling("sapling", "Oak Sapling", "When placed on soil (such as dirt) and exposed to light, an oak sapling will grow into an oak tree after some time. If the tree can't grow because of darkness, the sapling will uproot.", "default_sapling.png", {-6/16, -0.5, -6/16, 6/16, 0.5, 6/16})
register_sapling("darksapling", "Dark Oak Sapling", "When placed on soil (such as dirt) and exposed to light, a dark oak sapling will grow into a dark oak tree after some time. If the tree can't grow because of darkness, the sapling will uproot.", "mcl_core_sapling_big_oak.png", {-5.5/16, -0.5, -5.5/16, 5.5/16, 0.5, 5.5/16})
register_sapling("junglesapling", "Jungle Sapling", "When placed on soil (such as dirt) and exposed to light, a jungle sapling will grow into a jungle tree after some time. If the tree can't grow because of darkness, the sapling will uproot.", "default_junglesapling.png", {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16})
register_sapling("acaciasapling", "Acacia Sapling", "When placed on soil (such as dirt) and exposed to light, an acacia sapling will grow into an acacia tree after some time. If the tree can't grow because of darkness, the sapling will uproot.", "default_acacia_sapling.png", {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3})
register_sapling("sprucesapling", "Spruce Sapling", "When placed on soil (such as dirt) and exposed to light, a spruce sapling will grow into a spruce tree after some time. If the tree can't grow because of darkness, the sapling will uproot.", "mcl_core_sapling_spruce.png", {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3})
register_sapling("birchsapling", "Birch Sapling", "When placed on soil (such as dirt) and exposed to light, a birch sapling will grow into a birch tree after some time. If the tree can't grow because of darkness, the sapling will uproot.", "mcl_core_sapling_birch.png", {-6/16, -0.5, -6/16, 6/16, 0.5, 6/16})
register_leaves("leaves", "Oak Leaves", "Oak leaves are grown from oak trees.", {"default_leaves.png"}, "mcl_core:sapling", 20, "mcl_core:apple", 200)
register_leaves("darkleaves", "Dark Oak Leaves", "Dark oak leaves are grown from dark oak trees.", {"mcl_core_leaves_big_oak.png"}, "mcl_core:darksapling", 20, "mcl_core:apple", 200)
register_leaves("jungleleaves", "Jungle Leaves", "Jungle leaves are grown from jungle trees.", {"default_jungleleaves.png"}, "mcl_core:junglesapling", 40)
register_leaves("acacialeaves", "Acacia Leaves", "Acacia leaves are grown from acacia trees.", {"default_acacia_leaves.png"}, "mcl_core:acaciasapling", 20)
register_leaves("spruceleaves", "Spruce Leaves", "Spruce leaves are grown from spruce trees.", {"mcl_core_leaves_spruce.png"}, "mcl_core:sprucesapling", 20)
register_leaves("birchleaves", "Birch Leaves", "Birch leaves are grown from birch trees.", {"mcl_core_leaves_birch.png"}, "mcl_core:birchsapling", 20)
-- Node aliases
minetest.register_alias("default:acacia_tree", "mcl_core:acaciatree")
minetest.register_alias("default:acacia_leaves", "mcl_core:acacialeaves")