Advertisement
WebMaka

Improved Teleport, for pre-1.8 Minecraft

Oct 1st, 2015
1,252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // $Id$
  2. /*
  3.  Improved Teleport, for pre-1.8 Minecraft
  4.  * Adds rotation and head tilt (pitch and yaw) control.
  5.    Created by ActiumPraetor of WreckedGamers.com
  6.    general@wreckedgamers.com
  7.  
  8.  Requires: Any reasonable recent version of WorldEdit
  9.  
  10.  Command:
  11.  /cs teleport.js X Y Z R W
  12.  
  13.  * All parameters are floating-point, 8-decimal-place precision supported.
  14.  
  15.  Parameters:
  16.    X,Y,Z = Coordinates in space in X, Y, Z axes, as per the regular /tp command
  17.    R = Rotation angle, in 180.0000 to -180.0000 degrees, where:
  18.      -180.0000 = due north
  19.      -90.0000 = due east
  20.      0.0000 = due south
  21.      90.0000 = due west
  22.      180.0000 = due north
  23.      * If you exceed the range it loops around. No idea if this can break things though.
  24.    W = Yaw angle, 255.0000 to -255.000 range, where:
  25.      255.0000 = straight up
  26.      0.0000 = level with the horizon
  27.      -255.0000 = straight down
  28.  
  29.  
  30.  This program is free software: you can redistribute it and/or modify
  31.  it under the terms of the GNU General Public License as published by
  32.  the Free Software Foundation, either version 3 of the License, or
  33.  (at your option) any later version.
  34.  
  35.  This program is distributed in the hope that it will be useful,
  36.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  37.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  38.  GNU General Public License for more details.
  39.  
  40.  You should have received a copy of the GNU General Public License
  41.  along with this program. If not, see <http://www.gnu.org/licenses/>.
  42. */
  43.  
  44. //Import the WorldEdit API package.
  45. importPackage(Packages.com.sk89q.worldedit);
  46.  
  47. // Start a WE edit session.
  48. var session = context.remember();
  49.  
  50. // Grab the arguments. If not enough are provided, do some explaining to that effect.
  51. context.checkArgs(5,5,"<x> <y> <z> <rotation in degrees: -180 to +180, -90=E 0=S 90=W 180=N> <yaw: -255 to 255, 0=level, -=down, +=up>");
  52.  
  53. // Fetch said arguments.
  54. var new_x = parseFloat(argv[1]);
  55. var new_y = parseFloat(argv[2]);
  56. var new_z = parseFloat(argv[3]);
  57. var new_r = parseFloat(argv[4]);
  58. var new_w = parseFloat(argv[5]);
  59.  
  60. // Move the player.
  61. var new_coords = Vector(new_x, new_y, new_z);
  62. player.setPosition(new_coords, new_r, new_w);
  63.  
  64. // End!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement