Guest User

Untitled

a guest
May 19th, 2019
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import net.minecraft.client.Minecraft;
  2. import net.minecraft.client.entity.AbstractClientPlayer;
  3. import net.minecraft.client.model.ModelBiped;
  4. import net.minecraft.client.renderer.entity.RenderLivingBase;
  5. import net.minecraft.client.renderer.entity.RenderManager;
  6. import net.minecraft.client.renderer.entity.RenderPlayer;
  7. import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
  8. import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
  9. import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
  10. import net.minegrounds.utils.LibObfuscation;
  11.  
  12. import java.util.List;
  13.  
  14. public class test {
  15.  
  16. // RenderLivingBase
  17. public static final String LAYER_RENDERERS = "field_177097_h";
  18.  
  19. // LayerArmorBase
  20. public static final String MODEL_ARMOR = "field_177186_d";
  21. public static final String MODEL_LEGGINGS = "field_177189_c";
  22.  
  23. private static ModelBiped getPlayerArmorModel(AbstractClientPlayer player) {
  24. RenderPlayer render = getRenderPlayer(player);
  25. if(render == null)
  26. return null;
  27.  
  28. List list = ObfuscationReflectionHelper.getPrivateValue(RenderLivingBase.class, render, LAYER_RENDERERS);
  29. for (Object aList : list)
  30. if (aList instanceof LayerBipedArmor)
  31. return ObfuscationReflectionHelper.getPrivateValue(LayerArmorBase.class, (LayerArmorBase) aList, MODEL_ARMOR);
  32.  
  33. return null;
  34. }
  35.  
  36.  
  37. private static RenderPlayer getRenderPlayer(AbstractClientPlayer player) {
  38. Minecraft mc = Minecraft.getMinecraft();
  39. RenderManager manager = mc.getRenderManager();
  40. return manager.getSkinMap().get(player.getSkinType());
  41. }
  42. }
RAW Paste Data