From de8ea11b3967cb5b91951db80b1b865dda07b454 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 18 Apr 2022 05:13:38 +0200 Subject: [PATCH 1/3] Add debug command to spawn mcl_farming plant nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the debug command “/generate_farming_plant_rows”. The command generates rows of plants and stems per plant type near a player. A farming soil or glass node is placed below each node, so players can find and examine possible gaps between a plant node and a node below. --- mods/ITEMS/mcl_farming/init.lua | 70 +++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/mods/ITEMS/mcl_farming/init.lua b/mods/ITEMS/mcl_farming/init.lua index adce058e..17a4d7c9 100644 --- a/mods/ITEMS/mcl_farming/init.lua +++ b/mods/ITEMS/mcl_farming/init.lua @@ -27,3 +27,73 @@ dofile(minetest.get_modpath("mcl_farming").."/potatoes.lua") -- ========= BEETROOT ========= dofile(minetest.get_modpath("mcl_farming").."/beetroot.lua") + +-- This function generates a row of plantlike and nodebox nodes whose +-- name starts with a given string, starting at a given position. It +-- places a given node below so that the rendering can be examined. +local function generate_plant_row(prefix, pos, below_node) + local i = 1 + for node_name, node in pairs(minetest.registered_nodes) do + if ( + 1 == node_name:find(prefix) and + ( + "plantlike" == node.drawtype or + "nodebox" == node.drawtype + ) + ) then + local node_pos = { + x = pos.x + i, + y = pos.y, + z = pos.z, + } + minetest.set_node( + node_pos, + { + name = node_name, + param2 = node.place_param2 or 0 + } + ) + local below_pos = { + x = node_pos.x, + y = node_pos.y - 1, + z = node_pos.z + } + minetest.set_node( + below_pos, + below_node + ) + i = i + 1 + end + end +end + +minetest.register_chatcommand("generate_farming_plant_rows",{ + description = "Generates rows of mcl_farming plant nodes on farming soil and glass", + privs = { debug = true }, + func = function(name, param) + local player = minetest.get_player_by_name(name) + local pos = player:get_pos() + local node_prefixes = { + "mcl_farming:beetroot", + "mcl_farming:carrot", + "mcl_farming:melon", + "mcl_farming:potato", + "mcl_farming:pumpkin", + "mcl_farming:wheat", + } + for i,node_prefix in ipairs(node_prefixes) do + generate_plant_row( + node_prefix, + pos, + { name = "mcl_farming:soil" } + ) + pos.z = pos.z + 2 + generate_plant_row( + node_prefix, + pos, + { name = "mcl_core:glass" } + ) + pos.z = pos.z + 2 + end + end +}) From 14cbc63b5fe72f8045b6801c8ad196611db99b80 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 18 Apr 2022 07:32:47 +0200 Subject: [PATCH 2/3] Render mcl_farming plant grids 1/16 node lower This patch replaces the plantlike drawtype of mcl_farming plant nodes that are rendered like a grid (#) with a nodebox drawtype. The nodebox looks like a plantlike grid shifted 1/16 nodes downwards. The goal is to remove gaps between plants and farming soil with a node height of 15/16. This patch affects beetroot, carrots, potatoes, and wheat nodes. --- mods/ITEMS/mcl_farming/beetroot.lua | 40 ++++++++++++--------- mods/ITEMS/mcl_farming/carrots.lua | 20 ++++++----- mods/ITEMS/mcl_farming/potatoes.lua | 24 +++++++------ mods/ITEMS/mcl_farming/shared_functions.lua | 25 ++++++++++++- mods/ITEMS/mcl_farming/wheat.lua | 24 +++++++++---- 5 files changed, 91 insertions(+), 42 deletions(-) diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index dc5475eb..6ee9a51a 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -18,19 +18,21 @@ minetest.register_node("mcl_farming:beetroot_0", { _doc_items_longdesc = S("Beetroot plants are plants which grow on farmland under sunlight in 4 stages. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."), _doc_items_entry_name = S("Premature Beetroot Plant"), paramtype = "light", - paramtype2 = "meshoptions", sunlight_propagates = true, + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_0.png"}, + tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_0.png") }, + use_texture_alpha = "clip", inventory_image = "mcl_farming_beetroot_0.png", wield_image = "mcl_farming_beetroot_0.png", selection_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} + {-0.5, -9/16, -0.5, 0.5, -6/16, 0.5} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, @@ -42,19 +44,21 @@ minetest.register_node("mcl_farming:beetroot_1", { description = S("Premature Beetroot Plant (Stage 2)"), _doc_items_create_entry = false, paramtype = "light", - paramtype2 = "meshoptions", sunlight_propagates = true, + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_1.png"}, + tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_1.png") }, + use_texture_alpha = "clip", inventory_image = "mcl_farming_beetroot_1.png", wield_image = "mcl_farming_beetroot_1.png", selection_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, -3/16, 0.5} + {-0.5, -9/16, -0.5, 0.5, -4/16, 0.5} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, @@ -66,19 +70,21 @@ minetest.register_node("mcl_farming:beetroot_2", { description = S("Premature Beetroot Plant (Stage 3)"), _doc_items_create_entry = false, paramtype = "light", - paramtype2 = "meshoptions", sunlight_propagates = true, + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), drop = "mcl_farming:beetroot_seeds", - tiles = {"mcl_farming_beetroot_2.png"}, + tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_2.png") }, + use_texture_alpha = "clip", inventory_image = "mcl_farming_beetroot_2.png", wield_image = "mcl_farming_beetroot_2.png", selection_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 2/16, 0.5} + {-0.5, -9/16, -0.5, 0.5, 1/16, 0.5} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, @@ -91,11 +97,12 @@ minetest.register_node("mcl_farming:beetroot", { _doc_items_longdesc = S("A mature beetroot plant is a farming plant which is ready to be harvested for a beetroot and some beetroot seeds. It won't grow any further."), _doc_items_create_entry = true, paramtype = "light", - paramtype2 = "meshoptions", sunlight_propagates = true, + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), drop = { --[[ drops 1 beetroot guaranteed. drops 1-4 beetroot seeds: @@ -112,13 +119,14 @@ minetest.register_node("mcl_farming:beetroot", { { items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 }, }, }, - tiles = {"mcl_farming_beetroot_3.png"}, + tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_beetroot_3.png") }, + use_texture_alpha = "clip", inventory_image = "mcl_farming_beetroot_3.png", wield_image = "mcl_farming_beetroot_3.png", selection_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 3/16, 0.5} + {-0.5, -9/16, -0.5, 0.5, 2/16, 0.5} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,beetroot=4}, diff --git a/mods/ITEMS/mcl_farming/carrots.lua b/mods/ITEMS/mcl_farming/carrots.lua index 4599d39e..dd072423 100644 --- a/mods/ITEMS/mcl_farming/carrots.lua +++ b/mods/ITEMS/mcl_farming/carrots.lua @@ -28,18 +28,20 @@ for i=1, 7 do _doc_items_longdesc = longdesc, paramtype = "light", sunlight_propagates = true, - paramtype2 = "meshoptions", + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), drop = "mcl_farming:carrot_item", - tiles = {texture}, + tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) }, + use_texture_alpha = "clip", inventory_image = texture, wield_image = texture, selection_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, sel_height, 0.5} + {-0.5, -9/16, -0.5, 0.5, sel_height - 1/16, 0.5} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, @@ -53,11 +55,13 @@ minetest.register_node("mcl_farming:carrot", { _doc_items_longdesc = S("Mature carrot plants are ready to be harvested for carrots. They won't grow any further."), paramtype = "light", sunlight_propagates = true, - paramtype2 = "meshoptions", + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", - tiles = {"farming_carrot_4.png"}, + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), + tiles = { mcl_farming:align_plantlike_nodebox_texture("farming_carrot_4.png") }, + use_texture_alpha = "clip", inventory_image = "farming_carrot_4.png", wield_image = "farming_carrot_4.png", drop = { @@ -72,7 +76,7 @@ minetest.register_node("mcl_farming:carrot", { selection_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 4/16, 0.5} + {-0.5, -9/16, -0.5, 0.5, 3/16, 0.5} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, diff --git a/mods/ITEMS/mcl_farming/potatoes.lua b/mods/ITEMS/mcl_farming/potatoes.lua index 871d6796..4be2270e 100644 --- a/mods/ITEMS/mcl_farming/potatoes.lua +++ b/mods/ITEMS/mcl_farming/potatoes.lua @@ -6,13 +6,13 @@ for i=1, 7 do local texture, selbox if i < 3 then texture = "mcl_farming_potatoes_stage_0.png" - selbox = { -0.5, -0.5, -0.5, 0.5, -5/16, 0.5 } + selbox = { -0.5, -9/16, -0.5, 0.5, -6/16, 0.5 } elseif i < 5 then texture = "mcl_farming_potatoes_stage_1.png" - selbox = { -0.5, -0.5, -0.5, 0.5, -2/16, 0.5 } + selbox = { -0.5, -9/16, -0.5, 0.5, -3/16, 0.5 } else texture = "mcl_farming_potatoes_stage_2.png" - selbox = { -0.5, -0.5, -0.5, 0.5, 2/16, 0.5 } + selbox = { -0.5, -9/16, -0.5, 0.5, 1/16, 0.5 } end local create, name, longdesc @@ -33,13 +33,15 @@ for i=1, 7 do _doc_items_entry_name = name, _doc_items_longdesc = longdesc, paramtype = "light", - paramtype2 = "meshoptions", sunlight_propagates = true, + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), drop = "mcl_farming:potato_item", - tiles = { texture }, + tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) }, + use_texture_alpha = "clip", inventory_image = texture, wield_image = texture, selection_box = { @@ -57,12 +59,14 @@ minetest.register_node("mcl_farming:potato", { description = S("Mature Potato Plant"), _doc_items_longdesc = S("Mature potato plants are ready to be harvested for potatoes. They won't grow any further."), paramtype = "light", - paramtype2 = "meshoptions", sunlight_propagates = true, + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", - tiles = {"mcl_farming_potatoes_stage_3.png"}, + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), + tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_potatoes_stage_3.png") }, + use_texture_alpha = "clip", wield_image = "mcl_farming_potatoes_stage_3.png", inventory_image = "mcl_farming_potatoes_stage_3.png", drop = { @@ -77,7 +81,7 @@ minetest.register_node("mcl_farming:potato", { selection_box = { type = "fixed", fixed = { - { -0.5, -0.5, -0.5, 0.5, 1/16, 0.5 } + { -0.5, -9/16, -0.5, 0.5, 0, 0.5 } } }, groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1}, diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index ce8f8725..8d76fc23 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -300,7 +300,6 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s minetest.register_node(stem_itemstring, stem_def) -- Register connected stems - local connected_stem_tiles = { { "blank.png", --top "blank.png", -- bottom @@ -469,3 +468,27 @@ minetest.register_lbm({ mcl_farming:grow_plant(identifier, pos, node, false, false, low_speed) end, }) + +-- This function returns a nodebox that imitates a plantlike grid (#) +-- drawtype, but is shifted 1/16 lower, into the empty space above +-- farming soil. The regular plantlike drawtype can not do this. +function mcl_farming:get_plantlike_grid_nodebox() + return { + type = "fixed", + fixed = { + { 4/16, -9/16, -8/16, 4/16, 7/16, 8/16}, + {-4/16, -9/16, -8/16, -4/16, 7/16, 8/16}, + {-8/16, -9/16, -4/16, 8/16, 7/16, -4/16}, + {-8/16, -9/16, 4/16, 8/16, 7/16, 4/16}, + } + } +end + +-- This function takes a texture and returns a modified texture where +-- the bottom row is at the top, assuming 16px × 16px textures. This +-- is used to align textures to a “plantlike” nodebox shifted 1/16 +-- below its own node – into the empty space above farming soil. +function mcl_farming:align_plantlike_nodebox_texture(texture) + local texture = texture:gsub("%^", "\\%^"):gsub(":", "\\:") + return "[combine:16x16:0,-15=" .. texture .. ":0,1=" .. texture +end diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index 9a8a9f65..1ada0515 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -39,19 +39,21 @@ for i=1,7 do _doc_items_entry_name = name, _doc_items_longdesc = longdesc, paramtype = "light", - paramtype2 = "meshoptions", + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, sunlight_propagates = true, walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), drop = "mcl_farming:wheat_seeds", - tiles = {"mcl_farming_wheat_stage_"..(i-1)..".png"}, + tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_"..(i-1)..".png") }, + use_texture_alpha = "clip", inventory_image = "mcl_farming_wheat_stage_"..(i-1)..".png", wield_image = "mcl_farming_wheat_stage_"..(i-1)..".png", selection_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, sel_heights[i], 0.5} + {-0.5, -9/16, -0.5, 0.5, sel_heights[i] - 1/16, 0.5} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1}, @@ -65,13 +67,21 @@ minetest.register_node("mcl_farming:wheat", { _doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."), sunlight_propagates = true, paramtype = "light", - paramtype2 = "meshoptions", + -- keep place_param2 for plantlike drawtype compatiblity place_param2 = 3, walkable = false, - drawtype = "plantlike", - tiles = {"mcl_farming_wheat_stage_7.png"}, + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_grid_nodebox(), + tiles = { mcl_farming:align_plantlike_nodebox_texture("mcl_farming_wheat_stage_7.png") }, + use_texture_alpha = "clip", inventory_image = "mcl_farming_wheat_stage_7.png", wield_image = "mcl_farming_wheat_stage_7.png", + selection_box = { + type = "fixed", + fixed = { + { -0.5, -9/16, -0.5, 0.5, 7/16, 0.5 } + } + }, drop = { max_items = 4, items = { From 0808b5419282a530bfc5a62ef0718a9f4f0e1189 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Mon, 18 Apr 2022 19:19:15 +0200 Subject: [PATCH 3/3] Render mcl_farming plant stems 1/16 node lower This patch shifts mcl_farming nodes that represent a stem 1/16 nodes downwards. It also replaces the plantlike drawtype of mcl_farming nodes that represent an unconnected stem (x) with a nodebox drawtype that looks like a plus (+), as Minetest has no option to rotate nodeboxes. The goal is to remove the gap between plants and farming soil with a node height of 15/16. This patch affects melon stem and pumpkin stem nodes. --- mods/ITEMS/mcl_farming/melon.lua | 8 ++-- mods/ITEMS/mcl_farming/pumpkin.lua | 8 ++-- mods/ITEMS/mcl_farming/shared_functions.lua | 49 ++++++++++++++++----- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index 38b4c713..d35b0b62 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -91,16 +91,18 @@ for s=1,7 do _doc_items_longdesc = longdesc, paramtype = "light", walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_plus_nodebox(), sunlight_propagates = true, drop = stem_drop, - tiles = {texture}, + tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) }, + use_texture_alpha = "clip", wield_image = texture, inventory_image = texture, selection_box = { type = "fixed", fixed = { - {-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15} + {-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, plant_melon_stem=s}, diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index e7b1a72b..777a9c75 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -63,16 +63,18 @@ for s=1,7 do _doc_items_longdesc = longdesc, paramtype = "light", walkable = false, - drawtype = "plantlike", + drawtype = "nodebox", + node_box = mcl_farming:get_plantlike_plus_nodebox(), sunlight_propagates = true, drop = stem_drop, - tiles = {texture}, + tiles = { mcl_farming:align_plantlike_nodebox_texture(texture) }, + use_texture_alpha = "clip", inventory_image = texture, wield_image = texture, selection_box = { type = "fixed", fixed = { - {-0.15, -0.5, -0.15, 0.15, -0.5+h, 0.15} + {-0.15, -9/16, -0.15, 0.15, -9/16+h, 0.15} }, }, groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,}, diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 8d76fc23..557ea679 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -265,7 +265,7 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s stem_def.selection_box = { type = "fixed", fixed = { - {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15} + {-0.15, -9/16, -0.15, 0.15, 7/16, 0.15} }, } end @@ -273,7 +273,20 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s stem_def.paramtype = "light" end if not stem_def.drawtype then - stem_def.drawtype = "plantlike" + stem_def.drawtype = "nodebox" + end + if not stem_def.node_box then + stem_def.node_box = mcl_farming:get_plantlike_plus_nodebox() + end + if stem_def.tiles then + for i=1,#stem_def.tiles do + stem_def.tiles[i] = mcl_farming:align_plantlike_nodebox_texture( + stem_def.tiles[i] + ) + end + end + if not stem_def.use_texture_alpha then + stem_def.use_texture_alpha = "clip" end if stem_def.walkable == nil then stem_def.walkable = false @@ -300,6 +313,9 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s minetest.register_node(stem_itemstring, stem_def) -- Register connected stems + local connected_stem_texture = mcl_farming:align_plantlike_nodebox_texture( + connected_stem_texture + ) local connected_stem_tiles = { { "blank.png", --top "blank.png", -- bottom @@ -331,16 +347,16 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s } } local connected_stem_nodebox = { - {-0.5, -0.5, 0, 0.5, 0.5, 0}, - {-0.5, -0.5, 0, 0.5, 0.5, 0}, - {0, -0.5, -0.5, 0, 0.5, 0.5}, - {0, -0.5, -0.5, 0, 0.5, 0.5}, + {-0.5, -9/16, 0, 0.5, 7/16, 0}, + {-0.5, -9/16, 0, 0.5, 7/16, 0}, + {0, -9/16, -0.5, 0, 7/16, 0.5}, + {0, -9/16, -0.5, 0, 7/16, 0.5}, } local connected_stem_selectionbox = { - {-0.1, -0.5, -0.1, 0.5, 0.2, 0.1}, - {-0.5, -0.5, -0.1, 0.1, 0.2, 0.1}, - {-0.1, -0.5, -0.1, 0.1, 0.2, 0.5}, - {-0.1, -0.5, -0.5, 0.1, 0.2, 0.1}, + {-0.1, -9/16, -0.1, 0.5, 0.2 - 1/16, 0.1}, + {-0.5, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.1}, + {-0.1, -9/16, -0.1, 0.1, 0.2 - 1/16, 0.5}, + {-0.1, -9/16, -0.5, 0.1, 0.2 - 1/16, 0.1}, } for i=1, 4 do @@ -469,6 +485,19 @@ minetest.register_lbm({ end, }) +-- This function returns a nodebox that imitates a plantlike plus (+) +-- drawtype, but is shifted 1/16 lower, into the empty space above +-- farming soil. The regular plantlike drawtype can not do this. +function mcl_farming:get_plantlike_plus_nodebox() + return { + type = "fixed", + fixed = { + { 0, -9/16, -0.15, 0, 7/16, 0.15 }, + { -0.15, -9/16, 0, 0.15, 7/16, 0 } + } + } +end + -- This function returns a nodebox that imitates a plantlike grid (#) -- drawtype, but is shifted 1/16 lower, into the empty space above -- farming soil. The regular plantlike drawtype can not do this.