CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Unsolved Replacing mc.currentScreen crashes the game

    ScriptAPI
    3
    3
    157
    Loading More Posts
    • 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.
    • skiddermaster412
      skiddermaster412 Banned last edited by

      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 :axosad:

      CzechHek 1 Reply Last reply Reply Quote 0
      • CzechHek
        CzechHek @skiddermaster412 last edited by

        @skiddermaster412 you didn't use displayGuiScren method

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

        1 Reply Last reply Reply Quote 1
        • ?
          A Former User last edited by

          i forgor 💀

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          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