mc.thePlayer is undefined
-
@cancernameu
Here on my machinemc.thePlayer EntityPlayerSP['commandblock2'/100, l='MpServer', x=539.17, y=4.00, z=-585.11]If you want to get the class of
mc.thePlayermc.thePlayer.class class net.minecraft.client.entity.EntityPlayerSP mc.thePlayer.class.getSimpleName() EntityPlayerSP mc.thePlayer.class.getSimpleName() == "EntityPlayerSP" true typeof mc.thePlayer objectThat's probably what you want
EntityPlayerSP = Java.type("net.minecraft.client.entity.EntityPlayerSP") [JavaClass net.minecraft.client.entity.EntityPlayerSP] mc.thePlayer instanceof EntityPlayerSP trueinstanceofcan be used for java types, this is basically a nashorn thing.
https://www.oracle.com/technical-resources/articles/java/jf14-nashorn.html@commandblock2
mc.thePlayer.classstill printsundefinedfor me.mc.thePlayer.class.getSimpleName()doesn't seem to print anything for me.Chat.print(mc)givesnet.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 -
@commandblock2
mc.thePlayer.classstill printsundefinedfor me.mc.thePlayer.class.getSimpleName()doesn't seem to print anything for me.Chat.print(mc)givesnet.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 -
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.
@cancernameu said in typeof(mc.thePlayer) == undefined??:
Chat.print(typeof(mc.thePlayer))
Isn't that supposed to be like
Chat.print(typeof mc.thePlayer)? -
try { Chat.print(mc.thePlayer.getClass()); } catch(e) { Chat.print(e); }TypeError: Cannot read property "getClass" from undefined -
try { Chat.print(mc.thePlayer.getClass()); } catch(e) { Chat.print(e); }TypeError: Cannot read property "getClass" from undefined -
@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.
-
@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.
-
@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. -
@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.And as you can see, it isn't among the fields of
mcI listed. -
@cancernameu said in typeof(mc.thePlayer) == undefined??:
Chat.print(typeof(mc.thePlayer))
Isn't that supposed to be like
Chat.print(typeof mc.thePlayer)?@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
-
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.
-
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.
@kawaiinekololis Yup. official Linux build, fresh from the website. Edit looking for it
-
@kawaiinekololis Yup. official Linux build, fresh from the website. Edit looking for it
-
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.
It's only 512b. I'll try and redownload again.
Thanks
-
It's only 512b. I'll try and redownload again.
Thanks
-
@ali00035 Thanks. I got it from the site, if that's borked I'll try the gh
-
It's only 512b. I'll try and redownload again.
Thanks
@cancernameu
mcp-stable_22.srg is still empty.
Edit: getting t from the gh. -
@cancernameu
mcp-stable_22.srg is still empty.
Edit: getting t from the gh. -
@cancernameu
mcp-stable_22.srg is still empty.
Edit: getting t from the gh.@cancernameu Could you please send me your log? There might be network issues.
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