1
0
Fork 0

Make end rods use a mesh model

* merged the 3 textures of the end rod into one
* made a proper image mask for the colored end rods
* (used to be hardcoded & didn't work for higher-res texture packs)
patch_skins
the-real-herowl 2024-02-02 02:31:57 +01:00
parent c31226041f
commit 1476c7ae59
7 changed files with 74 additions and 24 deletions

View File

@ -60,32 +60,20 @@ minetest.register_node("mcl_end:purpur_pillar", {
}) })
local end_rod_name = "mcl_end:end_rod" local end_rod_name = "mcl_end:end_rod"
local end_rod_side_tex = "mcl_end_end_rod_side.png"
local end_rod_def = { local end_rod_def = {
description = S("End Rod"), description = S("End Rod"),
_doc_items_longdesc = S("End rods are decorative light sources."), _doc_items_longdesc = S("End rods are decorative light sources."),
tiles = { tiles = {
"mcl_end_end_rod_top.png", "mcl_end_end_rod.png",
"mcl_end_end_rod_bottom.png",
end_rod_side_tex,
end_rod_side_tex,
end_rod_side_tex,
end_rod_side_tex,
}, },
drawtype = "nodebox", drawtype = "mesh",
mesh = "mcl_end_rod.obj",
is_ground_content = false, is_ground_content = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = minetest.LIGHT_MAX, light_source = minetest.LIGHT_MAX,
sunlight_propagates = true, sunlight_propagates = true,
groups = { dig_immediate=3, deco_block=1, destroy_by_lava_flow=1, end_rod=1 }, groups = { dig_immediate=3, deco_block=1, destroy_by_lava_flow=1, end_rod=1 },
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, -0.4375, 0.125}, -- Base
{-0.0625, -0.4375, -0.0625, 0.0625, 0.5, 0.0625}, -- Rod
},
},
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
@ -156,8 +144,7 @@ local colored_end_rods = {
{"lime", S("Lime End Rod"), "green"}, {"lime", S("Lime End Rod"), "green"},
{"lightblue", S("Light Blue End Rod"), "lightblue"}, {"lightblue", S("Light Blue End Rod"), "lightblue"},
} }
local top_mask = "^[mask:mobs_mc_empty.png\\^[fill\\:2x2\\:7,7\\:white" local end_rod_mask = "^[mask:mcl_end_end_rod_mask.png"
local side_mask = "^[mask:mobs_mc_empty.png\\^[fill\\:16x15\\:0,0\\:white"
for num, row in ipairs(colored_end_rods) do for num, row in ipairs(colored_end_rods) do
local name = row[1] local name = row[1]
local desc = row[2] local desc = row[2]
@ -168,16 +155,12 @@ for num, row in ipairs(colored_end_rods) do
def._doc_items_create_entry = false def._doc_items_create_entry = false
local side_tex local side_tex
if name == "pink" then if name == "pink" then
def.tiles[1] = def.tiles[1] .. "^(" .. def.tiles[1] .. top_mask .. "^[multiply:" .. name .. "^[hsl:0:300)" def.tiles[1] = def.tiles[1] .. "^(" .. def.tiles[1] .. end_rod_mask .. "^[multiply:" .. name .. "^[hsl:0:300)"
side_tex = end_rod_side_tex .. "^(" .. end_rod_side_tex .. side_mask .. "^[multiply:" .. name .. "^[hsl:0:300)"
elseif num > 4 then elseif num > 4 then
def.tiles[1] = def.tiles[1] .. "^(" .. def.tiles[1] .. top_mask .. "^[multiply:" .. name .. "^[hsl:0:300^[opacity:120)" def.tiles[1] = def.tiles[1] .. "^(" .. def.tiles[1] .. end_rod_mask .. "^[multiply:" .. name .. "^[hsl:0:300^[opacity:120)"
side_tex = end_rod_side_tex .. "^(" .. end_rod_side_tex .. side_mask .. "^[multiply:" .. name .. "^[hsl:0:300^[opacity:120)"
else else
def.tiles[1] = def.tiles[1] .. "^(" .. def.tiles[1] .. top_mask .. "^[multiply:" .. name .. "^[hsl:0:-100^[opacity:170)" def.tiles[1] = def.tiles[1] .. "^(" .. def.tiles[1] .. end_rod_mask .. "^[multiply:" .. name .. "^[hsl:0:-100^[opacity:170)"
side_tex = end_rod_side_tex .. "^(" .. end_rod_side_tex .. side_mask .. "^[multiply:" .. name .. "^[hsl:0:-100^[opacity:170)"
end end
for i=3, 6 do def.tiles[i] = side_tex end
minetest.register_node(end_rod_name.."_"..name, def) minetest.register_node(end_rod_name.."_"..name, def)
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",

View File

@ -0,0 +1,67 @@
# Blender 3.6.7
# www.blender.org
o Cube
v 0.125000 -0.437500 -0.125000
v 0.125000 -0.500000 -0.125000
v 0.125000 -0.437500 0.125000
v 0.125000 -0.500000 0.125000
v -0.125000 -0.437500 -0.125000
v -0.125000 -0.500000 -0.125000
v -0.125000 -0.437500 0.125000
v -0.125000 -0.500000 0.125000
v -0.062500 -0.437500 0.062500
v -0.062500 0.500000 0.062500
v -0.062500 -0.437500 -0.062500
v -0.062500 0.500000 -0.062500
v 0.062500 -0.437500 0.062500
v 0.062500 0.500000 0.062500
v 0.062500 -0.437500 -0.062500
v 0.062500 0.500000 -0.062500
vn -0.0000 1.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vt 0.250000 1.000000
vt -0.000000 1.000000
vt -0.000000 0.750000
vt 0.250000 0.750000
vt 0.250000 0.000000
vt 0.250000 0.062500
vt 0.000000 0.062500
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 0.062500
vt 0.750000 0.062500
vt 0.750000 0.000000
vt 0.000000 0.437500
vt 0.250000 0.437500
vt 0.250000 0.687500
vt 0.000000 0.687500
vt 0.500000 0.000000
vt 0.500000 0.062500
vt 1.000000 1.000000
vt 0.875000 1.000000
vt 0.875000 0.062500
vt 0.750000 1.000000
vt 0.625000 1.000000
vt 0.625000 0.062500
vt 0.500000 1.000000
vt 0.187500 0.812500
vt 0.187500 0.937500
vt 0.062500 0.937500
vt 0.062500 0.812500
s 0
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/6/2 7/7/2 8/8/2
f 8/9/3 7/10/3 5/11/3 6/12/3
f 6/13/4 2/14/4 4/15/4 8/16/4
f 2/17/5 1/18/5 3/6/5 4/5/5
f 6/12/6 5/11/6 1/18/6 2/17/6
f 9/10/3 10/19/3 12/20/3 11/21/3
f 11/21/6 12/20/6 16/22/6 15/11/6
f 15/11/5 16/22/5 14/23/5 13/24/5
f 13/24/2 14/23/2 10/25/2 9/18/2
f 11/26/4 15/27/4 13/28/4 9/29/4
f 16/27/1 12/28/1 10/29/1 14/26/1

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 B