Jump to content

[1.10.2] What are these obfuscated fields in GlStateManager?


Nick82285

Recommended Posts

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
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

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