Advertisement
Exception_Prototype

VanillaArmorModel

Mar 20th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.33 KB | None | 0 0
  1. package net.machinemuse.powersuits.client.render.item;
  2.  
  3. import java.util.List;
  4. import net.machinemuse.powersuits.client.render.modelspec.RenderPart;
  5. import net.minecraft.client.model.ModelBiped;
  6. import net.minecraft.client.model.ModelRenderer;
  7. import net.minecraft.entity.Entity;
  8. import net.minecraft.entity.EntityLivingBase;
  9. import net.minecraft.entity.player.EntityPlayer;
  10. import net.minecraft.item.EnumAction;
  11. import net.minecraft.item.ItemStack;
  12. import net.minecraft.nbt.NBTTagCompound;
  13.  
  14. public class VanillaArmorModel
  15.   extends ModelBiped
  16.   implements IArmorModel
  17. {
  18.   public NBTTagCompound renderSpec = null;
  19.   public int visibleSection = 0;
  20.   private static VanillaArmorModel INSTANCE;
  21.  
  22.   public static VanillaArmorModel getInstance()
  23.   {
  24.     if (INSTANCE == null) {
  25.       INSTANCE = new VanillaArmorModel();
  26.     }
  27.     return INSTANCE;
  28.   }
  29.  
  30.   private VanillaArmorModel()
  31.   {
  32.     super(0.0F);
  33.     init();
  34.   }
  35.  
  36.   public NBTTagCompound getRenderSpec()
  37.   {
  38.     return this.renderSpec;
  39.   }
  40.  
  41.   public void setRenderSpec(NBTTagCompound nbt)
  42.   {
  43.     this.renderSpec = nbt;
  44.   }
  45.  
  46.   public int getVisibleSection()
  47.   {
  48.     return this.visibleSection;
  49.   }
  50.  
  51.   public void setVisibleSection(int value)
  52.   {
  53.     this.visibleSection = value;
  54.   }
  55.  
  56.   public void func_78088_a(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale)
  57.   {
  58.     prep(entity, par2, par3, par4, par5, par6, scale);
  59.     this.field_78115_e.field_78796_g = entity.field_70177_z;
  60.     func_78087_a(par2, par3, par4, par5, par6, scale, entity);
  61.     super.func_78088_a(entity, par2, par3, par4, par5, par6, scale);
  62.     post(entity, par2, par3, par4, par5, par6, scale);
  63.   }
  64.  
  65.   public void clearAndAddChildWithInitialOffsets(ModelRenderer mr, float xo, float yo, float zo)
  66.   {
  67.     mr.field_78804_l.clear();
  68.     RenderPart rp = new RenderPart(this, mr);
  69.     mr.func_78792_a(rp);
  70.     setInitialOffsets(rp, xo, yo, zo);
  71.   }
  72.  
  73.   public void init()
  74.   {
  75.     clearAndAddChildWithInitialOffsets(this.field_78116_c, 0.0F, 0.0F, 0.0F);
  76.     clearAndAddChildWithInitialOffsets(this.field_78115_e, 0.0F, 0.0F, 0.0F);
  77.     clearAndAddChildWithInitialOffsets(this.field_78112_f, 5.0F, 2.0F, 0.0F);
  78.     clearAndAddChildWithInitialOffsets(this.field_78113_g, -5.0F, 2.0F, 0.0F);
  79.     clearAndAddChildWithInitialOffsets(this.field_78123_h, 2.0F, 12.0F, 0.0F);
  80.     clearAndAddChildWithInitialOffsets(this.field_78124_i, -2.0F, 12.0F, 0.0F);
  81.     this.field_78114_d.field_78804_l.clear();
  82.     this.field_78121_j.field_78804_l.clear();
  83.     this.field_78122_k.field_78804_l.clear();
  84.   }
  85.  
  86.   public void setInitialOffsets(ModelRenderer r, float x, float y, float z)
  87.   {
  88.     r.field_82906_o = x;
  89.     r.field_82908_p = y;
  90.     r.field_82907_q = z;
  91.   }
  92.  
  93.   public void prep(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale)
  94.   {
  95.     try
  96.     {
  97.       EntityLivingBase entLive = (EntityLivingBase)entity;
  98.       ItemStack stack = entLive.func_71124_b(0);
  99.       this.field_78120_m = (stack != null ? 1 : 0);
  100.       this.field_78117_n = entLive.func_70093_af();
  101.       this.field_78093_q = entLive.func_70115_ae();
  102.       EntityPlayer entPlayer = (EntityPlayer)entLive;
  103.       if ((stack != null) && (entPlayer.func_71052_bv() > 0))
  104.       {
  105.         EnumAction enumaction = stack.func_77975_n();
  106.         if (enumaction == EnumAction.block) {
  107.           this.field_78120_m = 3;
  108.         } else if (enumaction == EnumAction.bow) {
  109.           this.field_78118_o = true;
  110.         }
  111.       }
  112.     }
  113.     catch (Exception localException) {}
  114.     this.field_78116_c.field_78807_k = false;
  115.     this.field_78115_e.field_78807_k = false;
  116.     this.field_78112_f.field_78807_k = false;
  117.     this.field_78113_g.field_78807_k = false;
  118.     this.field_78123_h.field_78807_k = false;
  119.     this.field_78124_i.field_78807_k = false;
  120.    
  121.     this.field_78116_c.field_78806_j = true;
  122.     this.field_78115_e.field_78806_j = true;
  123.     this.field_78112_f.field_78806_j = true;
  124.     this.field_78113_g.field_78806_j = true;
  125.     this.field_78123_h.field_78806_j = true;
  126.     this.field_78124_i.field_78806_j = true;
  127.   }
  128.  
  129.   public void post(Entity entity, float par2, float par3, float par4, float par5, float par6, float scale)
  130.   {
  131.     this.field_78118_o = false;
  132.     this.field_78117_n = false;
  133.     this.field_78120_m = 0;
  134.   }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement