1 local S
= minetest
.get_translator("mcl_wool")
2 local mod_doc
= minetest
.get_modpath("doc")
4 -- minetest/wool/init.lua
6 -- Backwards compatibility with jordach's 16-color wool mod
7 minetest
.register_alias("mcl_wool:dark_blue", "wool:blue")
8 minetest
.register_alias("mcl_wool:gold", "wool:yellow")
11 -- This uses a trick: you can first define the recipes using all of the base
12 -- colors, and then some recipes using more specific colors for a few non-base
13 -- colors available. When crafting, the last recipes will be checked first.
15 -- name, texture, wool desc., carpet desc., dye, color_group
16 {"white", "wool_white", S("White Wool"), S("White Carpet"), nil, "unicolor_white"},
17 {"grey", "wool_dark_grey", S("Grey Wool"), S("Grey Carpet"), "dark_grey", "unicolor_darkgrey"},
18 {"silver", "wool_grey", S("Light Grey Wool"), S("Light Grey Carpet"), "grey", "unicolor_grey"},
19 {"black", "wool_black", S("Black Wool"), S("Black Carpet"), "black", "unicolor_black"},
20 {"red", "wool_red", S("Red Wool"), S("Red Carpet"), "red", "unicolor_red"},
21 {"yellow", "wool_yellow", S("Yellow Wool"), S("Yellow Carpet"), "yellow", "unicolor_yellow"},
22 {"green", "wool_dark_green", S("Green Wool"), S("Green Carpet"), "dark_green", "unicolor_dark_green"},
23 {"cyan", "wool_cyan", S("Cyan Wool"), S("Cyan Carpet"), "cyan", "unicolor_cyan"},
24 {"blue", "wool_blue", S("Blue Wool"), S("Blue Carpet"), "blue", "unicolor_blue"},
25 {"magenta", "wool_magenta", S("Magenta Wool"), S("Magenta Carpet"), "magenta", "unicolor_red_violet"},
26 {"orange", "wool_orange", S("Orange Wool"), S("Orange Carpet"), "orange", "unicolor_orange"},
27 {"purple", "wool_violet", S("Purple Wool"), S("Purple Carpet"), "violet", "unicolor_violet"},
28 {"brown", "wool_brown", S("Brown Wool"), S("Brown Carpet"), "brown", "unicolor_dark_orange"},
29 {"pink", "wool_pink", S("Pink Wool"), S("Pink Carpet"), "pink", "unicolor_light_red"},
30 {"lime", "mcl_wool_lime", S("Lime Wool"), S("Lime Carpet"), "green", "unicolor_green"},
31 {"light_blue", "mcl_wool_light_blue", S("Light Blue Wool"), S("Light Blue Carpet"), "lightblue", "unicolor_light_blue"},
33 local canonical_color
= "white"
35 for _
, row
in ipairs(wool
.dyes
) do
37 local texture
= row
[2]
38 local desc_wool
= row
[3]
39 local desc_carpet
= row
[4]
41 local color_group
= row
[6]
42 local longdesc_wool
, longdesc_carpet
, create_entry
, name_wool
, name_carpet
43 local is_canonical
= name
== canonical_color
46 longdesc_wool
= S("Wool is a decorative block which comes in many different colors.")
47 longdesc_carpet
= S("Carpets are thin floor covers which come in many different colors.")
49 name_carpet
= S("Carpet")
55 minetest
.register_node("mcl_wool:"..name
, {
56 description
= desc_wool
,
57 _doc_items_create_entry
= create_entry
,
58 _doc_items_entry_name
= name_wool
,
59 _doc_items_longdesc
= longdesc_wool
,
61 is_ground_content
= false,
62 tiles
= {texture
..".png"},
63 groups
= {handy
=1,shearsy_wool
=1, flammable
=1,fire_encouragement
=30, fire_flammability
=60, wool
=1,building_block
=1,[color_group
]=1},
64 sounds
= mcl_sounds
.node_sound_wool_defaults(),
66 _mcl_blast_resistance
= 0.8,
68 minetest
.register_node("mcl_wool:"..name
.."_carpet", {
69 description
= desc_carpet
,
70 _doc_items_create_entry
= create_entry
,
71 _doc_items_entry_name
= name_carpet
,
72 _doc_items_longdesc
= longdesc_carpet
,
74 walkable
= false, -- See <https://minecraft.gamepedia.com/Materials>
75 is_ground_content
= false,
76 tiles
= {texture
..".png"},
77 wield_image
= texture
..".png",
78 wield_scale
= { x
=1, y
=1, z
=0.5 },
79 groups
= {handy
=1, carpet
=1,attached_node
=1,flammable
=1,fire_encouragement
=60, fire_flammability
=20, dig_by_water
=1,deco_block
=1,[color_group
]=1},
80 sounds
= mcl_sounds
.node_sound_wool_defaults(),
82 sunlight_propagates
= true,
88 {-8/16, -8/16, -8/16, 8/16, -7/16, 8/16},
92 _mcl_blast_resistance
= 0.1,
94 if mod_doc
and not is_canonical
then
95 doc
.add_entry_alias("nodes", "mcl_wool:"..canonical_color
, "nodes", "mcl_wool:"..name
)
96 doc
.add_entry_alias("nodes", "mcl_wool:"..canonical_color
.."_carpet", "nodes", "mcl_wool:"..name
.."_carpet")
99 -- Crafting from dye and white wool
100 minetest
.register_craft({
102 output
= 'mcl_wool:'..name
,
103 recipe
= {"mcl_dye:"..dye
, 'mcl_wool:white'},
106 minetest
.register_craft({
107 output
= 'mcl_wool:'..name
..'_carpet 3',
108 recipe
= {{'mcl_wool:'..name
, 'mcl_wool:'..name
}},
112 minetest
.register_craft({
113 output
= "mcl_wool:white",
115 { "mcl_mobitems:string", "mcl_mobitems:string" },
116 { "mcl_mobitems:string", "mcl_mobitems:string" },
120 minetest
.register_craft({
122 recipe
= "group:wool",
125 minetest
.register_craft({
127 recipe
= "group:carpet",
128 -- Original value: 3.35