2015-06-29 17:55:56 +00:00
-- To make recipes that will work with any dye ever made by anybody, define
-- them based on groups.
-- You can select any group of groups, based on your need for amount of colors.
-- basecolor: 9, excolor: 17, unicolor: 89
--
-- Example of one shapeless recipe using a color group:
-- Note: As this uses basecolor_*, you'd need 9 of these.
-- minetest.register_craft({
-- type = "shapeless",
2021-05-29 14:12:33 +00:00
-- output = "<mod>:item_yellow",
-- recipe = {"<mod>:item_no_color", "group:basecolor_yellow"},
2015-06-29 17:55:56 +00:00
-- })
2017-02-14 17:20:54 +00:00
mcl_dye = { }
2018-05-31 03:45:57 +00:00
2021-05-29 14:12:33 +00:00
local S = minetest.get_translator ( minetest.get_current_modname ( ) )
local string = string
2019-03-07 23:00:09 +00:00
2018-05-31 03:45:57 +00:00
-- Other mods can use these for looping through available colors
mcl_dye.basecolors = { " white " , " grey " , " black " , " red " , " yellow " , " green " , " cyan " , " blue " , " magenta " }
mcl_dye.excolors = { " white " , " lightgrey " , " grey " , " darkgrey " , " black " , " red " , " orange " , " yellow " , " lime " , " green " , " aqua " , " cyan " , " sky_blue " , " blue " , " violet " , " magenta " , " red_violet " }
2015-06-29 17:55:56 +00:00
-- Base color groups:
-- - basecolor_white
-- - basecolor_grey
-- - basecolor_black
-- - basecolor_red
-- - basecolor_yellow
-- - basecolor_green
-- - basecolor_cyan
-- - basecolor_blue
-- - basecolor_magenta
-- Extended color groups (* = equal to a base color):
-- * excolor_white
-- - excolor_lightgrey
-- * excolor_grey
-- - excolor_darkgrey
-- * excolor_black
-- * excolor_red
-- - excolor_orange
-- * excolor_yellow
-- - excolor_lime
-- * excolor_green
-- - excolor_aqua
-- * excolor_cyan
-- - excolor_sky_blue
-- * excolor_blue
-- - excolor_violet
-- * excolor_magenta
-- - excolor_red_violet
-- The whole unifieddyes palette as groups:
-- - unicolor_<excolor>
-- For the following, no white/grey/black is allowed:
-- - unicolor_medium_<excolor>
-- - unicolor_dark_<excolor>
-- - unicolor_light_<excolor>
-- - unicolor_<excolor>_s50
-- - unicolor_medium_<excolor>_s50
-- - unicolor_dark_<excolor>_s50
-- Local stuff
local dyelocal = { }
-- This collection of colors is partly a historic thing, partly something else.
dyelocal.dyes = {
2019-03-07 23:00:09 +00:00
{ " white " , " mcl_dye_white " , S ( " Bone Meal " ) , { dye = 1 , craftitem = 1 , basecolor_white = 1 , excolor_white = 1 , unicolor_white = 1 } } ,
{ " grey " , " dye_grey " , S ( " Light Grey Dye " ) , { dye = 1 , craftitem = 1 , basecolor_grey = 1 , excolor_grey = 1 , unicolor_grey = 1 } } ,
{ " dark_grey " , " dye_dark_grey " , S ( " Grey Dye " ) , { dye = 1 , craftitem = 1 , basecolor_grey = 1 , excolor_darkgrey = 1 , unicolor_darkgrey = 1 } } ,
{ " black " , " mcl_dye_black " , S ( " Ink Sac " ) , { dye = 1 , craftitem = 1 , basecolor_black = 1 , excolor_black = 1 , unicolor_black = 1 } } ,
{ " violet " , " dye_violet " , S ( " Purple Dye " ) , { dye = 1 , craftitem = 1 , basecolor_magenta = 1 , excolor_violet = 1 , unicolor_violet = 1 } } ,
{ " blue " , " mcl_dye_blue " , S ( " Lapis Lazuli " ) , { dye = 1 , craftitem = 1 , basecolor_blue = 1 , excolor_blue = 1 , unicolor_blue = 1 } } ,
{ " lightblue " , " mcl_dye_light_blue " , S ( " Light Blue Dye " ) , { dye = 1 , craftitem = 1 , basecolor_blue = 1 , excolor_blue = 1 , unicolor_light_blue = 1 } } ,
{ " cyan " , " dye_cyan " , S ( " Cyan Dye " ) , { dye = 1 , craftitem = 1 , basecolor_cyan = 1 , excolor_cyan = 1 , unicolor_cyan = 1 } } ,
{ " dark_green " , " dye_dark_green " , S ( " Cactus Green " ) , { dye = 1 , craftitem = 1 , basecolor_green = 1 , excolor_green = 1 , unicolor_dark_green = 1 } } ,
{ " green " , " mcl_dye_lime " , S ( " Lime Dye " ) , { dye = 1 , craftitem = 1 , basecolor_green = 1 , excolor_green = 1 , unicolor_green = 1 } } ,
{ " yellow " , " dye_yellow " , S ( " Dandelion Yellow " ) , { dye = 1 , craftitem = 1 , basecolor_yellow = 1 , excolor_yellow = 1 , unicolor_yellow = 1 } } ,
Add `compostability` to node definition group.
* mcl_cake/init.lua (cake);
* mcl_core/craftitems.lua (apple);
* mcl_core/nodes_base.lua (dirt with grass);
* mcl_core/nodes_cactuscane.lua (cactus, sugarcane);
* mcl_core/nodes_climb.lua (vines);
* mcl_core/nodes_trees.lua (leaves, saplings);
* mcl_dye/init.lua (cocoa beans);
* mcl_farming/beetroot.lua (beetroot, & seeds);
* mcl_farming/carrots.lua (carrot);
* mcl_farming/melon.lua (melon, & slice, & seeds);
* mcl_farming/potatoes.lua (potato, baked potato);
* mcl_farming/pumpkin.lua (pumpkin, carved &, & seeds, & pie);
* mcl_farming/wheat.lua (wheat, cookie, bread, hay block);
* mcl_flowers/init.lua (flowers, ferns, grass, & tall variants);
* mcl_mushrooms/small.lua (red and brown mushrooms);
* mcl_mushrooms/huge.lua (red and brown huge mushrooms);
* mcl_nether/init.lua (nether wart block);
* mcl_nether/nether_wart.lua (nether wart);
* mcl_ocean/kelp.lua (kelp, dried &, & block);
* mcl_ocean/sea_pickle.lua (sea pickle);
* mcl_ocean/seagrass.lua (seagrass).
2022-03-29 10:54:51 +00:00
{ " brown " , " mcl_dye_brown " , S ( " Cocoa Beans " ) , { dye = 1 , craftitem = 1 , basecolor_brown = 1 , excolor_orange = 1 , unicolor_dark_orange = 1 , compostability = 65 } } ,
2019-03-07 23:00:09 +00:00
{ " orange " , " dye_orange " , S ( " Orange Dye " ) , { dye = 1 , craftitem = 1 , basecolor_orange = 1 , excolor_orange = 1 , unicolor_orange = 1 } } ,
{ " red " , " dye_red " , S ( " Rose Red " ) , { dye = 1 , craftitem = 1 , basecolor_red = 1 , excolor_red = 1 , unicolor_red = 1 } } ,
{ " magenta " , " dye_magenta " , S ( " Magenta Dye " ) , { dye = 1 , craftitem = 1 , basecolor_magenta = 1 , excolor_red_violet = 1 , unicolor_red_violet = 1 } } ,
{ " pink " , " dye_pink " , S ( " Pink Dye " ) , { dye = 1 , craftitem = 1 , basecolor_red = 1 , excolor_red = 1 , unicolor_light_red = 1 } } ,
2015-06-29 17:55:56 +00:00
}
2018-05-31 03:45:57 +00:00
dyelocal.unicolor_to_dye_id = { }
for d = 1 , # dyelocal.dyes do
2019-02-07 06:10:10 +00:00
for k , _ in pairs ( dyelocal.dyes [ d ] [ 4 ] ) do
2018-05-31 03:45:57 +00:00
if string.sub ( k , 1 , 9 ) == " unicolor_ " then
dyelocal.unicolor_to_dye_id [ k ] = dyelocal.dyes [ d ] [ 1 ]
end
end
end
-- Takes an unicolor group name (e.g. “unicolor_white”) and returns a corresponding dye name (if it exists), nil otherwise.
2021-05-29 14:12:33 +00:00
function mcl_dye . unicolor_to_dye ( unicolor_group )
2019-03-14 23:10:07 +00:00
local color = dyelocal.unicolor_to_dye_id [ unicolor_group ]
if color then
return " mcl_dye: " .. color
else
return nil
end
2018-05-31 03:45:57 +00:00
end
2015-06-29 17:55:56 +00:00
-- Define items
for _ , row in ipairs ( dyelocal.dyes ) do
local name = row [ 1 ]
2022-05-01 10:33:19 +00:00
-- White dye is an alias and brown dye is defined explicitly below
2017-02-18 15:06:18 +00:00
if name ~= " white " and name ~= " brown " then
2019-02-07 06:10:10 +00:00
local img = row [ 2 ]
local description = row [ 3 ]
local groups = row [ 4 ]
2017-02-18 15:06:18 +00:00
local item_name = " mcl_dye: " .. name
2019-02-07 06:10:10 +00:00
local item_image = img .. " .png "
2017-02-18 15:06:18 +00:00
minetest.register_craftitem ( item_name , {
inventory_image = item_image ,
description = description ,
2019-03-07 23:00:09 +00:00
_doc_items_longdesc = S ( " This item is a dye which is used for dyeing and crafting. " ) ,
_doc_items_usagehelp = S ( " Rightclick on a sheep to dye its wool. Other things are dyed by crafting. " ) ,
2017-02-18 15:06:18 +00:00
groups = groups ,
stack_max = 64 ,
} )
end
2015-06-29 17:55:56 +00:00
end
2022-05-01 10:33:19 +00:00
-- Legacy support for things now in mcl_bone_meal.
-- These shims will at some time in the future be removed.
--
2021-11-06 13:12:03 +00:00
function mcl_dye . add_bone_meal_particle ( pos , def )
2022-05-01 10:33:19 +00:00
minetest.log ( " warning " , " mcl_dye.add_bone_meal_particles() is deprecated. Read mcl_bone_meal/API.md! " )
mcl_bone_meal.add_bone_meal_particle ( pos , def )
2021-06-03 18:13:13 +00:00
end
2017-02-11 18:03:26 +00:00
2021-11-06 13:12:03 +00:00
function mcl_dye . register_on_bone_meal_apply ( func )
2022-05-01 10:33:19 +00:00
minetest.log ( " warning " , " mcl_dye.register_on_bone_meal_apply() is deprecated. Read mcl_bone_meal/API.md! " )
mcl_bone_meal.register_on_bone_meal_apply ( func )
2021-11-06 13:12:03 +00:00
end
2022-05-01 10:33:19 +00:00
minetest.register_alias ( " mcl_dye:white " , " mcl_bone_meal:bone_meal " )
-- End of legacy support
2015-06-29 17:55:56 +00:00
2017-02-18 15:06:18 +00:00
minetest.register_craftitem ( " mcl_dye:brown " , {
2019-02-07 06:10:10 +00:00
inventory_image = " mcl_dye_brown.png " ,
2020-02-19 03:54:17 +00:00
_tt_help = S ( " Grows at the side of jungle trees " ) ,
2019-03-07 23:00:09 +00:00
_doc_items_longdesc = S ( " Cocoa beans are a brown dye and can be used to plant cocoas. " ) ,
_doc_items_usagehelp = S ( " Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa. " ) ,
description = S ( " Cocoa Beans " ) ,
2017-02-18 15:06:18 +00:00
stack_max = 64 ,
2019-02-07 06:10:10 +00:00
groups = dyelocal.dyes [ 12 ] [ 4 ] ,
2017-03-02 14:50:53 +00:00
on_place = function ( itemstack , placer , pointed_thing )
2017-02-18 19:23:26 +00:00
return mcl_cocoas.place ( itemstack , placer , pointed_thing , " mcl_cocoas:cocoa_1 " )
2017-02-18 15:06:18 +00:00
end ,
} )
2017-01-05 06:23:25 +00:00
-- Dye mixing
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:dark_grey 2 " ,
recipe = { " mcl_dye:black " , " mcl_dye:white " } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:lightblue 2 " ,
recipe = { " mcl_dye:blue " , " mcl_dye:white " } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:grey 3 " ,
recipe = { " mcl_dye:black " , " mcl_dye:white " , " mcl_dye:white " } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:grey 2 " ,
recipe = { " mcl_dye:dark_grey " , " mcl_dye:white " } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:green 2 " ,
recipe = { " mcl_dye:dark_green " , " mcl_dye:white " } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:magenta 4 " ,
recipe = { " mcl_dye:blue " , " mcl_dye:white " , " mcl_dye:red " , " mcl_dye:red " } ,
2017-01-05 06:23:25 +00:00
} )
2017-03-14 23:51:11 +00:00
minetest.register_craft ( {
type = " shapeless " ,
output = " mcl_dye:magenta 3 " ,
recipe = { " mcl_dye:pink " , " mcl_dye:red " , " mcl_dye:blue " } ,
} )
minetest.register_craft ( {
type = " shapeless " ,
output = " mcl_dye:magenta 2 " ,
recipe = { " mcl_dye:violet " , " mcl_dye:pink " } ,
} )
2017-01-05 06:23:25 +00:00
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:pink 2 " ,
recipe = { " mcl_dye:red " , " mcl_dye:white " } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:cyan 2 " ,
recipe = { " mcl_dye:blue " , " mcl_dye:dark_green " } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:violet 2 " ,
recipe = { " mcl_dye:blue " , " mcl_dye:red " } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " shapeless " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:orange 2 " ,
recipe = { " mcl_dye:yellow " , " mcl_dye:red " } ,
2017-01-05 06:23:25 +00:00
} )
-- Dye creation
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:yellow " ,
2017-01-31 22:32:56 +00:00
recipe = { { " mcl_flowers:dandelion " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:yellow 2 " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:sunflower " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:lightblue " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:blue_orchid " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:grey " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:azure_bluet " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:grey " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:oxeye_daisy " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:grey " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:tulip_white " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:magenta " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:allium " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:magenta 2 " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:lilac " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:orange " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:tulip_orange " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:pink " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:tulip_pink " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:pink 2 " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:peony " } } ,
2017-01-05 06:23:25 +00:00
} )
2017-03-14 23:51:11 +00:00
minetest.register_craft ( {
output = " mcl_dye:red " ,
recipe = { { " mcl_farming:beetroot_item " } } ,
} )
2017-01-05 06:23:25 +00:00
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:red " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:poppy " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:red " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:tulip_red " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
2017-01-30 14:33:04 +00:00
output = " mcl_dye:red 2 " ,
2017-01-31 11:03:18 +00:00
recipe = { { " mcl_flowers:rose_bush " } } ,
2017-01-05 06:23:25 +00:00
} )
minetest.register_craft ( {
type = " cooking " ,
2017-01-30 14:33:04 +00:00
output = " mcl_dye:dark_green " ,
2017-01-31 22:32:56 +00:00
recipe = " mcl_core:cactus " ,
2017-01-05 06:23:25 +00:00
cooktime = 10 ,
} )