initial commit
This commit is contained in:
commit
8ead313a65
183
init.lua
Normal file
183
init.lua
Normal file
@ -0,0 +1,183 @@
|
||||
|
||||
local S = core.get_translator(core.get_current_modname())
|
||||
local has_mcl_flowerpots = minetest.get_modpath("mcl_flowerpots")
|
||||
|
||||
local fortune_wheat_seed_drop = {
|
||||
discrete_uniform_distribution = true,
|
||||
items = {"mcl_farming:wheat_seeds"},
|
||||
chance = 1 / 8,
|
||||
min_count = 1,
|
||||
max_count = 1,
|
||||
factor = 2,
|
||||
overwrite = true,
|
||||
}
|
||||
|
||||
local get_palette_color_from_pos = function(pos)
|
||||
local biome_data = minetest.get_biome_data(pos)
|
||||
local index = 0
|
||||
if biome_data then
|
||||
local biome = biome_data.biome
|
||||
local biome_name = minetest.get_biome_name(biome)
|
||||
local reg_biome = minetest.registered_biomes[biome_name]
|
||||
if reg_biome then
|
||||
index = reg_biome._mcl_grass_palette_index
|
||||
end
|
||||
end
|
||||
return index
|
||||
end
|
||||
|
||||
-- on_place function for flowers
|
||||
local on_place_flower = mcl_util.generate_on_place_plant_function(function(pos, node, itemstack)
|
||||
local below = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local soil_node = minetest.get_node_or_nil(below)
|
||||
if not soil_node then return false end
|
||||
|
||||
local has_palette = minetest.registered_nodes[itemstack:get_name()].palette ~= nil
|
||||
local colorize
|
||||
if has_palette then
|
||||
colorize = get_palette_color_from_pos(pos)
|
||||
end
|
||||
if not colorize then
|
||||
colorize = 0
|
||||
end
|
||||
|
||||
--[[ Placement requirements:
|
||||
* Dirt or grass block
|
||||
* If not flower, also allowed on podzol and coarse dirt
|
||||
* Light level >= 8 at any time or exposed to sunlight at day
|
||||
]]
|
||||
local light_night = minetest.get_node_light(pos, 0.0)
|
||||
local light_day = minetest.get_node_light(pos, 0.5)
|
||||
local light_ok = false
|
||||
if (light_night and light_night >= 8) or (light_day and light_day >= minetest.LIGHT_MAX) then
|
||||
light_ok = true
|
||||
end
|
||||
if itemstack:get_name() == "mcl_flowers:wither_rose" and ( minetest.get_item_group(soil_node.name, "grass_block") > 0 or soil_node.name == "mcl_core:dirt" or soil_node.name == "mcl_core:coarse_dirt" or soil_node.name == "mcl_mud:mud" or soil_node.name == "mcl_moss:moss" or soil_node.name == "mcl_nether:netherrack" or minetest.get_item_group(soil_node.name, "soul_block") > 0 ) then
|
||||
return true,colorize
|
||||
end
|
||||
local is_flower = minetest.get_item_group(itemstack:get_name(), "flower") == 1
|
||||
local ok = (soil_node.name == "mcl_core:dirt" or minetest.get_item_group(soil_node.name, "grass_block") == 1 or (not is_flower and (soil_node.name == "mcl_core:coarse_dirt" or soil_node.name == "mcl_core:podzol" or soil_node.name == "mcl_core:podzol_snow"))) and light_ok
|
||||
return ok, colorize
|
||||
end)
|
||||
|
||||
local def_tallgrass = {
|
||||
drawtype = "plantlike",
|
||||
_doc_items_usagehelp = plant_usage_help,
|
||||
_doc_items_hidden = false,
|
||||
waving = 1,
|
||||
paramtype = "light",
|
||||
paramtype2 = "color",
|
||||
palette = "mcl_core_palette_grass.png",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
groups = {
|
||||
handy = 1, shearsy = 1, attached_node = 1, deco_block = 1,
|
||||
plant = 1, place_flowerlike = 2, non_mycelium_plant = 1,
|
||||
flammable = 3, fire_encouragement = 60, fire_flammability = 10, dig_by_piston = 1,
|
||||
dig_by_water = 1, destroy_by_lava_flow = 1, compostability = 30, grass_palette = 1
|
||||
},
|
||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_shears_drop = true,
|
||||
_mcl_fortune_drop = fortune_wheat_seed_drop,
|
||||
node_placement_prediction = "",
|
||||
on_place = on_place_flower,
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_hardness = 0,
|
||||
}
|
||||
|
||||
--- Clover ---
|
||||
-- Similar deal as fern, we can copy a lot from tall grass
|
||||
local def_clover = table.copy(def_tallgrass)
|
||||
def_clover.description = S("Clover")
|
||||
def_clover._doc_items_longdesc = S("Clovers are small plants which occur naturally in plains and other temperate biomes. They can be picked up and planted again.")
|
||||
def_clover.drawtype = "mesh"
|
||||
def_clover.mesh = "mcl_clover_3leaf.obj"
|
||||
def_clover.tiles = { "mcl_flowers_clover.png" }
|
||||
def_clover.inventory_image = "mcl_flowers_clover_inv.png"
|
||||
def_clover.wield_image = "mcl_flowers_clover_inv.png"
|
||||
def_clover.drop = nil
|
||||
def_clover.selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -4/16, -0.5, -4/16, 4/16, 0, 4/16 },
|
||||
}
|
||||
|
||||
core.register_node(":mcl_flowers:clover", def_clover)
|
||||
|
||||
local def_4l_clover = table.copy(def_clover)
|
||||
def_4l_clover.description = S("Four-leaf Clover")
|
||||
def_4l_clover._doc_items_longdesc = S("Clovers are small plants which occur naturally in plains and other temperate biomes. They can be picked up and planted again.")
|
||||
def_4l_clover.mesh = "mcl_clover_4leaf.obj"
|
||||
def_4l_clover.tiles = { "mcl_flowers_fourleaf_clover.png" }
|
||||
def_4l_clover.inventory_image = "mcl_flowers_fourleaf_clover_inv.png"
|
||||
def_4l_clover.wield_image = "mcl_flowers_fourleaf_clover_inv.png"
|
||||
|
||||
core.register_node(":mcl_flowers:fourleaf_clover", def_4l_clover)
|
||||
|
||||
if has_mcl_flowerpots then
|
||||
mcl_flowerpots.register_potted_flower("mcl_flowers:clover", {
|
||||
name = "clover",
|
||||
desc = S("Clover"),
|
||||
image = "mcl_flowers_clover_inv.png",
|
||||
grass_palette_group = 1
|
||||
})
|
||||
end
|
||||
|
||||
if has_mcl_flowerpots then
|
||||
mcl_flowerpots.register_potted_flower("mcl_flowers:fourleaf_clover", {
|
||||
name = "4leaf_clover",
|
||||
desc = S("Four-leaf Clover"),
|
||||
image = "mcl_flowers_fourleaf_clover_inv.png",
|
||||
grass_palette_group = 1
|
||||
})
|
||||
end
|
||||
|
||||
local function register_flower(name, biomes, seed, is_in_flower_forest, custom_rarity_mod)
|
||||
if is_in_flower_forest == nil then
|
||||
is_in_flower_forest = true
|
||||
end
|
||||
if biomes then
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0.0008 + (custom_rarity_mod or 0),
|
||||
scale = 0.006,
|
||||
spread = {x = 100, y = 100, z = 100},
|
||||
seed = seed,
|
||||
octaves = 3,
|
||||
persist = 0.6
|
||||
},
|
||||
y_min = 1,
|
||||
y_max = mcl_vars.mg_overworld_max,
|
||||
biomes = biomes,
|
||||
decoration = "mcl_flowers:" .. name,
|
||||
})
|
||||
end
|
||||
if is_in_flower_forest then
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"group:grass_block_no_snow", "mcl_core:dirt"},
|
||||
sidelen = 80,
|
||||
noise_params = {
|
||||
offset = 0.0008 * 40,
|
||||
scale = 0.003,
|
||||
spread = {x = 100, y = 100, z = 100},
|
||||
seed = seed,
|
||||
octaves = 3,
|
||||
persist = 0.6,
|
||||
},
|
||||
y_min = 1,
|
||||
y_max = mcl_vars.mg_overworld_max,
|
||||
biomes = {"FlowerForest"},
|
||||
decoration = "mcl_flowers:" .. name,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local flower_biomes1 = {"Plains", "SunflowerPlains", "RoofedForest", "Forest", "BirchForest", "BirchForestM", "Taiga", "ColdTaiga", "Jungle", "JungleM", "JungleEdge", "JungleEdgeM", "Savanna", "SavannaM", "ExtremeHills", "ExtremeHillsM", "ExtremeHills+", "ExtremeHills+_snowtop"}
|
||||
|
||||
register_flower("clover", flower_biomes1, 3, false, 0.04)
|
||||
register_flower("fourleaf_clover", flower_biomes1, 13, false, -0.002)
|
3
mod.conf
Normal file
3
mod.conf
Normal file
@ -0,0 +1,3 @@
|
||||
name=mcl_clover
|
||||
depends=mcl_core, mcl_sounds, mcl_flowers
|
||||
optional_depends=doc, mcl_flowerpots
|
38
models/mcl_clover_3leaf.obj
Normal file
38
models/mcl_clover_3leaf.obj
Normal file
@ -0,0 +1,38 @@
|
||||
# Blender 3.6.7
|
||||
# www.blender.org
|
||||
mtllib mcl_clover_3leaf.mtl
|
||||
o Plane
|
||||
v 0.000000 -0.280000 0.000000
|
||||
v 0.000000 -0.280000 0.000000
|
||||
v -0.250000 -0.280000 -0.250000
|
||||
v 0.250000 -0.280000 -0.250000
|
||||
v 0.035355 -0.500000 0.035355
|
||||
v 0.035355 -0.300000 0.035355
|
||||
v -0.035355 -0.500000 -0.035355
|
||||
v -0.035355 -0.300000 -0.035355
|
||||
v 0.035355 -0.500000 -0.035355
|
||||
v 0.035355 -0.300000 -0.035355
|
||||
v -0.035355 -0.500000 0.035355
|
||||
v -0.035355 -0.300000 0.035355
|
||||
v -0.091506 -0.280000 0.341506
|
||||
v -0.341506 -0.280000 -0.091506
|
||||
v 0.000000 -0.280000 0.000000
|
||||
v 0.341506 -0.280000 -0.091506
|
||||
v 0.091506 -0.280000 0.341506
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
vn -0.7071 -0.0000 0.7071
|
||||
vn 0.7071 -0.0000 0.7071
|
||||
vt 0.500000 0.437500
|
||||
vt 1.000000 0.937500
|
||||
vt 0.000000 0.937500
|
||||
vt 0.437500 0.062500
|
||||
vt 0.562500 0.062500
|
||||
vt 0.562500 0.437500
|
||||
vt 0.437500 0.437500
|
||||
s 0
|
||||
usemtl Material.001
|
||||
f 2/1/1 4/2/1 3/3/1
|
||||
f 5/4/2 6/5/2 8/6/2 7/7/2
|
||||
f 9/4/3 10/5/3 12/6/3 11/7/3
|
||||
f 1/1/1 14/2/1 13/3/1
|
||||
f 15/1/1 17/2/1 16/3/1
|
32
models/mcl_clover_4leaf.obj
Normal file
32
models/mcl_clover_4leaf.obj
Normal file
@ -0,0 +1,32 @@
|
||||
# Blender 3.6.7
|
||||
# www.blender.org
|
||||
mtllib mcl_clover_4leaf.mtl
|
||||
o Plane
|
||||
v -0.250000 -0.280000 0.250000
|
||||
v 0.250000 -0.280000 0.250000
|
||||
v -0.250000 -0.280000 -0.250000
|
||||
v 0.250000 -0.280000 -0.250000
|
||||
v 0.035355 -0.500000 0.035355
|
||||
v 0.035355 -0.300000 0.035355
|
||||
v -0.035355 -0.500000 -0.035355
|
||||
v -0.035355 -0.300000 -0.035355
|
||||
v 0.035355 -0.500000 -0.035355
|
||||
v 0.035355 -0.300000 -0.035355
|
||||
v -0.035355 -0.500000 0.035355
|
||||
v -0.035355 -0.300000 0.035355
|
||||
vn -0.0000 1.0000 -0.0000
|
||||
vn -0.7071 -0.0000 0.7071
|
||||
vn 0.7071 -0.0000 0.7071
|
||||
vt 0.000000 0.125000
|
||||
vt 0.875000 0.125000
|
||||
vt 0.875000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.875000 0.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 1.000000 0.375000
|
||||
vt 0.875000 0.375000
|
||||
s 0
|
||||
usemtl Material.001
|
||||
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||
f 5/5/2 6/6/2 8/7/2 7/8/2
|
||||
f 9/5/3 10/6/3 12/7/3 11/8/3
|
BIN
textures/mcl_flowers_clover.png
Normal file
BIN
textures/mcl_flowers_clover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 137 B |
BIN
textures/mcl_flowers_clover_inv.png
Normal file
BIN
textures/mcl_flowers_clover_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 191 B |
BIN
textures/mcl_flowers_fourleaf_clover.png
Normal file
BIN
textures/mcl_flowers_fourleaf_clover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 199 B |
BIN
textures/mcl_flowers_fourleaf_clover_inv.png
Normal file
BIN
textures/mcl_flowers_fourleaf_clover_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 189 B |
Loading…
x
Reference in New Issue
Block a user