Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.72 KB | None | 0 0
  1. public class EntityGunFlash extends Entity {
  2.  
  3.     public final float size;
  4.     public final float distance = 0.0F;
  5.     public final float rotationRoll;
  6.     public static boolean aiming;
  7.  
  8.     public EntityGunFlash(EntityPlayer shooter, float size, float distance) {
  9.         super(shooter.worldObj);
  10.         super.renderDistanceWeight = 100000.0D;
  11.         this.setSize(0.5F, 0.5F);
  12.         Vec3 vec = shooter.getLookVec();
  13.         posX = vec.xCoord * distance + shooter.posX;
  14.         if(FMLClientHandler.instance().getClientPlayerEntity().inventory.getCurrentItem() != null && FMLClientHandler.instance().getClientPlayerEntity().inventory.getCurrentItem().getItem() instanceof LDItemWeapon && Mouse.isButtonDown(1) && FMLClientHandler.instance().getClient().currentScreen == null) {
  15.             //this.setLocationAndAngles(shooter.posX + 0.1, shooter.posY + (double)shooter.getEyeHeight() - (shooter.isSneaking()?0.29D:0.2D) + 0.15, shooter.posZ + 0.4, shooter.rotationYaw, shooter.rotationPitch);
  16.             aiming = true;
  17.             this.setLocationAndAngles(shooter.posX + 0.1, shooter.posY + (double)shooter.getEyeHeight() - (shooter.isSneaking()?0.29D:0.2D) + 0.18, shooter.posZ + 0.15, shooter.rotationYaw, shooter.rotationPitch);
  18.         } else {
  19.             aiming = false;
  20.             this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight() - (shooter.isSneaking()?0.29D:0.2D) + 0.1, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch);
  21.         }
  22.  
  23.         posX += (double)(-MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
  24.         super.posZ += (double)(MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
  25.         super.posY += (double)(-MathHelper.sin(super.rotationPitch / 180.0F * 3.1415927F) * distance);
  26.         if(shooter != Minecraft.getMinecraft().thePlayer) {
  27.             super.posX -= (double)MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * 0.16D;
  28.             super.posZ -= (double)MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * 0.16D;
  29.         }
  30.  
  31.         this.size = size;
  32.         this.setPosition(super.posX, super.posY, super.posZ);
  33.         this.rotationRoll = (float)Math.random() * 360.0F;
  34.     }
  35.  
  36.     public EntityGunFlash(World w, double posX, double posY, double posZ, float yaw, float pitch, float size, float distance) {
  37.         super(w);
  38.         super.renderDistanceWeight = 100000.0D;
  39.         this.setSize(0.5F, 0.5F);
  40.         this.setLocationAndAngles(posX, posY, posZ, yaw, pitch);
  41.         super.posX += (double)(-MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
  42.         super.posZ += (double)(MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
  43.         super.posY += (double)(-MathHelper.sin(super.rotationPitch / 180.0F * 3.1415927F) * distance);
  44.         this.size = size;
  45.         this.setPosition(super.posX, super.posY, super.posZ);
  46.         this.rotationRoll = (float)Math.random() * 360.0F;
  47.     }
  48.  
  49.     public void onUpdate() {
  50.         super.onUpdate();
  51.         if(super.ticksExisted > 100.2) {
  52.             this.setDead();
  53.         }
  54.     }
  55.  
  56.     @Override
  57.     protected void entityInit() {
  58.  
  59.     }
  60.  
  61.     @Override
  62.     protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
  63.  
  64.     }
  65.  
  66.     @Override
  67.     protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
  68.  
  69.     }
  70.  
  71.     public int getBrightnessForRender(float par1) {
  72.         return 15728880;
  73.     }
  74.  
  75.     public float getBrightness(float par1) {
  76.         return 1.0F;
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement