Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EntityGunFlash extends Entity {
- public final float size;
- public final float distance = 0.0F;
- public final float rotationRoll;
- public static boolean aiming;
- public EntityGunFlash(EntityPlayer shooter, float size, float distance) {
- super(shooter.worldObj);
- super.renderDistanceWeight = 100000.0D;
- this.setSize(0.5F, 0.5F);
- Vec3 vec = shooter.getLookVec();
- posX = vec.xCoord * distance + shooter.posX;
- if(FMLClientHandler.instance().getClientPlayerEntity().inventory.getCurrentItem() != null && FMLClientHandler.instance().getClientPlayerEntity().inventory.getCurrentItem().getItem() instanceof LDItemWeapon && Mouse.isButtonDown(1) && FMLClientHandler.instance().getClient().currentScreen == null) {
- //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);
- aiming = true;
- 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);
- } else {
- aiming = false;
- this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight() - (shooter.isSneaking()?0.29D:0.2D) + 0.1, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch);
- }
- posX += (double)(-MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
- super.posZ += (double)(MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
- super.posY += (double)(-MathHelper.sin(super.rotationPitch / 180.0F * 3.1415927F) * distance);
- if(shooter != Minecraft.getMinecraft().thePlayer) {
- super.posX -= (double)MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * 0.16D;
- super.posZ -= (double)MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * 0.16D;
- }
- this.size = size;
- this.setPosition(super.posX, super.posY, super.posZ);
- this.rotationRoll = (float)Math.random() * 360.0F;
- }
- public EntityGunFlash(World w, double posX, double posY, double posZ, float yaw, float pitch, float size, float distance) {
- super(w);
- super.renderDistanceWeight = 100000.0D;
- this.setSize(0.5F, 0.5F);
- this.setLocationAndAngles(posX, posY, posZ, yaw, pitch);
- super.posX += (double)(-MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
- super.posZ += (double)(MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
- super.posY += (double)(-MathHelper.sin(super.rotationPitch / 180.0F * 3.1415927F) * distance);
- this.size = size;
- this.setPosition(super.posX, super.posY, super.posZ);
- this.rotationRoll = (float)Math.random() * 360.0F;
- }
- public void onUpdate() {
- super.onUpdate();
- if(super.ticksExisted > 100.2) {
- this.setDead();
- }
- }
- @Override
- protected void entityInit() {
- }
- @Override
- protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
- }
- @Override
- protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
- }
- public int getBrightnessForRender(float par1) {
- return 15728880;
- }
- public float getBrightness(float par1) {
- return 1.0F;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement