Advertisement
BobMe

Minecraft exploration events

Oct 29th, 2019
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. let currentpos: Position = player.position()
  2. let math: Number
  3. let math2: Number
  4. let cashedpos: Position = player.position()
  5.  
  6. function poschanged(pos1: Position, pos2: Position) {
  7. if (pos1.getValue(Axis.X) != pos2.getValue(Axis.X)) {
  8. return (true)
  9. } else if (pos1.getValue(Axis.Y) != pos2.getValue(Axis.Y)) {
  10. return (true)
  11. } else if (pos1.getValue(Axis.Z) != pos2.getValue(Axis.Z)) {
  12. return (true)
  13. } else {
  14. return (false)
  15. }
  16. }
  17.  
  18. function replaceore(bloc: Block) {
  19. blocks.replace(bloc, Block.IronOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
  20. blocks.replace(bloc, Block.CoalOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
  21. blocks.replace(bloc, Block.GoldOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
  22. blocks.replace(bloc, Block.DiamondOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
  23. blocks.replace(bloc, Block.RedstoneOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
  24. blocks.replace(bloc, Block.LapisOre, player.position().add(positions.create(-10, -10, -10)), player.position().add(positions.create(10, 10, 10)))
  25. }
  26.  
  27. function decidefate() {
  28. math2 = Math.randomRange(0, 7)
  29. if (math2 == 0) {
  30. replaceore(Block.DiamondOre)
  31. player.say("§a§lSomething magical just happened")
  32. } else if (math2 == 1) {
  33. replaceore(Block.LogOak)
  34. player.say("§3§lNature has just infected your cave.")
  35. } else if (math2 == 2) {
  36. replaceore(Block.IronOre)
  37. player.say("§c§lThe earth's core just swept away all precious materials.")
  38. } else if (math2 == 3) {
  39. replaceore(Block.LapisOre)
  40. player.say("§3§lBlueberry blocks!")
  41. } else if (math2 == 4) {
  42. player.say("§a§lHay there partner, I hope your not horsing around!")
  43. replaceore(Block.HayBlock)
  44. } else if (math2 == 5) {
  45. player.say("§c§lDon't make any sudden moves! Your cave has just become unstable.")
  46. blocks.replace(Block.Gravel, Block.Stone, player.position().add(positions.create(-5, -5, -5)), player.position().add(positions.create(5, 5, 5)))
  47. loops.pause(10000)
  48. blocks.replace(Block.Stone, Block.Gravel, player.position().add(positions.create(-5, -5, -5)), player.position().add(positions.create(5, 5, 5)))
  49. player.say("§a§lYour cave is now stable, you may continue working.")
  50. } else if (math2 == 6) {
  51. player.say("§c§lI Granite believe this is happening right now.")
  52. blocks.replace(Block.Granite, Block.Stone, player.position().add(positions.create(-12, -12, -12)), player.position().add(positions.create(12, 12, 12)))
  53. } else if (math2 == 7) {
  54. cashedpos = player.position()
  55. blocks.replace(Block.DiamondBlock, Block.Stone, cashedpos.add(positions.create(-5, -5, -5)), cashedpos.add(positions.create(5, 5, 5)))
  56. player.say("§5§l:)")
  57. blocks.replace(Block.Stone, Block.DiamondBlock, cashedpos.add(positions.create(-5, -5, -5)), cashedpos.add(positions.create(5, 5, 5)))
  58. }
  59. }
  60. loops.forever(function () {
  61. if (poschanged(currentpos, player.position())) {
  62. math = Math.randomRange(0, 200)
  63. if (math == 1) {
  64. decidefate()
  65. }
  66. }
  67. currentpos = player.position()
  68. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement