Jump to content

[1.10.2] What are these obfuscated fields in GlStateManager?


Recommended Posts

Posted (edited)

So I recently decompiled a mod to see how it rendered the arm in the first person with an item in hand. This is the code I came up with, deobfuscated to the best of my ability. I used bytecode viewer to decompile if that helps. I need to know the unknown fields in the code

 

public void renderFirstPersonArm() {
		Minecraft mc = Minecraft.getMinecraft();
		Render render = mc.getRenderManager().getEntityRenderObject(mc.thePlayer);
		RenderPlayer renderplayer = (RenderPlayer) render;
		GlStateManager.func_179094_E();
		GlStateManager.rotate(42.0F, 0.0F, 1.0F, 0.0F);
		GlStateManager.rotate(-80.0F, 0.0F, 0.0F, 1.0F);
		GlStateManager.rotate(100.0F, 1.0F, 0.0F, 0.0F);
		GlStateManager.func_179109_b(-0.13F, -0.24F, 0.64F);
		GlStateManager.func_179152_a(0.8F, 0.8F, 1.2F);
		if ((mc.field_71439_g.field_82175_bq) && (mc.field_71439_g.field_110158_av >= 1)) {
			GlStateManager.rotate(60.0F, 0.0F, 1.0F, 0.0F);
			GlStateManager.rotate(-10.0F, 0.0F, 0.0F, 1.0F);
			GlStateManager.rotate(-5.0F, 1.0F, 0.0F, 0.0F);
			GlStateManager.func_179109_b(0.6F, 0.0F, 0.0F);
		}

		ResourceLocation skin = Minecraft.getMinecraft().thePlayer.getLocationSkin();
		Minecraft.getMinecraft().renderEngine.bindTexture(skin);
		renderplayer.renderRightArm(mc.thePlayer);
		Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
		GlStateManager.func_179121_F();
		if ((mc.field_71439_g.func_70694_bm() != null)
				&& (mc.field_71439_g.func_70694_bm().func_77973_b() == AmnesiaLights.LanternOff)) {
			GlStateManager.func_179094_E();
			GlStateManager.rotate(15.0F, 0.0F, 1.0F, 0.0F);
			GlStateManager.rotate(-88.0F, 0.0F, 0.0F, 1.0F);
			GlStateManager.func_179109_b(-0.12F, -0.75F, 0.12F);
			GlStateManager.func_179152_a(0.8F, 1.2F, 0.8F);
			Minecraft.func_71410_x().func_110434_K()
					.func_110577_a(Minecraft.func_71410_x().field_71439_g.func_110306_p());
			renderplayer.func_177138_b(mc.field_71439_g);
			Minecraft.func_71410_x().func_110434_K().func_110577_a(TextureMap.field_110575_b);
			GlStateManager.func_179121_F();
		}
	}

 

This is the original code of obfuscated functions, again if it helps

