Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let currentpos: Position = player.position()
- let math: Number
- let math2: Number
- let cashedpos: Position = player.position()
- function poschanged(pos1: Position, pos2: Position) {
- if (pos1.getValue(Axis.X) != pos2.getValue(Axis.X)) {
- return (true)
- } else if (pos1.getValue(Axis.Y) != pos2.getValue(Axis.Y)) {
- return (true)
- } else if (pos1.getValue(Axis.Z) != pos2.getValue(Axis.Z)) {
- return (true)
- } else {
- return (false)
- }
- }
- function replaceore(bloc: Block) {
- blocks.replace(bloc, Block.IronOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
- blocks.replace(bloc, Block.CoalOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
- blocks.replace(bloc, Block.GoldOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
- blocks.replace(bloc, Block.DiamondOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
- blocks.replace(bloc, Block.RedstoneOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
- blocks.replace(bloc, Block.LapisOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
- }
- function decidefate() {
- math2 = Math.randomRange(0, 7)
- if (math2 == 0) {
- replaceore(Block.DiamondOre)
- player.say("§a§lSomething magical just happened")
- } else if (math2 == 1) {
- replaceore(Block.LogOak)
- player.say("§3§lNature has just infected your cave.")
- } else if (math2 == 2) {
- replaceore(Block.IronOre)
- player.say("§c§lThe earth's core just swept away all precious materials.")
- } else if (math2 == 3) {
- replaceore(Block.LapisOre)
- player.say("§3§lBlueberry blocks!")
- } else if (math2 == 4) {
- player.say("§a§lHay there partner, I hope your not horsing around!")
- replaceore(Block.HayBlock)
- } else if (math2 == 5) {
- player.say("§c§lDon't make any sudden moves! Your cave has just become unstable.")
- blocks.replace(Block.Gravel, Block.Stone, player.position().add(positions.create(-5, -5, -5)), player.position().add(positions.create(5, 5, 5)))
- loops.pause(10000)
- blocks.replace(Block.Stone, Block.Gravel, player.position().add(positions.create(-5, -5, -5)), player.position().add(positions.create(5, 5, 5)))
- player.say("§a§lYour cave is now stable, you may continue working.")
- } else if (math2 == 6) {
- player.say("§c§lI Granite believe this is happening right now.")
- blocks.replace(Block.Granite, Block.Stone, player.position().add(positions.create(-12, -12, -12)), player.position().add(positions.create(12, 12, 12)))
- } else if (math2 == 7) {
- cashedpos = player.position()
- blocks.replace(Block.DiamondBlock, Block.Stone, cashedpos.add(positions.create(-5, -5, -5)), cashedpos.add(positions.create(5, 5, 5)))
- player.say("§5§l:)")
- blocks.replace(Block.Stone, Block.DiamondBlock, cashedpos.add(positions.create(-5, -5, -5)), cashedpos.add(positions.create(5, 5, 5)))
- }
- }
- loops.forever(function () {
- if (poschanged(currentpos, player.position())) {
- math = Math.randomRange(0, 200)
- if (math == 1) {
- decidefate()
- }
- }
- currentpos = player.position()
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement