Facebook
From Sloppy Crow, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 226
  1. package me.nieznasz.mnie.models;
  2.  
  3.  
  4. import org.lwjgl.opengl.GL11;
  5.  
  6. import me.nieznasz.mnie.modules.ItemHandModule;
  7. import net.minecraft.client.Minecraft;
  8. import net.minecraft.client.entity.EntityPlayerSP;
  9. import net.minecraft.client.model.ModelRenderer;
  10. import net.minecraft.util.ResourceLocation;
  11.  
  12. public class HandItem extends HandItemBase {
  13.  
  14.         private ModelRenderer ItemHand;
  15.     private ResourceLocation wingsImages;
  16.  
  17.     public void init(int wingID) {
  18.         this.wingsImages = new ResourceLocation("textures/wings/" + wingID + ".png");
  19.         this.ItemHand = new ModelRenderer(this, 0, 0);
  20.  
  21.         if (ItemHandModule.isFalse()) {
  22.            for (float i = 0.0F; i < 0.65F; i += 0.05F) {
  23.                 this.ItemHand.addBox(0.3F, -6F, 1.5F, 0, 32, 32, i);
  24.             }
  25.         } else {
  26.             this.ItemHand.addBox(0.3F, -0F, 0.0F, 0, 32, 32, 0.05F);
  27.         }
  28.  
  29.         this.ItemHand.setRotationPoint(5f, -0.1f, -20f);
  30.         this.ItemHand.setTextureSize(16,64);
  31.     }
  32.  
  33.     public void render(EntityPlayerSP player, boolean isSneaking) {
  34.         postRender(player, isSneaking);
  35.     }
  36.  
  37.     private void postRender(EntityPlayerSP player, boolean isSneaking) {
  38.         GL11.glPushMatrix();
  39.         Minecraft.getMinecraft().getTextureManager().bindTexture(this.wingsImages);
  40.         RenderWing(player, player.onGround, isSneaking);
  41.  
  42.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  43.         GL11.glPopMatrix();
  44.     }
  45.  
  46.     private void RenderWing(EntityPlayerSP player, boolean isGround, boolean isSneaking) {
  47.         float angle = getWingAngle(60.0F, 8000, player.getYOffset());
  48.         setRotation(this.ItemHand, (float) Math.toRadians(angle + 3.0F));
  49.  
  50.         if (isSneaking)  {
  51.             this.ItemHand.rotateAngleX = 0.15f;
  52.         }
  53.  
  54.         GL11.glPushMatrix();
  55.         GL11.glTranslatef(0F, 0F, 1.7F * SCALE);
  56.         this.ItemHand.render(SCALE);
  57.         GL11.glPopMatrix();
  58.     }
  59. }