Lucky Block API =============== Please make sure that lucky_block appears in the depends.txt file of your mod. USAGE: (check blocks.lua for many examples) lucky_block:add_block({line}) LINE COMMANDS: -= Place Node {"nod", "node name", position, chest items} e.g. Replace Lucky Block with Dirt Block {"nod", "default:dirt", 0} Place Fire at player position {"nod", "fire:basic_flame", 1} Replace Lucky Block with chest containing random items from default list {"nod", "default:chest", 0} Replace Lucky Block with chest containing random items PLUS a few extra {"nod", "default:chest", 0, {{name="flowers:rose", max=5}, {name="default:goldblock", max=2}}} -= Drop Item(s) {"dro", {"item names"}, number to drop, random colour} e.g. Drop 5x Torches {"dro", {"default:torch"}, 5} Drop 10x randomly Coloured Wool (colour name added to end of item string) {"dro", {"wool:"}, 10, true} Drop 5x random Tools from list {"dro", {"default:pick_mese", "default:shovel_steel", "default:axe_diamond"}, 5} -= Place Schematic {"sch", "filename / schematic table", position, {schematic xyz offset}, force placement} e.g. Replace Lucky Block with Tree {"sch", minetest.get_modpath("default").."/schematics/apple_tree.mts", 0, {x=1, y=0, z=1}, false} Place 2x Lava at player position {"sch", { size = {x = 1, y = 2, z = 1}, data = { {name="default:lava_source", param1=255}, {name="default:lava_source", param1=255}, }, 1, {x=0, y=0, z=0}, true} -= Spawn Entity(s) {"spw", "entity name", number to spawn, tamed, owned, range} e.g. Spawn 2x Dirt Monsters over a radius of 10 blocks {"spw", "mobs:dirt_monster", 2, nil, nil, 10} Spawn 5x randomly coloured Sheep (random colour only works with sheep) {"spw", "mobs:sheep", 5} Spawn NPC who is tamed and owned by player {"spw", "mobs:npc", 1, true, true} -= Falling Blocks {"fal", {node list}, position, spread, range} e.g. Drop 2x Sand and 1x Gold Block and spread over range of 5 blocks {"fal", {"default:sand", "default:sand", "default:goldblock"}, 0, true, 5} Drop 2x Obsidian onto player {"fal", {"default:obsidian", "default:obsidian"}, 1} -= Troll Block {"tro", "node name", "sound", explosion}, e.g. Add diamond block then after 2 seconds remove with explosion {"tro", "default:diamondblock", nil, true} Add gold block with wood sound, then after 2 seconds remove with pop {"tro", "default:goldblock", "default_wood_footstep", nil} -= Explosion (no settings, Lucky Block explodes and deals damage to all nearby) {"exp"} -= Teleport (no settings, player teleports +/- 10 blocks in any direction) {"tel", horizontal range, vertical range} e.g. Teleport player to random position 10 blocks left/right and 5 blocks up/under {"tel", 10, 5} -= Lightning Strike (Player is hit by lightning and deals damage with fire) {"lig", "fire node"} e.g. Lightning strike with temporary fire {"lig", "fire:basic_flame"} Lightning strike with permanent fire {"lig", "fire:permanent_flame"} Additional Commands thanks to blert2112 lucky_block:purge_block_list() This removes all pre-defined lucky blocks and leaves the super lucky block. lucky_block:purge_chest_items() This removes all pre-defined chest_stuff items and leaves it empty. lucky_block:add_chest_items(list) This command adds items to the chest_stuff list for use inside of lucky chests: lucky_block:add_chest_items({ {name = "default:apple", max = 3}, {name = "default:steel_ingot", max = 2}, {name = "default:gold_ingot", max = 2}, {name = "default:diamond", max = 1}, {name = "default:pick_steel", max = 1} })