public void renderFirstPersonArm()
{
	Minecraft mc = Minecraft.func_71410_x();
     Render render = mc.func_175598_ae().func_78713_a(mc.field_71439_g);
     RenderPlayer renderplayer = (RenderPlayer)render;
     GlStateManager.func_179094_E();
     GlStateManager.func_179114_b(42.0F, 0.0F, 1.0F, 0.0F);
     GlStateManager.func_179114_b(-80.0F, 0.0F, 0.0F, 1.0F);
     GlStateManager.func_179114_b(100.0F, 1.0F, 0.0F, 0.0F);
     GlStateManager.func_179109_b(-0.13F, -0.24F, 0.64F);
     GlStateManager.func_179152_a(0.8F, 0.8F, 1.2F);
     if ((mc.field_71439_g.field_82175_bq) && 
       (mc.field_71439_g.field_110158_av >= 1)) {
       GlStateManager.func_179114_b(60.0F, 0.0F, 1.0F, 0.0F);
       GlStateManager.func_179114_b(-10.0F, 0.0F, 0.0F, 1.0F);
       GlStateManager.func_179114_b(-5.0F, 1.0F, 0.0F, 0.0F);
       GlStateManager.func_179109_b(0.6F, 0.0F, 0.0F);
     }
     
     ResourceLocation skin = Minecraft.func_71410_x().field_71439_g.func_110306_p();
     Minecraft.func_71410_x().func_110434_K().func_110577_a(skin);
     renderplayer.func_177138_b(mc.field_71439_g);
     Minecraft.func_71410_x().func_110434_K().func_110577_a(TextureMap.field_110575_b);
     GlStateManager.func_179121_F();
     if ((mc.field_71439_g.func_70694_bm() != null) && (mc.field_71439_g.func_70694_bm().func_77973_b() == AmnesiaLights.LanternOff)) {
       GlStateManager.func_179094_E();
       GlStateManager.func_179114_b(15.0F, 0.0F, 1.0F, 0.0F);
       GlStateManager.func_179114_b(-88.0F, 0.0F, 0.0F, 1.0F);
       GlStateManager.func_179109_b(-0.12F, -0.75F, 0.12F);
       GlStateManager.func_179152_a(0.8F, 1.2F, 0.8F);
       Minecraft.func_71410_x().func_110434_K().func_110577_a(Minecraft.func_71410_x().field_71439_g.func_110306_p());
       renderplayer.func_177138_b(mc.field_71439_g);
       Minecraft.func_71410_x().func_110434_K().func_110577_a(TextureMap.field_110575_b);
       GlStateManager.func_179121_F();
     }
   }

 

Edited by Nick82285
Grammar
Posted

Didn't I tell you already in your other topic to look at how vanilla renders it's player arm in ItemRenderer#renderArmFirstPerson? I bet their code isn't much different from vanilla's.

 

If I were to guess then:

21 minutes ago, Nick82285 said:

GlStateManager.func_179094_E();

This is likely pushMatrix

 

21 minutes ago, Nick82285 said:

GlStateManager.func_179109_b(-0.13F, -0.24F, 0.64F);

This is likely translate

 

21 minutes ago, Nick82285 said:

GlStateManager.func_179152_a(0.8F, 0.8F, 1.2F);

This is likely scale

 

21 minutes ago, Nick82285 said:

GlStateManager.func_179121_F();

This is likely popMatrix

 

21 minutes ago, Nick82285 said:

mc.field_71439_g

This looks like Minecraft.player

 

21 minutes ago, Nick82285 said:

field_82175_bq

EntityLivingBase.isSwingInProgress?

 

21 minutes ago, Nick82285 said:

field_110158_av

If the previous assumption is correct then this must be EntityLivingBase.swingProgressInt

 

21 minutes ago, Nick82285 said:

mc.field_71439_g.func_70694_bm()

Something like mc.player.getHeldItemMainhand()

 

21 minutes ago, Nick82285 said:

mc.field_71439_g.func_70694_bm().func_77973_b()

mc.player.getHeldItemMainhand().getItem()

 

21 minutes ago, Nick82285 said:

Minecraft.func_71410_x().func_110434_K() .func_110577_a(Minecraft.func_71410_x().field_71439_g.func_110306_p());

Minecraft.getMinecraft().getTextureManager().bindTexture(Minecraft.getMinecraft().player.getLocationSkin());

 

21 minutes ago, Nick82285 said:

renderplayer.func_177138_b(mc.field_71439_g);

renderplayer.renderRightArm(mc.player);

 

21 minutes ago, Nick82285 said:

Minecraft.func_71410_x().func_110434_K().func_110577_a(TextureMap.field_110575_b);

Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

 

You could have used MCPBot or the mappings stored on your PC yourself to get these, SRG names don't really change between versions unless the method/field is deleted completely.

Also I think this is slightly illegal since you are planning to use this code in your mod and not decompiling for educational purposes. Well maybe not illegal but certainly not a nice thing to do. You should've asked the mod author for their code. 

Posted
4 minutes ago, V0idWa1k3r said:

Also I think this is slightly illegal since you are planning to use this code in your mod and not decompiling for educational purposes.

Sure thing, you're right, I contacted him on the MinecraftForum to see if he's okay with it. He has stopped developing his mod at 1.8.9 and he hasn't seemed to be online for a while, but I'm willing to wait.

 

Appreciate the help :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.