From d0b1f843ee1d4d48a958797f4118b6a892b70623 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 14 Mar 2017 20:05:07 +0100 Subject: [PATCH] Move tall grass to mcl_flowers mod Alias registered --- mods/ENTITIES/mobs_mc/sheep.lua | 2 +- mods/ITEMS/mcl_core/nodes.lua | 32 ---------------- mods/ITEMS/mcl_dye/init.lua | 12 +++--- mods/ITEMS/mcl_flowers/init.lua | 35 ++++++++++++++++++ .../textures/mcl_flowers_tallgrass.png} | Bin mods/MAPGEN/mcl_biomes/init.lua | 2 +- mods/MAPGEN/mcl_mapgen_core/init.lua | 4 +- mods/MAPGEN/mcl_mapgen_plants/init.lua | 4 +- 8 files changed, 47 insertions(+), 44 deletions(-) rename mods/ITEMS/{mcl_core/textures/default_tallgrass.png => mcl_flowers/textures/mcl_flowers_tallgrass.png} (100%) diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 921fb6a1c..727f1bfc1 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -77,7 +77,7 @@ mobs:register_mob("mobs_mc:sheep", { view_range = 5, replace_rate = 10, - replace_what = {"mcl_core:dirt_with_grass", "mcl_core:tallgrass"}, + replace_what = {"mcl_core:dirt_with_grass", "mcl_flowers:tallgrass"}, replace_with = "air", do_custom = function(self) if not self.initial_color_set then diff --git a/mods/ITEMS/mcl_core/nodes.lua b/mods/ITEMS/mcl_core/nodes.lua index 77e2d9fea..c58dcebb9 100644 --- a/mods/ITEMS/mcl_core/nodes.lua +++ b/mods/ITEMS/mcl_core/nodes.lua @@ -1691,38 +1691,6 @@ minetest.register_node("mcl_core:deadbush", { _mcl_hardness = 0, }) -minetest.register_node("mcl_core:tallgrass", { - description = "Tall Grass", - _doc_items_longdesc = "Tall grass is a small plant which often occours on the surface of grasslands. It can be harvested for wheat seeds.", - drawtype = "plantlike", - tiles = {"default_tallgrass.png"}, - inventory_image = "default_tallgrass.png", - wield_image = "default_tallgrass.png", - drop = { - max_items = 1, - items = { - { - items = {'mcl_farming:wheat_seeds'}, - rarity = 8, - }, - } - }, - paramtype = "light", - walkable = false, - buildable_to = true, - is_ground_content = true, - groups = {dig_immediate=3, flammable=3,attached_node=1,dig_by_water=1,deco_block=1}, - sounds = mcl_sounds.node_sound_leaves_defaults(), - after_dig_node = function(pos, oldnode, oldmetadata, user) - local item = user:get_wielded_item() - if item:get_name() == "mcl_tools:shears" then - minetest.add_item(pos, oldnode.name) - end - end, - _mcl_blast_resistance = 0, - _mcl_hardness = 0, -}) - minetest.register_node("mcl_core:ice", { description = "Ice", _doc_items_longdesc = "Ice is a translucent solid block usually found in cold areas.", diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 14fd0b27d..cf7eec679 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -107,11 +107,11 @@ end mcl_dye.apply_bone_meal = function(pointed_thing) local plant_tab = { "air", - "mcl_core:tallgrass", - "mcl_core:tallgrass", - "mcl_core:tallgrass", - "mcl_core:tallgrass", - "mcl_core:tallgrass", + "mcl_flowers:tallgrass", + "mcl_flowers:tallgrass", + "mcl_flowers:tallgrass", + "mcl_flowers:tallgrass", + "mcl_flowers:tallgrass", "mcl_flowers:dandelion", "mcl_flowers:blue_orchid", "mcl_flowers:oxeye_daisy", @@ -230,7 +230,7 @@ mcl_dye.apply_bone_meal = function(pointed_thing) return true -- Grow tall grass into double tallgrass - elseif n.name == "mcl_core:tallgrass" then + elseif n.name == "mcl_flowers:tallgrass" then 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 diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 8adc3915e..aca1aa359 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -52,6 +52,31 @@ local wheat_seed_drop = { } }, +-- Tall Grass +minetest.register_node("mcl_flowers:tallgrass", { + description = "Tall Grass", + _doc_items_longdesc = "Tall grass is a small plant which often occours on the surface of grasslands. It can be harvested for wheat seeds.", + drawtype = "plantlike", + tiles = {"mcl_flowers_tallgrass.png"}, + inventory_image = "mcl_flowers_tallgrass.png", + wield_image = "mcl_flowers_tallgrass.png", + paramtype = "light", + walkable = false, + buildable_to = true, + is_ground_content = true, + groups = {dig_immediate=3, flammable=3,attached_node=1,dig_by_water=1,deco_block=1}, + sounds = mcl_sounds.node_sound_leaves_defaults(), + drop = wheat_seed_drop, + after_dig_node = function(pos, oldnode, oldmetadata, user) + local item = user:get_wielded_item() + if item:get_name() == "mcl_tools:shears" then + minetest.add_item(pos, oldnode.name) + end + end, + _mcl_blast_resistance = 0, + _mcl_hardness = 0, +}) + --- Fern --- minetest.register_node("mcl_flowers:fern", { description = "Fern", @@ -67,6 +92,12 @@ minetest.register_node("mcl_flowers:fern", { groups = {dig_immediate=3,flammable=2,attached_node=1,dig_by_water=1,deco_block=1}, buildable_to = true, sounds = mcl_sounds.node_sound_leaves_defaults(), + after_dig_node = function(pos, oldnode, oldmetadata, user) + local item = user:get_wielded_item() + if item:get_name() == "mcl_tools:shears" then + minetest.add_item(pos, oldnode.name) + end + end, drop = wheat_seed_drop, selection_box = { type = "fixed", @@ -224,5 +255,9 @@ minetest.register_node("mcl_flowers:waterlily", { end }) +-- Legacy support +minetest.register_alias("mcl_core:tallgrass", "mcl_flowers:tallgrass") + +-- Show loading time local time_to_load= os.clock() - init print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load)) diff --git a/mods/ITEMS/mcl_core/textures/default_tallgrass.png b/mods/ITEMS/mcl_flowers/textures/mcl_flowers_tallgrass.png similarity index 100% rename from mods/ITEMS/mcl_core/textures/default_tallgrass.png rename to mods/ITEMS/mcl_flowers/textures/mcl_flowers_tallgrass.png diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index ed163d5e2..f0d86746e 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -153,7 +153,7 @@ local function register_grass_decoration(offset, scale) biomes = {"plains"}, y_min = 1, y_max = 31000, - decoration = "mcl_core:tallgrass", + decoration = "mcl_flowers:tallgrass", }) end diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 7e6953faa..2462141e6 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -24,7 +24,7 @@ minetest.register_alias("mapgen_clay", "mcl_core:clay") minetest.register_alias("mapgen_lava_source", "mcl_core:lava_source") minetest.register_alias("mapgen_cobble", "mcl_core:cobble") minetest.register_alias("mapgen_mossycobble", "mcl_core:mossycobble") -minetest.register_alias("mapgen_junglegrass", "mcl_core:tallgrass") +minetest.register_alias("mapgen_junglegrass", "mcl_flowers:tallgrass") minetest.register_alias("mapgen_stone_with_coal", "mcl_core:stone_with_coal") minetest.register_alias("mapgen_stone_with_iron", "mcl_core:stone_with_iron") minetest.register_alias("mapgen_desert_sand", "mcl_core:sand") @@ -563,7 +563,7 @@ local function register_mgv6_decorations() }, y_min = 1, y_max = 30, - decoration = "mcl_core:tallgrass", + decoration = "mcl_flowers:tallgrass", }) -- Dead bushes diff --git a/mods/MAPGEN/mcl_mapgen_plants/init.lua b/mods/MAPGEN/mcl_mapgen_plants/init.lua index 0d9729bc3..b3e4bd0d7 100644 --- a/mods/MAPGEN/mcl_mapgen_plants/init.lua +++ b/mods/MAPGEN/mcl_mapgen_plants/init.lua @@ -41,7 +41,7 @@ minetest.register_on_generated(function(minp, maxp, seed) if nn == "mcl_core:dirt_with_grass" then --local flower_choice = pr:next(1, 11) local flower_choice = math.random(0, 10) - local flower = "mcl_core:tallgrass" + local flower = "mcl_flowers:tallgrass" if flower_choice == 1 then flower = "mcl_flowers:dandelion" minetest.set_node(p, {name=flower}) @@ -76,7 +76,7 @@ minetest.register_on_generated(function(minp, maxp, seed) flower = "mcl_flowers:blue_orchid" minetest.set_node(p, {name=flower}) else - flower = "mcl_core:tallgrass" + flower = "mcl_flowers:tallgrass" minetest.set_node(p, {name=flower}) end