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 Add schematic file to main list before adding lucky block: lucky_block:add_schematics({ {"name", schematic filename or definition, {offset}}, end e.g. lucky_block:add_schematics({ {"platform", platform, {x = 2, y = 0, z = 2}}, }) then you can add the lucky block containing the schematic: {"sch", "schematic name", position, force placement} e.g. Remove lucky block and build lucky platform in it's place {"sch", "platform", 0, true} Place apple tree at player position {"sch", "appletree", 1, false} -= 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} }) lucky_block:add_schematics({line}) This adds a schematic to the main list before adding the actual lucky block that contains the schematic reference name (see schems.lua for examples).