SHARE
TWEET

Hyper-Accurate Teleporter

QuentinPlaysMC Oct 13th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function() {
  2.   'use strict';
  3.  
  4.   function go_to_pos(y, x) {
  5.     let world = window.w;
  6.     world._state.offsetX = -x * 576;
  7.     world._state.offsetY = y * 576;
  8.     world._container.scrollLeft(0);
  9.     world._container.scrollTop(0);
  10.     console.log("Teleport complete");
  11.   }
  12.  
  13.   function create_teleport_button() {
  14.     $('body')
  15.       .append('<input type="button" value="TP" id="TP">');
  16.  
  17.     $("#TP")
  18.       .css("position", "fixed")
  19.       .css("top", 0)
  20.       .css("left", 0);
  21.  
  22.     $('#TP').click(function() {
  23.       let world = window.w;
  24.       world._ui.coordinateInputModal.open("Teleport to coordinates:", go_to_pos);
  25.     });
  26.   }
  27.  
  28.   function init_wall() {
  29.     console.log("Prepared");
  30.     setUpAjax();
  31.     window.w = new World($("#yourworld"), window.state);
  32.   }
  33.  
  34.   function kill_begin_script(e) {
  35.     var src = e.target.src;
  36.     if (src.indexOf("begin.js") !== -1) {
  37.       console.log("Disabling begin script");
  38.       e.stopPropagation();
  39.       e.preventDefault();
  40.       $(e.target).remove();
  41.     }
  42.   }
  43.  
  44.   create_teleport_button();
  45.   document.addEventListener("beforescriptexecute", kill_begin_script, true);
  46.   $(init_wall);
  47.  
  48.   console.log("Teleportation initialized");
  49. })();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top