From 3889abbaf4ea980ea8a39846724bade0f4974ef7 Mon Sep 17 00:00:00 2001 From: kabou Date: Sun, 1 May 2022 12:33:19 +0200 Subject: [PATCH] Add mcl_bone_meal. * New mod mcl_bone_meal, replacing bone meal functionality previously held in mcl_dye. * Improve bonemealing API using callbacks in the nodes that support bonemealing. * Rename bone meal item to `"mcl_bone_meal:bone_meal"` and updated its crafting recipe. * Implement legacy compatibility for older bone meal API. * Remove all non dye-related bone meal code, texture and translations from mcl_dye. * Add legacy compatibility shims to mcl_dye that refer to mcl_bone_meal. * Add an alias for "mcl_dye:white" to keep mcl_dye and its API working uniterrupted. * Update mod depends in mcl_dye mod.conf. --- mods/ITEMS/mcl_bone_meal/API.md | 54 ++++ mods/ITEMS/mcl_bone_meal/init.lua | 159 ++++++++++ mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr | 5 + mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr | 4 + mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr | 5 + mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr | 5 + mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr | 5 + .../mcl_bone_meal/locale/mcl_dye.zh_TW.tr | 5 + mods/ITEMS/mcl_bone_meal/locale/template.txt | 6 + mods/ITEMS/mcl_bone_meal/mod.conf | 3 + .../mcl_bone_meal/textures/mcl_bone_meal.png | Bin mods/ITEMS/mcl_dye/init.lua | 276 +----------------- mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr | 3 - mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr | 4 - mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr | 3 - mods/ITEMS/mcl_dye/locale/template.txt | 4 - mods/ITEMS/mcl_dye/mod.conf | 3 +- 19 files changed, 259 insertions(+), 293 deletions(-) create mode 100644 mods/ITEMS/mcl_bone_meal/API.md create mode 100644 mods/ITEMS/mcl_bone_meal/init.lua create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr create mode 100644 mods/ITEMS/mcl_bone_meal/locale/template.txt create mode 100644 mods/ITEMS/mcl_bone_meal/mod.conf rename textures/mcl_bone_meal_bone_meal.png => mods/ITEMS/mcl_bone_meal/textures/mcl_bone_meal.png (100%) diff --git a/mods/ITEMS/mcl_bone_meal/API.md b/mods/ITEMS/mcl_bone_meal/API.md new file mode 100644 index 000000000..f0402aae3 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/API.md @@ -0,0 +1,54 @@ + +# Bone meal API +Bonemealing callbacks and particle functions. + + +## _mcl_on_bonemealing(pointed_thing, placer) +The bone meal API provides a callback definition that nodes can use to +register a handler that is executed when a bone meal item is used on it. + +Nodes that wish to use the bone meal API should in their node registration +define a callback handler named `_mcl_on_bonemealing`. This handler is a + + `function(pointed_thing, placer)` + +Its arguments are: +* `pointed_thing`: exact pointing location (see Minetest API), where the + bone meal is applied +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! + +The function should return `true` if the bonemealing was succesful. + +It is for all intents and purposes up to the callback defined in the node to +decide how to handle the effect that bone meal has on that particular node. + +The `on_place` code in the bone meal item will spawn bone meal particles and +decrease the bone meal itemstack if the handler returned `true` and the +`placer` is not in creative mode. + + +## mcl_bone_meal.add_bone_meal_particle(pos, def) +Spawns standard or custom bone meal particles. +* `pos`: position, is ignored if you define def.minpos and def.maxpos +* `def`: (optional) particle definition; see minetest.add_particlespawner() + for more details. + + +# Legacy API +The bone meal API also provides a legacy compatibility function. This +function is not meant to be continued and callers should migrate to the +newer bonemealing API. + +## mcl_bone_meal.register_on_bone_meal_apply(function(pointed_thing, placer)) +Called when the bone meal is applied anywhere. +* `pointed_thing`: exact pointing location (see Minetest API), where the + bone meal is applied +* `placer`: ObjectRef of the player who aplied the bone meal, can be nil! +This function is deprecated and will be removed at some time in the future. + +## mcl_dye.add_bone_meal_particle(pos, def) +## mcl_dye.register_on_bone_meal_apply(function(pointed_thing, user)) +These shims in mcl_dye that point to corresponding legacy compatibility +functions in mcl_bone_meal remain for legacy callers that have not yet been +updated to the new API. These shims will be removed at some time in the +future. diff --git a/mods/ITEMS/mcl_bone_meal/init.lua b/mods/ITEMS/mcl_bone_meal/init.lua new file mode 100644 index 000000000..a5487d57e --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/init.lua @@ -0,0 +1,159 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + +local longdesc = S( + "Bone meal is a white dye and also useful as a fertilizer to " .. + "speed up the growth of many plants." +) +local usagehelp = S( + "Rightclick a sheep to turn its wool white. Rightclick a plant " .. + "to speed up its growth. Note that not all plants can be " .. + "fertilized like this. When you rightclick a grass block, tall " .. + "grass and flowers will grow all over the place." +) + +mcl_bone_meal = {} + +-- Bone meal particle api: + +--- Spawns bone meal particles. +-- pos: where the particles spawn +-- def: particle spawner parameters, see minetest.add_particlespawner() for +-- details on these parameters. +-- +function mcl_bone_meal.add_bone_meal_particle(pos, def) + if not def then + def = {} + end + minetest.add_particlespawner({ + amount = def.amount or 10, + time = def.time or 0.1, + minpos = def.minpos or vector.subtract(pos, 0.5), + maxpos = def.maxpos or vector.add(pos, 0.5), + minvel = def.minvel or vector.new(-0.01, 0.01, -0.01), + maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01), + minacc = def.minacc or vector.new(0, 0, 0), + maxacc = def.maxacc or vector.new(0, 0, 0), + minexptime = def.minexptime or 1, + maxexptime = def.maxexptime or 4, + minsize = def.minsize or 0.7, + maxsize = def.maxsize or 2.4, + texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color + glow = def.glow or 1, + }) +end + +-- Begin legacy bone meal API. +-- +-- Compatibility code for legacy users of the old bone meal API. +-- This code will be removed at some time in the future. +-- +mcl_bone_meal.bone_meal_callbacks = {} + +-- Shims for the old API are still available in mcl_dye and refer to +-- the real functions in mcl_bone_meal. +-- +function mcl_bone_meal.register_on_bone_meal_apply(func) + minetest.log("warning", "register_on_bone_meal_apply(func) is deprecated. Read mcl_bone_meal/API.md!") + table.insert(mcl_bone_meal.bone_meal_callbacks, func) +end + +-- Legacy registered users of the old API are handled through this function. +-- +local function apply_bone_meal(pointed_thing, placer) + for _, func in pairs(mcl_bone_meal.bone_meal_callbacks) do + if func(pointed_thing, placer) then + return true + end + end + + local pos = pointed_thing.under + local n = minetest.get_node(pos) + if n.name == "" then return false end + + -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages + if string.find(n.name, "mcl_farming:sweet_berry_bush_") then + mcl_dye.add_bone_meal_particle(pos) + if n.name == "mcl_farming:sweet_berry_bush_3" then + return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry") + else + return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 0, true) + end + return true +--[[ + Here for when Bonemeal becomes an api, there's code if needed for handling applying to bamboo. + -- Handle applying bonemeal to bamboo. + elseif mcl_bamboo.is_bamboo(n.name) then + local success = mcl_bamboo.grow_bamboo(pos, true) + if success then + mcl_dye.add_bone_meal_particle(pos) + end + return success +--]] + end + + return false +end +-- End legacy bone meal API + +minetest.register_craftitem("mcl_bone_meal:bone_meal", { + inventory_image = "mcl_bone_meal.png", + description = S("Bone Meal"), + _tt_help = S("Speeds up plant growth"), + _doc_items_longdesc = longdesc, + _doc_items_usagehelp = usagehelp, + stack_max = 64, + groups = {craftitem=1, dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}, + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.under + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + -- Use pointed node's on_rightclick function first, if present. + if placer and not placer:get_player_control().sneak then + if ndef and ndef.on_rightclick then + return ndef.on_rightclick(pos, node, placer, itemstack, pointed_thing) or itemstack + end + end + -- If the pointed node can be bonemealed, let it handle the processing. + if ndef and ndef._mcl_on_bonemealing then + if ndef._mcl_on_bonemealing(pointed_thing, placer) then + mcl_bone_meal.add_bone_meal_particle(pos) + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + end + -- Otherwise try the legacy API. + elseif apply_bone_meal(pointed_thing, placer) and + not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + return itemstack + end, + _on_dispense = function(itemstack, pos, droppos, dropnode, dropdir) + local pointed_thing + if dropnode.name == "air" then + pointed_thing = {above = droppos, under = vector.offset(droppos, 0, -1 ,0)} + else + pointed_thing = {above = pos, under = droppos} + end + local node = minetest.get_node(pointed_thing.under) + local ndef = minetest.registered_nodes[node.name] + -- If the pointed node can be bonemealed, let it handle the processing. + if ndef and ndef._mcl_on_bonemealing then + if ndef._mcl_on_bonemealing(pointed_thing, nil) then + itemstack:take_item() + end + else + -- Otherwise try the legacy API. + if apply_bone_meal(pointed_thing, nil) then + itemstack:take_item() + end + end + return itemstack + end, + _dispense_into_walkable = true +}) + +minetest.register_craft({ + output = "mcl_bone_meal:bone_meal 3", + recipe = {{"mcl_mobitems:bone"}}, +}) diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr new file mode 100644 index 000000000..22aad0ae5 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.de.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Knochenmehl +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Knochenmehl ist ein weißer Farbstoff und auch nützlich als Dünger, um das Wachstum vieler Pflanzen zu beschleunigen. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Rechtsklicken Sie auf ein Schaf, um die Wolle weiß einzufärben. Rechtsklicken Sie auf eine Pflanze, um ihr Wachstum zu beschleunigen. Beachten Sie, dass nicht alle Pflanzen darauf ansprechen. Benutzen Sie es auf einem Grasblock, wächst viel hohes Gras und vielleicht auch ein paar Blumen. +Speeds up plant growth=Beschleunigt Pflanzenwachstum diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr new file mode 100644 index 000000000..267f244bb --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.es.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_bone_meal +Bone Meal=Harina de hueso +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar. diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr new file mode 100644 index 000000000..5cb6c42b6 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.fr.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Farine d'Os +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et également utile comme engrais pour accélérer la croissance de nombreuses plantes. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Notez que toutes les plantes ne peuvent pas être fertilisées comme ça. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent partout. +Speeds up plant growth=Accélère la croissance des plantes diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr new file mode 100644 index 000000000..7c17c4032 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.pl.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Mączka kostna +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Mączka kostna to biała farba i przydatny nawóz, który przyspiesza rośnięcie wielu roślin. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Kliknij prawym na owcę, aby wybielić jej wełnę. Kliknij prawym na roślinę aby przyspieszyć jej wzrost. Zważ, że nie na wszystkie rośliny to tak działa. Gdy klikniesz prawym na blok trawy, wysoka trawa wyrośnie wokół. +Speeds up plant growth=Przyspiesza wzrost roślin diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr new file mode 100644 index 000000000..83b9fbe02 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.ru.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=Костная мука +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Костная мука является белым красителем. Она также полезна в качестве удобрения, чтобы увеличить скорость роста многих растений. +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Кликните правой по овце, чтобы сделать её шерсть белой. Кликните правой по растению, чтобы ускорить его рост. Имейте в виду, что не все растения можно удобрять таким способом. Если вы кликнете по травяному блоку, то на этом месте вырастет высокая трава и цветы. +Speeds up plant growth=Ускоряет рост растений diff --git a/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr new file mode 100644 index 000000000..e9c240d19 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/mcl_dye.zh_TW.tr @@ -0,0 +1,5 @@ +# textdomain: mcl_bone_meal +Bone Meal=骨粉 +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=骨粉是一種白色染料,也可作為肥料,加速許多植物的生長。 +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=右鍵點擊一隻羊,使其羊毛變白。右鍵點擊一株植物以加快其生長速度。注意,不是所有的植物都能像這樣施肥。當你右鍵點擊一個草方時,高高的草和花會到處生長。 +Speeds up plant growth=加速植物生長 diff --git a/mods/ITEMS/mcl_bone_meal/locale/template.txt b/mods/ITEMS/mcl_bone_meal/locale/template.txt new file mode 100644 index 000000000..4e295dc57 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/locale/template.txt @@ -0,0 +1,6 @@ +# textdomain: mcl_bone_meal +Bone Meal= +Rightclick on a sheep to dye its wool. Other things are dyed by crafting.= +Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.= +Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.= +Speeds up plant growth= diff --git a/mods/ITEMS/mcl_bone_meal/mod.conf b/mods/ITEMS/mcl_bone_meal/mod.conf new file mode 100644 index 000000000..439973540 --- /dev/null +++ b/mods/ITEMS/mcl_bone_meal/mod.conf @@ -0,0 +1,3 @@ +name = mcl_bone_meal +description = Bone meal can be used as a fertilizer and as a dye. +author = kabou diff --git a/textures/mcl_bone_meal_bone_meal.png b/mods/ITEMS/mcl_bone_meal/textures/mcl_bone_meal.png similarity index 100% rename from textures/mcl_bone_meal_bone_meal.png rename to mods/ITEMS/mcl_bone_meal/textures/mcl_bone_meal.png diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index b35904fc4..40f75e252 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -15,7 +15,6 @@ mcl_dye = {} local S = minetest.get_translator(minetest.get_current_modname()) -local math = math local string = string -- Base color groups: @@ -115,279 +114,19 @@ for _, row in pairs(dyes) do }) end --- Bone meal code to be moved into its own mod. +-- Legacy support for things now in mcl_bone_meal. +-- These shims will at some time in the future be removed. -- function mcl_dye.add_bone_meal_particle(pos, def) - if not def then - def = {} - end - minetest.add_particlespawner({ - amount = def.amount or 10, - time = def.time or 0.1, - minpos = def.minpos or vector.subtract(pos, 0.5), - maxpos = def.maxpos or vector.add(pos, 0.5), - minvel = def.minvel or vector.new(-0.01, 0.01, -0.01), - maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01), - minacc = def.minacc or vector.new(0, 0, 0), - maxacc = def.maxacc or vector.new(0, 0, 0), - minexptime = def.minexptime or 1, - maxexptime = def.maxexptime or 4, - minsize = def.minsize or 0.7, - maxsize = def.maxsize or 2.4, - texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color - glow = def.glow or 1, - }) + 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) end -mcl_dye.bone_meal_callbacks = {} - function mcl_dye.register_on_bone_meal_apply(func) - table.insert(mcl_dye.bone_meal_callbacks, func) + 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) end -local function apply_bone_meal(pointed_thing, user) - -- Bone meal currently spawns all flowers found in the plains. - local flowers_table_plains = { - "mcl_flowers:dandelion", - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - - "mcl_flowers:oxeye_daisy", - "mcl_flowers:tulip_orange", - "mcl_flowers:tulip_red", - "mcl_flowers:tulip_white", - "mcl_flowers:tulip_pink", - "mcl_flowers:azure_bluet", - } - local flowers_table_simple = { - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - } - local flowers_table_swampland = { - "mcl_flowers:blue_orchid", - } - local flowers_table_flower_forest = { - "mcl_flowers:dandelion", - "mcl_flowers:poppy", - "mcl_flowers:oxeye_daisy", - "mcl_flowers:tulip_orange", - "mcl_flowers:tulip_red", - "mcl_flowers:tulip_white", - "mcl_flowers:tulip_pink", - "mcl_flowers:azure_bluet", - "mcl_flowers:allium", - } - - local pos = pointed_thing.under - local n = minetest.get_node(pos) - if n.name == "" then return false end - - if mcl_util.check_area_protection(pos, pointed_thing.above, user) then - return false - end - - for _, func in pairs(mcl_dye.bone_meal_callbacks) do - if func(pointed_thing, user) then - return true - end - end - - if minetest.get_item_group(n.name, "sapling") >= 1 then - mcl_dye.add_bone_meal_particle(pos) - -- Saplings: 45% chance to advance growth stage - if math.random(1, 100) <= 45 then - if n.name == "mcl_cherry_blossom:cherrysapling" then - return mcl_cherry_blossom.generate_cherry_tree(pos) -- If cherry blossom sapling, run that callback instead. - else - return mcl_core.grow_sapling(pos, n) - end - end - elseif minetest.get_item_group(n.name, "mushroom") == 1 then - mcl_dye.add_bone_meal_particle(pos) - -- Try to grow huge mushroom - - -- Must be on a dirt-type block - local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}) - if below.name ~= "mcl_core:mycelium" and below.name ~= "mcl_core:dirt" and minetest.get_item_group(below.name, "grass_block") ~= 1 and below.name ~= "mcl_core:coarse_dirt" and below.name ~= "mcl_core:podzol" then - return false - end - - -- Select schematic - local schematic, offset, height - if n.name == "mcl_mushrooms:mushroom_brown" then - schematic = minetest.get_modpath("mcl_mushrooms").."/schematics/mcl_mushrooms_huge_brown.mts" - offset = { x = -3, y = -1, z = -3 } - height = 8 - elseif n.name == "mcl_mushrooms:mushroom_red" then - schematic = minetest.get_modpath("mcl_mushrooms").."/schematics/mcl_mushrooms_huge_red.mts" - offset = { x = -2, y = -1, z = -2 } - height = 8 - else - return false - end - -- 40% chance - if math.random(1, 100) <= 40 then - -- Check space requirements - for i=1,3 do - local cpos = vector.add(pos, {x=0, y=i, z=0}) - if minetest.get_node(cpos).name ~= "air" then - return false - end - end - local yoff = 3 - local minp, maxp = {x=pos.x-3, y=pos.y+yoff, z=pos.z-3}, {x=pos.x+3, y=pos.y+yoff+(height-3), z=pos.z+3} - local diff = vector.subtract(maxp, minp) - diff = vector.add(diff, {x=1,y=1,z=1}) - local totalnodes = diff.x * diff.y * diff.z - local goodnodes = minetest.find_nodes_in_area(minp, maxp, {"air", "group:leaves"}) - if #goodnodes < totalnodes then - return false - end - - -- Place the huge mushroom - minetest.remove_node(pos) - local place_pos = vector.add(pos, offset) - local ok = minetest.place_schematic(place_pos, schematic, 0, nil, false) - return ok ~= nil - end - return false - -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages - elseif string.find(n.name, "mcl_farming:wheat_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:potato_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_potato", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:carrot_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:pumpkin_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:melontige_") then - mcl_dye.add_bone_meal_particle(pos) - local stages = math.random(2, 5) - return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true) - elseif string.find(n.name, "mcl_farming:beetroot_") then - mcl_dye.add_bone_meal_particle(pos) - -- Beetroot: 75% chance to advance to next stage - if math.random(1, 100) <= 75 then - return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true) - end - elseif string.find(n.name, "mcl_farming:sweet_berry_bush_") then - mcl_dye.add_bone_meal_particle(pos) - if n.name == "mcl_farming:sweet_berry_bush_3" then - return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry") - else - return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 1, true) - end - elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then - mcl_dye.add_bone_meal_particle(pos) - -- Cocoa: Advance by 1 stage - mcl_cocoas.grow(pos) - return true - elseif minetest.get_item_group(n.name, "grass_block") == 1 then - -- Grass Block: Generate tall grass and random flowers all over the place - for i = -7, 7 do - for j = -7, 7 do - for y = -1, 1 do - pos = vector.offset(pointed_thing.above, i, y, j) - n = minetest.get_node(pos) - local n2 = minetest.get_node(vector.offset(pos, 0, -1, 0)) - - if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then - -- Randomly generate flowers, tall grass or nothing - if math.random(1, 100) <= 90 / ((math.abs(i) + math.abs(j)) / 2)then - -- 90% tall grass, 10% flower - mcl_dye.add_bone_meal_particle(pos, {amount = 4}) - if math.random(1,100) <= 90 then - local col = n2.param2 - minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=col}) - else - local flowers_table - if mg_name == "v6" then - flowers_table = flowers_table_plains - else - local biome = minetest.get_biome_name(minetest.get_biome_data(pos).biome) - if biome == "Swampland" or biome == "Swampland_shore" or biome == "Swampland_ocean" or biome == "Swampland_deep_ocean" or biome == "Swampland_underground" then - flowers_table = flowers_table_swampland - elseif biome == "FlowerForest" or biome == "FlowerForest_beach" or biome == "FlowerForest_ocean" or biome == "FlowerForest_deep_ocean" or biome == "FlowerForest_underground" then - flowers_table = flowers_table_flower_forest - elseif biome == "Plains" or biome == "Plains_beach" or biome == "Plains_ocean" or biome == "Plains_deep_ocean" or biome == "Plains_underground" or biome == "SunflowerPlains" or biome == "SunflowerPlains_ocean" or biome == "SunflowerPlains_deep_ocean" or biome == "SunflowerPlains_underground" then - flowers_table = flowers_table_plains - else - flowers_table = flowers_table_simple - end - end - minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]}) - end - end - end - end - end - end - return true - - -- Double flowers: Drop corresponding item - elseif n.name == "mcl_flowers:rose_bush" or n.name == "mcl_flowers:rose_bush_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:rose_bush") - return true - elseif n.name == "mcl_flowers:peony" or n.name == "mcl_flowers:peony_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:peony") - return true - elseif n.name == "mcl_flowers:lilac" or n.name == "mcl_flowers:lilac_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:lilac") - return true - elseif n.name == "mcl_flowers:sunflower" or n.name == "mcl_flowers:sunflower_top" then - mcl_dye.add_bone_meal_particle(pos) - minetest.add_item(pos, "mcl_flowers:sunflower") - return true - - elseif n.name == "mcl_flowers:tallgrass" then - mcl_dye.add_bone_meal_particle(pos) - -- Tall Grass: Grow into double tallgrass - local toppos = { x=pos.x, y=pos.y+1, z=pos.z } - local topnode = minetest.get_node(toppos) - if minetest.registered_nodes[topnode.name].buildable_to then - minetest.set_node(pos, { name = "mcl_flowers:double_grass", param2 = n.param2 }) - minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top", param2 = n.param2 }) - return true - end - ---[[ - Here for when Bonemeal becomes an api, there's code if needed for handling applying to bamboo. - -- Handle applying bonemeal to bamboo. - elseif mcl_bamboo.is_bamboo(n.name) then - local success = mcl_bamboo.grow_bamboo(pos, true) - if success then - mcl_dye.add_bone_meal_particle(pos) - end - return success ---]] - elseif n.name == "mcl_flowers:fern" then - mcl_dye.add_bone_meal_particle(pos) - -- Fern: Grow into large fern - local toppos = { x=pos.x, y=pos.y+1, z=pos.z } - local topnode = minetest.get_node(toppos) - if minetest.registered_nodes[topnode.name].buildable_to then - minetest.set_node(pos, { name = "mcl_flowers:double_fern", param2 = n.param2 }) - minetest.set_node(toppos, { name = "mcl_flowers:double_fern_top", param2 = n.param2 }) - return true - end - end - - return false -end - -mcl_dye.apply_bone_meal = apply_bone_meal - -- Bone meal item registration. -- -- To be moved into its own mod. @@ -609,19 +348,16 @@ minetest.register_craft({ output = "mcl_dye:magenta 2", recipe = {"mcl_dye:violet", "mcl_dye:pink"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:pink 2", recipe = {"mcl_dye:red", "mcl_dye:white"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:cyan 2", recipe = {"mcl_dye:blue", "mcl_dye:dark_green"}, }) - minetest.register_craft({ type = "shapeless", output = "mcl_dye:violet 2", diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr index 92be50c17..a2769934a 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.de.tr @@ -17,11 +17,7 @@ Magenta Dye=Magenta Farbstoff Pink Dye=Rosa Farbstoff This item is a dye which is used for dyeing and crafting.=Dieser Gegenstand ist ein Farbstoff, der zum Einfärben und in der Herstellung benutzt werden kann. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Rechtsklicken Sie auf ein Schaf, um seine Wolle zu färben. Andere Dinge werden mit der Fertigung eingefärbt. -Bone Meal=Knochenmehl -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Knochenmehl ist ein weißer Farbstoff und auch nützlich als Dünger, um das Wachstum vieler Pflanzen zu beschleunigen. -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Rechtsklicken Sie auf ein Schaf, um die Wolle weiß einzufärben. Rechtsklicken Sie auf eine Pflanze, um ihr Wachstum zu beschleunigen. Beachten Sie, dass nicht alle Pflanzen darauf ansprechen. Benutzen Sie es auf einem Grasblock, wächst viel hohes Gras und vielleicht auch ein paar Blumen. Cocoa beans are a brown dye and can be used to plant cocoas.=Kakaobohnen sind ein brauner Farbstoff und werden benutzt, um Kakao anzupflanzen. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Rechtsklicken Sie auf ein Schaf, um die Wolle braun einzufärben. Rechtsklicken Sie an die Seite eines Dschungelbaumstamms (Dschungelholz), um eine junge Kakaoschote zu pflanzen. Cocoa Beans=Kakaobohnen Grows at the side of jungle trees=Wächst an der Seite von Dschungelbäumen -Speeds up plant growth=Beschleunigt Pflanzenwachstum diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr index a829d5386..e363a63b5 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.es.tr @@ -17,9 +17,6 @@ Magenta Dye=Tinte magenta Pink Dye=Tinte rosado This item is a dye which is used for dyeing and crafting.=Este artículo es un tinte que se utiliza para teñir y elaborar. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Haga clic derecho sobre una oveja para teñir su lana. Otras cosas pueden ser teñidas mediante la elaboración. -Bone Meal=Harina de hueso -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La harina de hueso es un tinte blanco y también es útil como fertilizante para acelerar el crecimiento de muchas plantas. -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=RHaga clic derecho en una oveja para volver su lana blanca. Haga clic derecho en una planta para acelerar su crecimiento. Tenga en cuenta que no todas las plantas pueden ser fertilizadas de esta manera. Cuando haces clic derecho en un bloque de hierba, crecerán hierba alta y flores por todo el lugar. Cocoa beans are a brown dye and can be used to plant cocoas.=Los granos de cacao son un tinte marrón y se pueden usar para plantar cacao. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Haga clic derecho en una oveja para convertir su lana en marrón. Haga clic derecho en el costado del tronco de un árbol de jungla para plantar un cacao joven. Cocoa Beans=Granos de cacao diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr index 761511c5b..efb8d5bb9 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.fr.tr @@ -17,11 +17,7 @@ Magenta Dye=Teinture Magenta Pink Dye=Teinture Rose This item is a dye which is used for dyeing and crafting.=Cet objet est un colorant utilisé pour la teinture et l'artisanat. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Clic droit sur un mouton pour teindre sa laine. D'autres choses sont teintes par l'artisanat. -Bone Meal=Farine d'Os -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et également utile comme engrais pour accélérer la croissance de nombreuses plantes. -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Notez que toutes les plantes ne peuvent pas être fertilisées comme ça. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent partout. Cocoa beans are a brown dye and can be used to plant cocoas.=Les fèves de cacao ont une teinture brune et peuvent être utilisées pour planter du cacao. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Faites un clic droit sur un mouton pour brunir sa laine. Clic droit sur le côté d'un tronc d'arbre de la jungle (Bois Acajou) pour planter un jeune cacao. Cocoa Beans=Fèves de Cacao Grows at the side of jungle trees=Pousse à côté des arbres de la jungle -Speeds up plant growth=Accélère la croissance des plantes diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr index 85e5b9605..ae8d00641 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr @@ -17,11 +17,7 @@ Magenta Dye=Karmazynowa farba Pink Dye=Różowa farba This item is a dye which is used for dyeing and crafting.=Ten przedmiot to farba wykorzystywana to farbowania i wytwarzania. Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=Kliknij prawym na owcę aby zafarbować jej wełnę. Inne rzeczy mogą być zafarbowane przy wytwarzaniu. -Bone Meal=Mączka kostna -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=Mączka kostna to biała farba i przydatny nawóz, który przyspiesza rośnięcie wielu roślin. -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Kliknij prawym na owcę, aby wybielić jej wełnę. Kliknij prawym na roślinę aby przyspieszyć jej wzrost. Zważ, że nie na wszystkie rośliny to tak działa. Gdy klikniesz prawym na blok trawy, wysoka trawa wyrośnie wokół. Cocoa beans are a brown dye and can be used to plant cocoas.=Ziarna kakaowe mogą być wykorzystane do sadzenia kakao. Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=Naciśnij prawym aby zafarbować wełnę owcy na brązowo. Naciśnij prawym na boku tropikalnego pnia (Tropikalne drewno) aby zasadzić młode kakao. Cocoa Beans=Ziarna kakaowe Grows at the side of jungle trees=Rośnie na boku tropikalnych drzew -Speeds up plant growth=Przyspiesza wzrost roślin diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr index 86dc708e2..4552c5ce5 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.zh_TW.tr @@ -17,9 +17,6 @@ Magenta Dye=洋紅色染料 Pink Dye=粉紅色染料 This item is a dye which is used for dyeing and crafting.=這個物品是一種用於染色和合成的染料。 Rightclick on a sheep to dye its wool. Other things are dyed by crafting.=右鍵單擊綿羊以染它的毛。其他東西是通過合成染色的。 -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=骨粉是一種白色染料,也可作為肥料,加速許多植物的生長。 -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=右鍵點擊一隻羊,使其羊毛變白。右鍵點擊一株植物以加快其生長速度。注意,不是所有的植物都能像這樣施肥。當你右鍵點擊一個草方時,高高的草和花會到處生長。 Cocoa beans are a brown dye and can be used to plant cocoas.=可可豆是一種棕色染料,也可用於種植可可。 Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.=右鍵點擊一隻羊,使其羊毛變成褐色。右鍵點擊叢林木的一側,可以種植一個可可。 Grows at the side of jungle trees=在叢林木側生長 -Speeds up plant growth=加速植物生長 diff --git a/mods/ITEMS/mcl_dye/locale/template.txt b/mods/ITEMS/mcl_dye/locale/template.txt index 84bac96af..123df4514 100644 --- a/mods/ITEMS/mcl_dye/locale/template.txt +++ b/mods/ITEMS/mcl_dye/locale/template.txt @@ -17,11 +17,7 @@ Magenta Dye= Pink Dye= This item is a dye which is used for dyeing and crafting.= Rightclick on a sheep to dye its wool. Other things are dyed by crafting.= -Bone Meal= -Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.= -Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.= Cocoa beans are a brown dye and can be used to plant cocoas.= Rightclick a sheep to turn its wool brown. Rightclick on the side of a jungle tree trunk (Jungle Wood) to plant a young cocoa.= Cocoa Beans= Grows at the side of jungle trees= -Speeds up plant growth= diff --git a/mods/ITEMS/mcl_dye/mod.conf b/mods/ITEMS/mcl_dye/mod.conf index fe93278fc..f570211b2 100644 --- a/mods/ITEMS/mcl_dye/mod.conf +++ b/mods/ITEMS/mcl_dye/mod.conf @@ -1,2 +1,3 @@ name = mcl_dye -depends = mcl_core, mcl_flowers, mcl_mobitems, mcl_cocoas +description = Adds color to your world! +depends = mcl_bone_meal, mcl_cocoas