DEMO MOD COMMIT

master
wsor 2021-04-06 12:19:36 -04:00
commit bf784bd59c
4 changed files with 47 additions and 0 deletions

46
init.lua Normal file
View File

@ -0,0 +1,46 @@
-- This uses a trick: you can first define the recipes using all of the base
-- colors, and then some recipes using more specific colors for a few non-base
-- colors available. When crafting, the last recipes will be checked first.
local dyes = {
{"white", "White", "basecolor_white"},
{"grey", "Grey", "basecolor_grey"},
{"black", "Black", "basecolor_black"},
{"red", "Red", "basecolor_red"},
{"yellow", "Yellow", "basecolor_yellow"},
{"green", "Green", "basecolor_green"},
{"cyan", "Cyan", "basecolor_cyan"},
{"blue", "Blue", "basecolor_blue"},
{"magenta", "Magenta", "basecolor_magenta"},
{"orange", "Orange", "excolor_orange"},
{"violet", "Violet", "excolor_violet"},
{"brown", "Brown", "unicolor_dark_orange"},
{"pink", "Pink", "unicolor_light_red"},
{"dark_grey", "Dark Grey", "unicolor_darkgrey"},
{"dark_green", "Dark Green", "unicolor_dark_green"},
}
minetest.register_node("i3_color_demo:wool", {
description = "Wool",
tiles = {"wool_block.png"},
paramtype2 = "color",
palette = "wool_palette.png",
is_ground_content = false,
groups = {oddly_breakable_by_hand = 3,},
sounds = default.node_sound_defaults(),
})
for counter, dye in pairs(dyes) do
minetest.register_craft({
output = minetest.itemstring_with_palette("i3_color_demo:wool", counter - 1),
type = "shapeless",
recipe = {
"i3_color_demo:wool",
"dye:" .. dye[1]
},
})
end
-- modified https://gist.github.com/juhdanad/433a0aa7094ae0dceaf00924d6fd1e3b and
-- https://github.com/minetest/minetest/pull/5640#issuecomment-302868234
-- demo for https://github.com/minetest-mods/i3/issues/18

1
mod.conf Normal file
View File

@ -0,0 +1 @@
depends = default, dye

BIN
textures/wool_block.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

BIN
textures/wool_palette.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B