Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // WARNING: RE-RUNNING THIS SCRIPT WITH THINGS ALREADY IN YOUR VAULT WILL
- // RESULT IN YOU LOSING YOUR ITEMS. BE CAREFUL!
- //
- // RUN ;vault BEFORE REBOOTING THE SCRIPT
- let vault_position: Position = positions.groundPosition(player.position().add(pos(-1,1,0)))
- player.say("§c§lVault is now visible.")
- blocks.place(CHEST,vault_position)
- let vault_enabled = true
- let vault_called = false
- player.onChat(";vault", function () {
- vault_called = true
- })
- loops.forever(function () {
- let ppos = player.position()
- let x = vault_position.getValue(Axis.X) - ppos.getValue(Axis.X)
- let z = vault_position.getValue(Axis.Z) - ppos.getValue(Axis.Z)
- if (x < 0) {
- x = x * -1
- }
- if (z < 0) {
- z = z * -1
- }
- if (x + z > 16 && vault_enabled == true && vault_called == false) {
- vault_enabled = false
- player.say("§e§lVault has been safely stored.")
- blocks.clone(vault_position, vault_position, world(ppos.getValue(Axis.X),1,ppos.getValue(Axis.Z)), CloneMask.Replace, CloneMode.Normal)
- blocks.place(AIR, vault_position)
- vault_position = world(ppos.getValue(Axis.X),1,ppos.getValue(Axis.Z))
- } else if (x+z > 150 && vault_enabled == false && vault_called == false) {
- blocks.clone(vault_position, vault_position, world(ppos.getValue(Axis.X),1,ppos.getValue(Axis.Z)), CloneMask.Replace, CloneMode.Normal)
- blocks.place(BEDROCK, vault_position)
- vault_position = world(ppos.getValue(Axis.X),1,ppos.getValue(Axis.Z))
- player.say("§7§lVault automatically moved: ("+vault_position+")")
- } else if (vault_called == true) {
- vault_enabled = true
- vault_called = false
- let poss = positions.groundPosition(player.position().add(pos(-1,1,0)))
- blocks.clone(vault_position,vault_position, poss, CloneMask.Replace, CloneMode.Normal)
- if (vault_position.getValue(Axis.Y) == 1) {
- blocks.place(BEDROCK,vault_position)
- } else {
- blocks.place(AIR,vault_position)
- }
- player.say("§c§lVault is now visible.")
- vault_position = poss
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement