Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • 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. mc.thePlayer is undefined

mc.thePlayer is undefined

Scheduled Pinned Locked Moved Solved ScriptAPI
41 Posts 6 Posters 24.2k 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.
  • ? A Former User

    Try the following:

    /// api_version=2
    var script = registerScript({
        name: "Amogus",
        version: "0.0.1",
        authors: []
    });
    
    script.registerModule({
        name: "Amogus",
        category: "Misc",
        description: "Sus"
    }, function (module) {
        module.on("enable", function() {
            Chat.print(typeof(mc.thePlayer));
            Chat.print(mc.thePlayer);
        });
    });
    
    

    It prints undefined on my machine. Why? Shouldn't it be of type EntityPlayerMP? I'm on b72.

    ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #7

    @cancernameu mc.thePlayer.EntityPlayerSP.amogUS()print(C69).v

    1 Reply Last reply
    0
    • ? A Former User

      @cancernameu who cares

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #8

      @fartcheese I care, because I can't write or use scripts this way.

      ? 1 Reply Last reply
      0
      • ? A Former User

        @fartcheese I care, because I can't write or use scripts this way.

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #9

        @cancernameu downloadfreemalware.org

        1 Reply Last reply
        0
        • ? A Former User

          Try the following:

          /// api_version=2
          var script = registerScript({
              name: "Amogus",
              version: "0.0.1",
              authors: []
          });
          
          script.registerModule({
              name: "Amogus",
              category: "Misc",
              description: "Sus"
          }, function (module) {
              module.on("enable", function() {
                  Chat.print(typeof(mc.thePlayer));
                  Chat.print(mc.thePlayer);
              });
          });
          
          

          It prints undefined on my machine. Why? Shouldn't it be of type EntityPlayerMP? I'm on b72.

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

          @cancernameu

          @cancernameu said in typeof(mc.thePlayer) == undefined??:

          @fartcheese I care, because I can't write or use scripts this way.

          typeof mc.thePlayer
          
          1 Reply Last reply
          0
          • ? A Former User

            Try the following:

            /// api_version=2
            var script = registerScript({
                name: "Amogus",
                version: "0.0.1",
                authors: []
            });
            
            script.registerModule({
                name: "Amogus",
                category: "Misc",
                description: "Sus"
            }, function (module) {
                module.on("enable", function() {
                    Chat.print(typeof(mc.thePlayer));
                    Chat.print(mc.thePlayer);
                });
            });
            
            

            It prints undefined on my machine. Why? Shouldn't it be of type EntityPlayerMP? I'm on b72.

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #11

            @cancernameu said in typeof(mc.thePlayer) == undefined??:

            on my machine

            what machine? toaster machine?

            @cancernameu said in typeof(mc.thePlayer) == undefined??:

            Shouldn't it be of type EntityPlayerMP?

            Brain issue

            1 Reply Last reply
            0
            • ? A Former User

              Try the following:

              /// api_version=2
              var script = registerScript({
                  name: "Amogus",
                  version: "0.0.1",
                  authors: []
              });
              
              script.registerModule({
                  name: "Amogus",
                  category: "Misc",
                  description: "Sus"
              }, function (module) {
                  module.on("enable", function() {
                      Chat.print(typeof(mc.thePlayer));
                      Chat.print(mc.thePlayer);
                  });
              });
              
              

              It prints undefined on my machine. Why? Shouldn't it be of type EntityPlayerMP? I'm on b72.

              C Offline
              C Offline
              commandblock2
              wrote on last edited by
              #12

              @cancernameu
              Here on my machine

              mc.thePlayer
              EntityPlayerSP['commandblock2'/100, l='MpServer', x=539.17, y=4.00, z=-585.11]
              

              If you want to get the class of mc.thePlayer

              mc.thePlayer.class
              class net.minecraft.client.entity.EntityPlayerSP
              
              mc.thePlayer.class.getSimpleName()
              EntityPlayerSP
              
              mc.thePlayer.class.getSimpleName() == "EntityPlayerSP"
              true
              
              typeof mc.thePlayer
              object
              

              That's probably what you want

              EntityPlayerSP = Java.type("net.minecraft.client.entity.EntityPlayerSP")
              [JavaClass net.minecraft.client.entity.EntityPlayerSP]
              
              mc.thePlayer instanceof EntityPlayerSP
              true
              

              instanceof can be used for java types, this is basically a nashorn thing.
              https://www.oracle.com/technical-resources/articles/java/jf14-nashorn.html

              ? 1 Reply Last reply
              3
              • C commandblock2

                @cancernameu
                Here on my machine

                mc.thePlayer
                EntityPlayerSP['commandblock2'/100, l='MpServer', x=539.17, y=4.00, z=-585.11]
                

                If you want to get the class of mc.thePlayer

                mc.thePlayer.class
                class net.minecraft.client.entity.EntityPlayerSP
                
                mc.thePlayer.class.getSimpleName()
                EntityPlayerSP
                
                mc.thePlayer.class.getSimpleName() == "EntityPlayerSP"
                true
                
                typeof mc.thePlayer
                object
                

                That's probably what you want

                EntityPlayerSP = Java.type("net.minecraft.client.entity.EntityPlayerSP")
                [JavaClass net.minecraft.client.entity.EntityPlayerSP]
                
                mc.thePlayer instanceof EntityPlayerSP
                true
                

                instanceof can be used for java types, this is basically a nashorn thing.
                https://www.oracle.com/technical-resources/articles/java/jf14-nashorn.html

                ? Offline
                ? Offline
                A Former User
                wrote on last edited by A Former User
                #13

                @commandblock2 mc.thePlayer.class still prints undefined for me. mc.thePlayer.class.getSimpleName() doesn't seem to print anything for me.

                Chat.print(mc) gives net.minecraft.client.Minecraft@<hex>

                	var x = mc.class.getFields();
                	try {
                	    var fw = new FileWriter("/home/user/fields.txt");
                	    fw.write("Fields:\n");
                	    fw.flush();
                	    
                	    for(var i = 0; i < x.length; i++) {
                		fw.write(String(x[i]));
                		fw.write("\n");
                	    }
                
                	    fw.flush();
                	    fw.close();
                	}
                	catch(e) {
                	    Chat.print(e);
                	}
                
                

                gives:

                Fields:
                public static final boolean net.minecraft.client.Minecraft.field_142025_a
                public static byte[] net.minecraft.client.Minecraft.field_71444_a
                public net.minecraft.client.renderer.texture.TextureManager net.minecraft.client.Minecraft.field_71446_o
                public net.minecraft.client.multiplayer.PlayerControllerMP net.minecraft.client.Minecraft.field_71442_b
                public int net.minecraft.client.Minecraft.field_71443_c
                public int net.minecraft.client.Minecraft.field_71440_d
                public net.minecraft.util.Timer net.minecraft.client.Minecraft.field_71428_T
                public net.minecraft.client.multiplayer.WorldClient net.minecraft.client.Minecraft.field_71441_e
                public net.minecraft.client.renderer.RenderGlobal net.minecraft.client.Minecraft.field_71438_f
                public net.minecraft.client.entity.EntityPlayerSP net.minecraft.client.Minecraft.field_71439_g
                public net.minecraft.entity.Entity net.minecraft.client.Minecraft.field_147125_j
                public net.minecraft.client.particle.EffectRenderer net.minecraft.client.Minecraft.field_71452_i
                public net.minecraft.util.Session net.minecraft.client.Minecraft.field_71449_j
                public net.minecraft.client.gui.FontRenderer net.minecraft.client.Minecraft.field_71466_p
                public net.minecraft.client.gui.FontRenderer net.minecraft.client.Minecraft.field_71464_q
                public net.minecraft.client.gui.GuiScreen net.minecraft.client.Minecraft.field_71462_r
                public net.minecraft.client.LoadingScreenRenderer net.minecraft.client.Minecraft.field_71461_s
                public net.minecraft.client.renderer.EntityRenderer net.minecraft.client.Minecraft.field_71460_t
                public net.minecraft.client.gui.achievement.GuiAchievement net.minecraft.client.Minecraft.field_71458_u
                public net.minecraft.client.gui.GuiIngame net.minecraft.client.Minecraft.field_71456_v
                public boolean net.minecraft.client.Minecraft.field_71454_w
                public net.minecraft.util.MovingObjectPosition net.minecraft.client.Minecraft.field_71476_x
                public net.minecraft.client.settings.GameSettings net.minecraft.client.Minecraft.field_71474_y
                public net.minecraft.util.MouseHelper net.minecraft.client.Minecraft.field_71417_B
                public final java.io.File net.minecraft.client.Minecraft.field_71412_D
                public int net.minecraft.client.Minecraft.field_71467_ac
                public boolean net.minecraft.client.Minecraft.field_71415_G
                public final net.minecraft.util.FrameTimer net.minecraft.client.Minecraft.field_181542_y
                public final net.minecraft.profiler.Profiler net.minecraft.client.Minecraft.field_71424_I
                public final net.minecraft.client.resources.DefaultResourcePack net.minecraft.client.Minecraft.field_110450_ap
                public java.lang.String net.minecraft.client.Minecraft.field_71426_K
                public boolean net.minecraft.client.Minecraft.field_175613_B
                public boolean net.minecraft.client.Minecraft.field_175614_C
                public boolean net.minecraft.client.Minecraft.field_175611_D
                public boolean net.minecraft.client.Minecraft.field_175612_E
                
                
                CzechHekC 1 Reply Last reply
                0
                • ? A Former User

                  @commandblock2 mc.thePlayer.class still prints undefined for me. mc.thePlayer.class.getSimpleName() doesn't seem to print anything for me.

                  Chat.print(mc) gives net.minecraft.client.Minecraft@<hex>

                  	var x = mc.class.getFields();
                  	try {
                  	    var fw = new FileWriter("/home/user/fields.txt");
                  	    fw.write("Fields:\n");
                  	    fw.flush();
                  	    
                  	    for(var i = 0; i < x.length; i++) {
                  		fw.write(String(x[i]));
                  		fw.write("\n");
                  	    }
                  
                  	    fw.flush();
                  	    fw.close();
                  	}
                  	catch(e) {
                  	    Chat.print(e);
                  	}
                  
                  

                  gives:

                  Fields:
                  public static final boolean net.minecraft.client.Minecraft.field_142025_a
                  public static byte[] net.minecraft.client.Minecraft.field_71444_a
                  public net.minecraft.client.renderer.texture.TextureManager net.minecraft.client.Minecraft.field_71446_o
                  public net.minecraft.client.multiplayer.PlayerControllerMP net.minecraft.client.Minecraft.field_71442_b
                  public int net.minecraft.client.Minecraft.field_71443_c
                  public int net.minecraft.client.Minecraft.field_71440_d
                  public net.minecraft.util.Timer net.minecraft.client.Minecraft.field_71428_T
                  public net.minecraft.client.multiplayer.WorldClient net.minecraft.client.Minecraft.field_71441_e
                  public net.minecraft.client.renderer.RenderGlobal net.minecraft.client.Minecraft.field_71438_f
                  public net.minecraft.client.entity.EntityPlayerSP net.minecraft.client.Minecraft.field_71439_g
                  public net.minecraft.entity.Entity net.minecraft.client.Minecraft.field_147125_j
                  public net.minecraft.client.particle.EffectRenderer net.minecraft.client.Minecraft.field_71452_i
                  public net.minecraft.util.Session net.minecraft.client.Minecraft.field_71449_j
                  public net.minecraft.client.gui.FontRenderer net.minecraft.client.Minecraft.field_71466_p
                  public net.minecraft.client.gui.FontRenderer net.minecraft.client.Minecraft.field_71464_q
                  public net.minecraft.client.gui.GuiScreen net.minecraft.client.Minecraft.field_71462_r
                  public net.minecraft.client.LoadingScreenRenderer net.minecraft.client.Minecraft.field_71461_s
                  public net.minecraft.client.renderer.EntityRenderer net.minecraft.client.Minecraft.field_71460_t
                  public net.minecraft.client.gui.achievement.GuiAchievement net.minecraft.client.Minecraft.field_71458_u
                  public net.minecraft.client.gui.GuiIngame net.minecraft.client.Minecraft.field_71456_v
                  public boolean net.minecraft.client.Minecraft.field_71454_w
                  public net.minecraft.util.MovingObjectPosition net.minecraft.client.Minecraft.field_71476_x
                  public net.minecraft.client.settings.GameSettings net.minecraft.client.Minecraft.field_71474_y
                  public net.minecraft.util.MouseHelper net.minecraft.client.Minecraft.field_71417_B
                  public final java.io.File net.minecraft.client.Minecraft.field_71412_D
                  public int net.minecraft.client.Minecraft.field_71467_ac
                  public boolean net.minecraft.client.Minecraft.field_71415_G
                  public final net.minecraft.util.FrameTimer net.minecraft.client.Minecraft.field_181542_y
                  public final net.minecraft.profiler.Profiler net.minecraft.client.Minecraft.field_71424_I
                  public final net.minecraft.client.resources.DefaultResourcePack net.minecraft.client.Minecraft.field_110450_ap
                  public java.lang.String net.minecraft.client.Minecraft.field_71426_K
                  public boolean net.minecraft.client.Minecraft.field_175613_B
                  public boolean net.minecraft.client.Minecraft.field_175614_C
                  public boolean net.minecraft.client.Minecraft.field_175611_D
                  public boolean net.minecraft.client.Minecraft.field_175612_E
                  
                  
                  CzechHekC Offline
                  CzechHekC Offline
                  CzechHek
                  wrote on last edited by
                  #14

                  @cancernameu what about mc.thePlayer.getClass()

                  ? 1 Reply Last reply
                  0
                  • ? A Former User

                    Try the following:

                    /// api_version=2
                    var script = registerScript({
                        name: "Amogus",
                        version: "0.0.1",
                        authors: []
                    });
                    
                    script.registerModule({
                        name: "Amogus",
                        category: "Misc",
                        description: "Sus"
                    }, function (module) {
                        module.on("enable", function() {
                            Chat.print(typeof(mc.thePlayer));
                            Chat.print(mc.thePlayer);
                        });
                    });
                    
                    

                    It prints undefined on my machine. Why? Shouldn't it be of type EntityPlayerMP? I'm on b72.

                    Ali00035A Offline
                    Ali00035A Offline
                    Ali00035
                    wrote on last edited by
                    #15

                    @cancernameu said in typeof(mc.thePlayer) == undefined??:

                    Chat.print(typeof(mc.thePlayer))

                    Isn't that supposed to be like Chat.print(typeof mc.thePlayer) ?

                    Ali00035A 1 Reply Last reply
                    0
                    • CzechHekC CzechHek

                      @cancernameu what about mc.thePlayer.getClass()

                      ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #16

                      @czechhek

                       	try {
                      	    Chat.print(mc.thePlayer.getClass());
                      	}
                      	catch(e) {
                      	    Chat.print(e);
                      	}
                      

                      TypeError: Cannot read property "getClass" from undefined

                      Ali00035A 1 Reply Last reply
                      0
                      • ? A Former User

                        @czechhek

                         	try {
                        	    Chat.print(mc.thePlayer.getClass());
                        	}
                        	catch(e) {
                        	    Chat.print(e);
                        	}
                        

                        TypeError: Cannot read property "getClass" from undefined

                        Ali00035A Offline
                        Ali00035A Offline
                        Ali00035
                        wrote on last edited by
                        #17

                        @cancernameu What do you need that for

                        Btw, whats your Matrix?

                        ? 1 Reply Last reply
                        0
                        • Ali00035A Ali00035

                          @cancernameu What do you need that for

                          Btw, whats your Matrix?

                          ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #18

                          @ali00035 I want to have access to the methods of the player. I don't use Matrix all that much nowadays, just send me a message on here.

                          CzechHekC 1 Reply Last reply
                          0
                          • ? A Former User

                            @ali00035 I want to have access to the methods of the player. I don't use Matrix all that much nowadays, just send me a message on here.

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

                            @cancernameu https://scriptapi.liquidbounce.net/net/minecraft/client/entity/EntityPlayerSP.html

                            ? 1 Reply Last reply
                            0
                            • CzechHekC CzechHek

                              @cancernameu https://scriptapi.liquidbounce.net/net/minecraft/client/entity/EntityPlayerSP.html

                              ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #20

                              @czechhek Yeah, I'm aware of the class. Usually, the current player is accessible with mc.thePlayer. It isn't here, all my previous scripts have broken, and I doubt any new ones will. I just want to solve the issue.

                              ? 1 Reply Last reply
                              0
                              • ? A Former User

                                @czechhek Yeah, I'm aware of the class. Usually, the current player is accessible with mc.thePlayer. It isn't here, all my previous scripts have broken, and I doubt any new ones will. I just want to solve the issue.

                                ? Offline
                                ? Offline
                                A Former User
                                wrote on last edited by
                                #21

                                And as you can see, it isn't among the fields of mc I listed.

                                1 Reply Last reply
                                0
                                • Ali00035A Ali00035

                                  @cancernameu said in typeof(mc.thePlayer) == undefined??:

                                  Chat.print(typeof(mc.thePlayer))

                                  Isn't that supposed to be like Chat.print(typeof mc.thePlayer) ?

                                  Ali00035A Offline
                                  Ali00035A Offline
                                  Ali00035
                                  wrote on last edited by
                                  #22

                                  @ali00035 said in mc.thePlayer is undefined:

                                  @cancernameu said in typeof(mc.thePlayer) == undefined??:

                                  Chat.print(typeof(mc.thePlayer))

                                  Isn't that supposed to be like Chat.print(typeof mc.thePlayer) ?

                                  @cancernameu

                                  1 Reply Last reply
                                  0
                                  • kawaiinekololisK Offline
                                    kawaiinekololisK Offline
                                    kawaiinekololis
                                    Admin
                                    wrote on last edited by
                                    #23

                                    There might be something wrong with your b72 build. Is it official? I could only think of missing mappings. Could you check your .minecraft/LiquidBounce-1.8.9 folder for the mcp-stable_22.srg file? It should be about 4.25 MB, so maybe something went wrong on the download and fucked up the mappings.

                                    ? 2 Replies Last reply
                                    0
                                    • kawaiinekololisK kawaiinekololis

                                      There might be something wrong with your b72 build. Is it official? I could only think of missing mappings. Could you check your .minecraft/LiquidBounce-1.8.9 folder for the mcp-stable_22.srg file? It should be about 4.25 MB, so maybe something went wrong on the download and fucked up the mappings.

                                      ? Offline
                                      ? Offline
                                      A Former User
                                      wrote on last edited by A Former User
                                      #24

                                      @kawaiinekololis Yup. official Linux build, fresh from the website. Edit looking for it

                                      Ali00035A 1 Reply Last reply
                                      0
                                      • ? A Former User

                                        @kawaiinekololis Yup. official Linux build, fresh from the website. Edit looking for it

                                        Ali00035A Offline
                                        Ali00035A Offline
                                        Ali00035
                                        wrote on last edited by Ali00035
                                        #25

                                        @cancernameu GNU/Linux... Based!

                                        1 Reply Last reply
                                        0
                                        • kawaiinekololisK kawaiinekololis

                                          There might be something wrong with your b72 build. Is it official? I could only think of missing mappings. Could you check your .minecraft/LiquidBounce-1.8.9 folder for the mcp-stable_22.srg file? It should be about 4.25 MB, so maybe something went wrong on the download and fucked up the mappings.

                                          ? Offline
                                          ? Offline
                                          A Former User
                                          wrote on last edited by A Former User
                                          #26

                                          It's only 512b. I'll try and redownload again.
                                          Thanks ❤

                                          Ali00035A ? 2 Replies Last reply
                                          0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          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