Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let lucky_block = blocks.block(Block.GoldBlock);
- let lucky_tool = blocks.item(Item.GoldenAxe);
- let amount_of_lucky_choices = 18
- let lucky_pos: Position = null
- player.onItemInteracted(lucky_tool, function () {
- let pos = positions.add(player.position(), positions.create(0, -1, 0));
- if (blocks.testForBlock(Block.GoldBlock, pos) == true) {
- player.say("§6§lLucky Block Set!");
- lucky_pos = pos
- } else {
- player.say("§4§lThat is not a Lucky Block!");
- lucky_pos = pos
- }
- })
- blocks.onBlockBroken(lucky_block, function () {
- if (lucky_pos != null && blocks.testForBlock(Block.GoldBlock, lucky_pos) == false) {
- player.execute('kill @e [name="Block of Gold"]')
- exelucky(Math.randomRange(1, amount_of_lucky_choices), lucky_pos)
- lucky_pos = null
- }
- })
- function exelucky(num: number, pos: Position) {
- if (num == 1) {
- let ofpos1 = Math.randomRange(-3, 3)
- let ofpos2 = Math.randomRange(-3, 3)
- let ofpos3 = Math.randomRange(-3, 3)
- lucky_pos = positions.create(ofpos1, 0, ofpos3)
- blocks.place(lucky_block, positions.add(pos, lucky_pos))
- let choice = Math.randomRange(1, 3)
- if (choice == 1) {
- player.say("§e§lThat one was defective... Try this one instead.")
- } else if (choice == 2) {
- player.say("§e§lHey look, it's back!")
- } else if (choice == 3) {
- player.say("§e§lHm, that's weird it came back?")
- }
- } else if (num == 2) {
- for (let i = 0; i < 3; i++) {
- let ofpos1 = Math.randomRange(-3, 3)
- let ofpos2 = Math.randomRange(-3, 3)
- let ofpos3 = Math.randomRange(-3, 3)
- if (blocks.testForBlock(blocks.block(Block.GoldBlock), pos) == false && blocks.testForBlock(blocks.block(Block.Dirt), pos) == false && blocks.testForBlock(blocks.block(Block.Grass), pos) == false) {
- blocks.place(lucky_block, positions.add(pos, positions.create(ofpos1, 0, ofpos3)))
- } else {
- let y = 0
- let posl = pos
- while (blocks.testForBlock(blocks.block(Block.GoldBlock), posl) == false && blocks.testForBlock(blocks.block(Block.Dirt), posl) == false && blocks.testForBlock(blocks.block(Block.Grass), posl) == false) {
- y++;
- posl = positions.add(pos, positions.create(0, y, 0))
- }
- blocks.place(lucky_block, positions.add(pos, positions.create(ofpos1, y, ofpos3)))
- }
- }
- player.say("§a§l3 Lucky Blocks!")
- } else if (num == 3) {
- player.say("§4§lUh oh! That's creepy!")
- for (let i = 0; i < 5; i++) {
- mobs.spawn(mobs.monster(MonsterMob.Creeper), positions.create(0, 4, 0))
- }
- } else if (num == 4) {
- player.execute("time set day")
- player.say("§a§lTime passed in an instant and morning has begun!")
- } else if (num == 5) {
- player.execute("time set night")
- player.say("§4§lTime passed in an instant and night has fallen.");
- } else if (num == 6) {
- player.say("§4§lLook up.")
- for (let i = 0; i < 5; i++) {
- mobs.spawn(mobs.projectile(ProjectileMob.PrimedTnt), positions.create(0, 65, 0))
- loops.pause(50)
- }
- } else if (num == 7) {
- player.say("§a§lLucky!")
- mobs.spawn(mobs.projectile(ProjectileMob.LightningBolt), pos)
- blocks.place(blocks.block(Block.DiamondBlock), pos)
- } else if (num == 8) {
- let pos = player.position()
- blocks.fill(blocks.block(Block.Cobblestone), positions.add(pos, positions.create(-1, 0, -1)), positions.add(pos, positions.create(-1, 0, 1)))
- blocks.fill(blocks.block(Block.Cobblestone), positions.add(pos, positions.create(1, 0, -1)), positions.add(pos, positions.create(1, 0, 1)))
- blocks.place(blocks.block(Block.Cobblestone), positions.add(pos, positions.create(0, 0, -1)))
- blocks.place(blocks.block(Block.Cobblestone), positions.add(pos, positions.create(0, 0, 1)))
- blocks.place(blocks.block(Block.Lava), positions.add(pos, positions.create(0, 0, 0)))
- player.say("§4§lWhat a heated result!")
- } else if (num == 9) {
- player.say("§a§lLucky!")
- mobs.spawn(mobs.projectile(ProjectileMob.LightningBolt), pos)
- blocks.place(blocks.block(Block.EmeraldBlock), pos)
- } else if (num == 10) {
- blocks.replace(blocks.block(Block.Stone), blocks.block(Block.IronOre), positions.create(-6, -6, -6), positions.create(6, 6, 6))
- blocks.replace(blocks.block(Block.Stone), blocks.block(Block.GoldOre), positions.create(-6, -6, -6), positions.create(6, 6, 6))
- blocks.replace(blocks.block(Block.Stone), blocks.block(Block.RedstoneOre), positions.create(-6, -6, -6), positions.create(6, 6, 6))
- blocks.replace(blocks.block(Block.Stone), blocks.block(Block.LapisOre), positions.create(-6, -6, -6), positions.create(6, 6, 6))
- blocks.replace(blocks.block(Block.Stone), blocks.block(Block.DiamondOre), positions.create(-6, -6, -6), positions.create(6, 6, 6))
- blocks.replace(blocks.block(Block.Stone), blocks.block(Block.CoalOre), positions.create(-6, -6, -6), positions.create(6, 6, 6))
- player.say("§4§lUnlucky! All ores around you have vanished.")
- } else if (num == 11) {
- blocks.replace(blocks.block(Block.IronBlock), blocks.block(Block.IronOre), positions.create(-10, -10, -10), positions.create(10, 10, 10))
- blocks.replace(blocks.block(Block.GoldBlock), blocks.block(Block.GoldOre), positions.create(-10, -10, -10), positions.create(10, 10, 10))
- blocks.replace(blocks.block(Block.RedstoneBlock), blocks.block(Block.RedstoneOre), positions.create(-10, -10, -10), positions.create(10, 10, 10))
- blocks.replace(blocks.block(Block.LapisLazuliBlock), blocks.block(Block.LapisOre), positions.create(-10, -10, -10), positions.create(10, 10, 10))
- blocks.replace(blocks.block(Block.DiamondBlock), blocks.block(Block.DiamondOre), positions.create(-10, -10, -10), positions.create(10, 10, 10))
- blocks.replace(blocks.block(Block.CoalBlock), blocks.block(Block.CoalOre), positions.create(-10, -10, -10), positions.create(10, 10, 10))
- player.say("§a§lLucky! All ores around you have been upgraded!")
- } else if (num == 12) {
- player.execute("effect @a blindness 10 255")
- player.say("§4§lUh Oh! Everyone has been blinded for 10 seconds!")
- } else if (num == 13) {
- player.say("§4§lUh oh! That's scary!")
- for (let i = 0; i < 6; i++) {
- mobs.spawn(mobs.monster(MonsterMob.Enderman), positions.create(0, 3, 0))
- }
- } else if (num == 14) {
- player.execute("xp 5L @a")
- player.say("§a§lEveryone just gained 5 braincells!")
- } else if (num == 15) {
- blocks.fill(blocks.block(Block.Obsidian), positions.add(pos, positions.create(-2, 0, 0)), positions.add(pos, positions.create(-2, 4, 0)))
- blocks.fill(blocks.block(Block.Obsidian), positions.add(pos, positions.create(-2, 0, 3)), positions.add(pos, positions.create(-2, 4, 3)))
- blocks.fill(blocks.block(Block.Obsidian), positions.add(pos, positions.create(-2, 0, 1)), positions.add(pos, positions.create(-2, 0, 2)))
- blocks.fill(blocks.block(Block.Obsidian), positions.add(pos, positions.create(-2, 4, 1)), positions.add(pos, positions.create(-2, 4, 2)))
- player.say("§a§lI'll let you do the honors.")
- player.execute("give @s flint_and_steel")
- } else if (num == 16) {
- blocks.fill(blocks.block(Block.IronBars), positions.add(player.position(), positions.create(1, 0, -1)), positions.add(player.position(), positions.create(1, 5, 1)))
- blocks.fill(blocks.block(Block.IronBars), positions.add(player.position(), positions.create(-1, 0, -1)), positions.add(player.position(), positions.create(-1, 5, 1)))
- blocks.fill(blocks.block(Block.IronBars), positions.add(player.position(), positions.create(0, 0, -1)), positions.add(player.position(), positions.create(0, 5, -1)))
- blocks.fill(blocks.block(Block.IronBars), positions.add(player.position(), positions.create(0, 0, 1)), positions.add(player.position(), positions.create(0, 5, 1)))
- blocks.fill(blocks.block(Block.Gravel), positions.add(player.position(), positions.create(0, 35, 0)), positions.add(player.position(), positions.create(0, 40, 0)))
- player.say("§4§lWatch your head!")
- } else if (num == 17) {
- player.execute('give @s cooked_beef 16')
- player.say("§a§lYou look so starved, have some dinner.")
- } else if (num == 18) {
- player.execute("tp @s ~ ~50 ~")
- player.say("§4§lUh oh, don't break your legs!")
- }
- }
Add Comment
Please, Sign In to add comment