Advertisement
Exception_Prototype

SMovingArmorModel

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