Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

LiquidBounce Forum

  1. Home
  2. ScriptAPI
  3. Replacing mc.currentScreen crashes the game

Replacing mc.currentScreen crashes the game

Scheduled Pinned Locked Moved Unsolved ScriptAPI
3 Posts 3 Posters 348 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • skiddermaster412S Offline
    skiddermaster412S Offline
    skiddermaster412
    wrote on last edited by
    #1

    bad script

    /// api_version=2
    var script = registerScript({
    	name: "EpicFail",
    	version: "2.0",
    	authors: ["OrangeCat", "Katchum"]
    });
    var prf = ", "+script.scriptName + " v"+script.scriptVersion+ " by";
    Java.type("java.util.Arrays").asList(script.scriptAuthors).forEach(function(e){
    	prf += (e != script.scriptAuthors[0] ? ", " : " ") + e;
    });
    script.registerModule({
    	name: script.scriptName,
    	description: "tf" + prf,
    	category: "Movement",
    	tag: "sigma"
    }, function (module) {
    	var GuiChest = Java.type("net.minecraft.client.gui.inventory.GuiChest");
    	var ContainerChest = Java.type("net.minecraft.inventory.ContainerChest");
    	var IInventory = Java.type("net.minecraft.inventory.IInventory");
    	module.on("update", function(e){
    		var cr = mc.currentScreen;
    		var cry = mc.thePlayer.openContainer;
    		if(cr != null && cr instanceof GuiChest){ // i fucking hate js
    			var i = cr.lowerChestInventory;
    			if(i instanceof IInventory){ // tf is this
    				// get actual inventory is my method in java client, figure out how to get the correct inventory
    				var rp = new (Java.extend(GuiChest))(mc.thePlayer.getActualInventory(), i){
    					drawScreen: function(mouseX, mouseY, partialTicks){
    						Chat.print("i forgor :skull:")
    					}
    				};
    				var sc = mc.class.getDeclaredField("currentScreen");
    				sc.setAccessible(true);
    				sc.set(mc, rp);
    			}
    		}
    	});
    });
    

    here is the stack trace thing:
    c1f970e0-763a-40f1-bf44-e3637bdabe4d-imagen.png
    aparently it makes the player null undefined

    CzechHekC 1 Reply Last reply
    0
    • skiddermaster412S skiddermaster412

      bad script

      /// api_version=2
      var script = registerScript({
      	name: "EpicFail",
      	version: "2.0",
      	authors: ["OrangeCat", "Katchum"]
      });
      var prf = ", "+script.scriptName + " v"+script.scriptVersion+ " by";
      Java.type("java.util.Arrays").asList(script.scriptAuthors).forEach(function(e){
      	prf += (e != script.scriptAuthors[0] ? ", " : " ") + e;
      });
      script.registerModule({
      	name: script.scriptName,
      	description: "tf" + prf,
      	category: "Movement",
      	tag: "sigma"
      }, function (module) {
      	var GuiChest = Java.type("net.minecraft.client.gui.inventory.GuiChest");
      	var ContainerChest = Java.type("net.minecraft.inventory.ContainerChest");
      	var IInventory = Java.type("net.minecraft.inventory.IInventory");
      	module.on("update", function(e){
      		var cr = mc.currentScreen;
      		var cry = mc.thePlayer.openContainer;
      		if(cr != null && cr instanceof GuiChest){ // i fucking hate js
      			var i = cr.lowerChestInventory;
      			if(i instanceof IInventory){ // tf is this
      				// get actual inventory is my method in java client, figure out how to get the correct inventory
      				var rp = new (Java.extend(GuiChest))(mc.thePlayer.getActualInventory(), i){
      					drawScreen: function(mouseX, mouseY, partialTicks){
      						Chat.print("i forgor :skull:")
      					}
      				};
      				var sc = mc.class.getDeclaredField("currentScreen");
      				sc.setAccessible(true);
      				sc.set(mc, rp);
      			}
      		}
      	});
      });
      

      here is the stack trace thing:
      c1f970e0-763a-40f1-bf44-e3637bdabe4d-imagen.png
      aparently it makes the player null undefined

      CzechHekC Offline
      CzechHekC Offline
      CzechHek
      wrote on last edited by
      #2

      @skiddermaster412 you didn't use displayGuiScren method

      https://github.com/CzechHek/Core/blob/82457082bb5bd82b3abbad668d9667fae123407b/Scripts/InventoryManager.js#L230

      1 Reply Last reply
      1
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        i forgor 💀

        1 Reply Last reply
        1
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        About
        • Terms of Service
        • Privacy Policy
        • Status
        • Contact Us
        Downloads
        • Releases
        • Source code
        • License
        Docs
        • Tutorials
        • CustomHUD
        • AutoSettings
        • ScriptAPI
        Community
        • Forum
        • Guilded
        • YouTube
        • Twitter
        • D.Tube
        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups