mc.thePlayer is undefined
-
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.
-
-
@fartcheese This should print the type of
mc.thePlayer
. It printsundefined
. -
@cancernameu cool
-
@fartcheese No, not cool at all.
-
@cancernameu who cares
-
@cancernameu mc.thePlayer.EntityPlayerSP.amogUS()print(C69).v
-
@fartcheese I care, because I can't write or use scripts this way.
-
@cancernameu downloadfreemalware.org
-
@cancernameu
@cancernameu said in typeof(mc.thePlayer) == undefined??:
@fartcheese I care, because I can't write or use scripts this way.
typeof mc.thePlayer
-
@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
-
@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.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 -
@commandblock2
mc.thePlayer.class
still printsundefined
for 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
-
@cancernameu what about
mc.thePlayer.getClass()
-
@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 What do you need that for
Btw, whats your Matrix?
-