public EntityThrownSickle(World world, EntityLivingBase entityLiving, double projectileSpeed) { this(world); throwingEntity = entityLiving; setSize(0.25F, 0.25F); setLocationAndAngles( entityLiving.posX, entityLiving.posY + entityLiving.getEyeHeight(), entityLiving.posZ, entityLiving.rotationYaw, entityLiving.rotationPitch); posX -= MathHelper.cos((rotationYaw / 180F) * 3.141593F) * 0.16F; posY -= 0.10000000149011612D; posZ -= MathHelper.sin((rotationYaw / 180F) * 3.141593F) * 0.16F; setPosition(posX, posY, posZ); yOffset = 0.0F; float f = 0.05F; motionX = -MathHelper.sin((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F) * f; motionZ = MathHelper.cos((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F) * f; motionY = -MathHelper.sin((rotationPitch / 180F) * 3.141593F) * f; setHeading(motionX, motionY, motionZ, projectileSpeed, projectileSpeed); this.projectileSpeed = projectileSpeed; }
public static MovingObjectPosition getMovingObjectPositionFromPlayer( World world, EntityLivingBase living, boolean bool) { float f = 1.0F; float f1 = living.prevRotationPitch + (living.rotationPitch - living.prevRotationPitch) * f; float f2 = living.prevRotationYaw + (living.rotationYaw - living.prevRotationYaw) * f; double d0 = living.prevPosX + (living.posX - living.prevPosX) * (double) f; double d1 = living.prevPosY + (living.posY - living.prevPosY) * (double) f + (double) (world.isRemote ? living.getEyeHeight() - (living instanceof EntityPlayer ? ((EntityPlayer) living).getDefaultEyeHeight() : 0) : living .getEyeHeight()); // isRemote check to revert changes to ray trace position // due to adding the eye height clientside and player // yOffset differences double d2 = living.prevPosZ + (living.posZ - living.prevPosZ) * (double) f; Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); float f5 = -MathHelper.cos(-f1 * 0.017453292F); float f6 = MathHelper.sin(-f1 * 0.017453292F); float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; if (living instanceof EntityPlayerMP) d3 = ((EntityPlayerMP) living).theItemInWorldManager.getBlockReachDistance(); Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); return world.func_147447_a(vec3, vec31, bool, !bool, false); }
public EntityArrowDoubleShot(World par1World, EntityLivingBase par2EntityLiving, float par3) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLiving; if (par2EntityLiving instanceof EntityPlayer) { this.canBePickedUp = 1; } this.setSize(0.5F, 0.5F); this.setLocationAndAngles( par2EntityLiving.posX, par2EntityLiving.posY + (double) par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch); this.posX -= (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F); this.posY -= 0.10000000149011612D; this.posZ -= (double) (MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F); this.setPosition(this.posX, this.posY, this.posZ); this.yOffset = 0.0F; this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI)); this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F); }
@Override public void setLivingAnimationsLM( EntityLiving entityliving, float f, float f1, float renderPartialTicks) { super.setLivingAnimationsLM(entityliving, f, f1, renderPartialTicks); float f3 = (float) entityliving.ticksExisted + renderPartialTicks + getCapsValueFloat(caps_entityIdFactor); float f4 = 0.0F; if (getCapsValueBoolean(caps_isLookSuger)) { f3 *= 8.0F; f4 = -0.2F; } else { f4 = (1F - (float) entityliving.health / 20F) * 0.5F; } float f5 = MathHelper.sin(f3 * 0.067F) * 0.05F - f4; float f6 = 40.0F / 57.29578F; sensor1.setRotateAngle(f5, -f6, f5); sensor2.setRotateAngle(-f5, f6, -f5); sensor3.setRotateAngle( MathHelper.sin(f3 * 0.067F) * 0.05F - 1.2F - f4, MathHelper.sin(f3 * 0.09F) * 0.4F, MathHelper.cos(f3 * 0.09F) * 0.2F); sensor4.setRotateAngle( MathHelper.sin(f3 * 0.067F) * 0.05F + f4, MathHelper.cos(f3 * 0.09F) * 0.5F, MathHelper.sin(f3 * 0.09F) * 0.2F); }
public EntityMeteorChunk(World par1World, EntityLivingBase par2EntityLivingBase, float speed) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLivingBase; if (par2EntityLivingBase instanceof EntityPlayer) { this.canBePickedUp = 1; } this.setSize(0.5F, 0.5F); this.setLocationAndAngles( par2EntityLivingBase.posX, par2EntityLivingBase.posY + par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch); this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.posY -= 0.10000000149011612D; this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(this.posX, this.posY, this.posZ); this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); this.motionY = -MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed * 1.5F, 1.0F); }
// Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the // movement of arms and legs, where par1 represents the time(so that arms and legs swing back and // forth) and par2 represents how "far" arms and legs can swing at most. public void setRotationAngles( float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) { this.head.rotateAngleY = par4 / (180F / (float) Math.PI); this.head.rotateAngleX = par5 / (180F / (float) Math.PI); this.leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; this.leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2; this.leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2; this.leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; }
public void setRotationAngles( float par1, float par2, float par3, float par4, float par5, float par6) { // head.rotateAngleX = par5 / (180F / (float)Math.PI); head.rotateAngleY = par4 / (180F / (float) Math.PI); body.rotateAngleX = ((float) Math.PI / 2F); leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.2F * par2; leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.2F * par2; leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.2F * par2; leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.2F * par2; }
/** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the * movement of arms and legs, where par1 represents the time(so that arms and legs swing back and * forth) and par2 represents how "far" arms and legs can swing at most. */ public void setRotationAngles( float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) { float var8 = MathHelper.cos(par3 * 0.1F); this.field_82905_a[1].rotateAngleX = (0.065F + 0.05F * var8) * (float) Math.PI; this.field_82905_a[2].setRotationPoint( -2.0F, 6.9F + MathHelper.cos(this.field_82905_a[1].rotateAngleX) * 10.0F, -0.5F + MathHelper.sin(this.field_82905_a[1].rotateAngleX) * 10.0F); this.field_82905_a[2].rotateAngleX = (0.265F + 0.1F * var8) * (float) Math.PI; this.field_82904_b[0].rotateAngleY = par4 / (180F / (float) Math.PI); this.field_82904_b[0].rotateAngleX = par5 / (180F / (float) Math.PI); }
/** Sets the models various rotation angles. */ public void setRotationAngles( float par1, float par2, float par3, float par4, float par5, float par6) { field_40340_a.rotateAngleY = par4 / (180F / (float) Math.PI); field_40340_a.rotateAngleX = par5 / (180F / (float) Math.PI); field_40339_c.rotationPointY = 3F; field_40339_c.rotationPointZ = -1F; field_40339_c.rotateAngleX = -0.75F; field_40336_d.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2 * 0.5F; field_40337_e.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2 * 0.5F; field_40336_d.rotateAngleY = 0.0F; field_40337_e.rotateAngleY = 0.0F; }
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { spiderHead.rotateAngleY = f3 / 57.29578F; spiderHead.rotateAngleX = f4 / 57.29578F; float f6 = 0.7853982F; spiderLeg1.rotateAngleZ = -f6; spiderLeg2.rotateAngleZ = f6; spiderLeg3.rotateAngleZ = -f6 * 0.74F; spiderLeg4.rotateAngleZ = f6 * 0.74F; spiderLeg5.rotateAngleZ = -f6 * 0.74F; spiderLeg6.rotateAngleZ = f6 * 0.74F; spiderLeg7.rotateAngleZ = -f6; spiderLeg8.rotateAngleZ = f6; float f7 = -0F; float f8 = 0.3926991F; spiderLeg1.rotateAngleY = f8 * 2.0F + f7; spiderLeg2.rotateAngleY = -f8 * 2.0F - f7; spiderLeg3.rotateAngleY = f8 * 1.0F + f7; spiderLeg4.rotateAngleY = -f8 * 1.0F - f7; spiderLeg5.rotateAngleY = -f8 * 1.0F + f7; spiderLeg6.rotateAngleY = f8 * 1.0F - f7; spiderLeg7.rotateAngleY = -f8 * 2.0F + f7; spiderLeg8.rotateAngleY = f8 * 2.0F - f7; float f9 = -(MathHelper.cos(f * 0.6662F * 2.0F + 0.0F) * 0.4F) * f1; float f10 = -(MathHelper.cos(f * 0.6662F * 2.0F + 3.141593F) * 0.4F) * f1; float f11 = -(MathHelper.cos(f * 0.6662F * 2.0F + 1.570796F) * 0.4F) * f1; float f12 = -(MathHelper.cos(f * 0.6662F * 2.0F + 4.712389F) * 0.4F) * f1; float f13 = Math.abs(MathHelper.sin(f * 0.6662F + 0.0F) * 0.4F) * f1; float f14 = Math.abs(MathHelper.sin(f * 0.6662F + 3.141593F) * 0.4F) * f1; float f15 = Math.abs(MathHelper.sin(f * 0.6662F + 1.570796F) * 0.4F) * f1; float f16 = Math.abs(MathHelper.sin(f * 0.6662F + 4.712389F) * 0.4F) * f1; spiderLeg1.rotateAngleY += f9; spiderLeg2.rotateAngleY += -f9; spiderLeg3.rotateAngleY += f10; spiderLeg4.rotateAngleY += -f10; spiderLeg5.rotateAngleY += f11; spiderLeg6.rotateAngleY += -f11; spiderLeg7.rotateAngleY += f12; spiderLeg8.rotateAngleY += -f12; spiderLeg1.rotateAngleZ += f13; spiderLeg2.rotateAngleZ += -f13; spiderLeg3.rotateAngleZ += f14; spiderLeg4.rotateAngleZ += -f14; spiderLeg5.rotateAngleZ += f15; spiderLeg6.rotateAngleZ += -f15; spiderLeg7.rotateAngleZ += f16; spiderLeg8.rotateAngleZ += -f16; }
/** * Instantiates a new item projectile. * * @param name projectile name * @param loc location of projectile (sets position of projectile and shoots in pitch and yaw * direction) * @param itemstack item stack to shoot * @param shooter projectile shooter * @param power projectile power */ @SuppressWarnings("deprecation") public ItemProjectile( String name, Location loc, org.bukkit.inventory.ItemStack itemstack, LivingEntity shooter, float power) { super(((CraftWorld) loc.getWorld()).getHandle(), loc.getX(), loc.getY(), loc.getZ(), null); if (CraftItemStack.asNMSCopy(itemstack) != null) setItemStack(CraftItemStack.asNMSCopy(itemstack)); else setItemStack( new net.minecraft.server.v1_8_R1.ItemStack( Item.getById(itemstack.getTypeId()), itemstack.getAmount(), itemstack.getData().getData())); if (itemstack.getTypeId() == 0) System.out.println("You cannot shoot air!"); this.name = name; this.pickupDelay = Integer.MAX_VALUE; this.shooter = ((CraftLivingEntity) shooter).getHandle(); this.a(0.25F, 0.25F); setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); locX -= (MathHelper.cos(yaw / 180.0F * 3.1415927F) * 0.16F); locY -= 0.10000000149011612D; locZ -= (MathHelper.sin(yaw / 180.0F * 3.1415927F) * 0.16F); setPosition(locX, locY, locZ); float f = 0.4F; motX = (-MathHelper.sin(yaw / 180.0F * 3.1415927F) * MathHelper.cos(pitch / 180.0F * 3.1415927F) * f); motZ = (MathHelper.cos(yaw / 180.0F * 3.1415927F) * MathHelper.cos(pitch / 180.0F * 3.1415927F) * f); motY = (-MathHelper.sin(pitch / 180.0F * 3.1415927F) * f); shoot(motX, motY, motZ, power * 1.5F, 1.0F); world.addEntity(this); try { this.f = Entity.class.getDeclaredField("invulnerable"); } catch (NoSuchFieldException e) { e.printStackTrace(); } }
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { float f6 = f2 * 3.141593F * -0.1F; for (int i = 0; i < 4; i++) { field_40323_a[i].rotationPointY = -2F + MathHelper.cos(((float) (i * 2) + f2) * 0.25F); field_40323_a[i].rotationPointX = MathHelper.cos(f6) * 9F; field_40323_a[i].rotationPointZ = MathHelper.sin(f6) * 9F; f6 += 1.570796F; } f6 = 0.7853982F + f2 * 3.141593F * 0.03F; for (int j = 4; j < 8; j++) { field_40323_a[j].rotationPointY = 2.0F + MathHelper.cos(((float) (j * 2) + f2) * 0.25F); field_40323_a[j].rotationPointX = MathHelper.cos(f6) * 7F; field_40323_a[j].rotationPointZ = MathHelper.sin(f6) * 7F; f6 += 1.570796F; } f6 = 0.4712389F + f2 * 3.141593F * -0.05F; for (int k = 8; k < 12; k++) { field_40323_a[k].rotationPointY = 11F + MathHelper.cos(((float) k * 1.5F + f2) * 0.5F); field_40323_a[k].rotationPointX = MathHelper.cos(f6) * 5F; field_40323_a[k].rotationPointZ = MathHelper.sin(f6) * 5F; f6 += 1.570796F; } field_40322_b.rotateAngleY = f3 / 57.29578F; field_40322_b.rotateAngleX = f4 / 57.29578F; }
public void l_() { if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) { this.dead = true; } this.c += (this.b - this.c) * 0.5F; this.d = this.c; boolean flag = this.onGround; super.l_(); int i; if (this.onGround && !flag) { i = this.getSize(); for (int j = 0; j < i * 8; ++j) { float f = this.random.nextFloat() * 3.1415927F * 2.0F; float f1 = this.random.nextFloat() * 0.5F + 0.5F; float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1; float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1; this.world.addParticle( this.h(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D); } if (this.o()) { this.makeSound( this.n(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F); } this.b = -0.5F; } else if (!this.onGround && flag) { this.b = 1.0F; } this.k(); if (this.world.isStatic) { i = this.getSize(); this.a(0.6F * (float) i, 0.6F * (float) i); } }
/** * Instantiates a new item projectile. * * @param name projectile name * @param shooter projectile shooter (it uses entity's location to set x, y, z, pitch and yaw of * projectile) * @param item item stack to shoot * @param power projectile power */ public ItemProjectile( String name, LivingEntity shooter, org.bukkit.inventory.ItemStack item, float power) { super(((CraftLivingEntity) shooter).getHandle().world); this.name = name; this.pickupDelay = Integer.MAX_VALUE; setItemStack(CraftItemStack.asNMSCopy(item)); this.shooter = ((CraftLivingEntity) shooter).getHandle(); this.a(0.25F, 0.25F); setPositionRotation( shooter.getLocation().getX(), shooter.getLocation().getY() + shooter.getEyeHeight(), shooter.getLocation().getZ(), shooter.getLocation().getYaw(), shooter.getLocation().getPitch()); locX -= (MathHelper.cos(yaw / 180.0F * 3.1415927F) * 0.16F); locY -= 0.10000000149011612D; locZ -= (MathHelper.sin(yaw / 180.0F * 3.1415927F) * 0.16F); setPosition(locX, locY, locZ); float f = 0.4F; motX = (-MathHelper.sin(yaw / 180.0F * 3.1415927F) * MathHelper.cos(pitch / 180.0F * 3.1415927F) * f); motZ = (MathHelper.cos(yaw / 180.0F * 3.1415927F) * MathHelper.cos(pitch / 180.0F * 3.1415927F) * f); motY = (-MathHelper.sin(pitch / 180.0F * 3.1415927F) * f); shoot(motX, motY, motZ, power * 1.5F, 1.0F); world.addEntity(this); try { this.f = Entity.class.getDeclaredField("invulnerable"); } catch (NoSuchFieldException e) { e.printStackTrace(); } }
/** Sets the models various rotation angles. */ public void setRotationAngles( float par1, float par2, float par3, float par4, float par5, float par6) { super.setRotationAngles(par1, par2, par3, par4, par5, par6); this.field_78195_c.rotateAngleY = par4 / (180F / (float) Math.PI); this.field_78195_c.rotateAngleX = par5 / (180F / (float) Math.PI); this.field_78196_a.rotateAngleY = par4 / (180F / (float) Math.PI) * 0.25F; float var7 = MathHelper.sin(this.field_78196_a.rotateAngleY); float var8 = MathHelper.cos(this.field_78196_a.rotateAngleY); this.field_78192_d.rotateAngleZ = 1.0F; this.field_78193_e.rotateAngleZ = -1.0F; this.field_78192_d.rotateAngleY = 0.0F + this.field_78196_a.rotateAngleY; this.field_78193_e.rotateAngleY = (float) Math.PI + this.field_78196_a.rotateAngleY; this.field_78192_d.rotationPointX = var8 * 5.0F; this.field_78192_d.rotationPointZ = -var7 * 5.0F; this.field_78193_e.rotationPointX = -var8 * 5.0F; this.field_78193_e.rotationPointZ = var7 * 5.0F; }
public Vec3D getFogColor(float f, float f1) { int i = 0x8080a0; float f2 = MathHelper.cos(f * 3.141593F * 2.0F) * 2.0F + 0.5F; if (f2 < 0.0F) { f2 = 0.0F; } if (f2 > 1.0F) { f2 = 1.0F; } float f3 = (float) (i >> 16 & 0xff) / 255F; float f4 = (float) (i >> 8 & 0xff) / 255F; float f5 = (float) (i & 0xff) / 255F; f3 *= f2 * 0.0F + 0.15F; f4 *= f2 * 0.0F + 0.15F; f5 *= f2 * 0.0F + 0.15F; return Vec3D.createVector(f3, f4, f5); }
/** Returns array with sunrise/sunset colors */ public float[] calcSunriseSunsetColors(float par1, float par2) { float var3 = 0.4F; float var4 = MathHelper.cos(par1 * (float) Math.PI * 2.0F) - 0.0F; float var5 = -0.0F; if (var4 >= var5 - var3 && var4 <= var5 + var3) { float var6 = (var4 - var5) / var3 * 0.5F + 0.5F; float var7 = 1.0F - (1.0F - MathHelper.sin(var6 * (float) Math.PI)) * 0.99F; var7 *= var7; this.colorsSunriseSunset[0] = var6 * 0.3F + 0.7F; this.colorsSunriseSunset[1] = var6 * var6 * 0.7F + 0.2F; this.colorsSunriseSunset[2] = var6 * var6 * 0.0F + 0.2F; this.colorsSunriseSunset[3] = var7; return this.colorsSunriseSunset; } else { return null; } }
public void w_() { if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) { this.dead = true; } this.b += (this.a - this.b) * 0.5F; this.c = this.b; boolean flag = this.onGround; super.w_(); if (this.onGround && !flag) { int i = this.getSize(); for (int j = 0; j < i * 8; ++j) { float f = this.random.nextFloat() * 3.1415927F * 2.0F; float f1 = this.random.nextFloat() * 0.5F + 0.5F; float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1; float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1; this.world.a( this.w(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D); } if (this.G()) { this.world.makeSound( this, this.E(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F); } this.a = -0.5F; } this.B(); }
/** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the * movement of arms and legs, where par1 represents the time(so that arms and legs swing back and * forth) and par2 represents how "far" arms and legs can swing at most. */ public void setRotationAngles( float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) { for (int var8 = 0; var8 < this.silverfishBodyParts.length; ++var8) { this.silverfishBodyParts[var8].rotateAngleY = MathHelper.cos(par3 * 0.9F + (float) var8 * 0.15F * (float) Math.PI) * (float) Math.PI * 0.05F * (float) (1 + Math.abs(var8 - 2)); this.silverfishBodyParts[var8].rotationPointX = MathHelper.sin(par3 * 0.9F + (float) var8 * 0.15F * (float) Math.PI) * (float) Math.PI * 0.2F * (float) Math.abs(var8 - 2); } this.silverfishWings[0].rotateAngleY = this.silverfishBodyParts[2].rotateAngleY; this.silverfishWings[1].rotateAngleY = this.silverfishBodyParts[4].rotateAngleY; this.silverfishWings[1].rotationPointX = this.silverfishBodyParts[4].rotationPointX; this.silverfishWings[2].rotateAngleY = this.silverfishBodyParts[1].rotateAngleY; this.silverfishWings[2].rotationPointX = this.silverfishBodyParts[1].rotationPointX; }
/** Return Vec3D with biome specific fog color */ public Vec3 getFogColor(float par1, float par2) { float var3 = MathHelper.cos(par1 * (float) Math.PI * 2.0F) * 2.0F + 0.5F; if (var3 < 0.0F) { var3 = 0.0F; } if (var3 > 1.0F) { var3 = 1.0F; } float var4 = 0.7529412F; float var5 = 0.84705883F; float var6 = 1.0F; var4 *= var3 * 0.94F + 0.06F; var5 *= var3 * 0.94F + 0.06F; var6 *= var3 * 0.91F + 0.09F; return this.worldObj .getWorldVec3Pool() .getVecFromPool((double) var4, (double) var5, (double) var6); }
public boolean m(Entity entity) { float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue(); int i = 0; if (entity instanceof EntityLiving) { f += EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity); i += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity); } boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f); if (flag) { if (i > 0) { entity.g( (double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F)); this.motX *= 0.6D; this.motZ *= 0.6D; } int j = EnchantmentManager.getFireAspectEnchantmentLevel(this); if (j > 0) { entity.setOnFire(j * 4); } if (entity instanceof EntityLiving) { EnchantmentManager.a((EntityLiving) entity, (Entity) this); } EnchantmentManager.b(this, entity); } return flag; }
/** Updates the task */ public void updateTask() { EntityPlayer var1 = (EntityPlayer) this.thisEntity.riddenByEntity; EntityCreature var2 = (EntityCreature) this.thisEntity; float var3 = MathHelper.wrapAngleTo180_float(var1.rotationYaw - this.thisEntity.rotationYaw) * 0.5F; if (var3 > 5.0F) { var3 = 5.0F; } if (var3 < -5.0F) { var3 = -5.0F; } this.thisEntity.rotationYaw = MathHelper.wrapAngleTo180_float(this.thisEntity.rotationYaw + var3); if (this.currentSpeed < this.maxSpeed) { this.currentSpeed += (this.maxSpeed - this.currentSpeed) * 0.01F; } if (this.currentSpeed > this.maxSpeed) { this.currentSpeed = this.maxSpeed; } int var4 = MathHelper.floor_double(this.thisEntity.posX); int var5 = MathHelper.floor_double(this.thisEntity.posY); int var6 = MathHelper.floor_double(this.thisEntity.posZ); float var7 = this.currentSpeed; if (this.speedBoosted) { if (this.speedBoostTime++ > this.maxSpeedBoostTime) { this.speedBoosted = false; } var7 += var7 * 1.15F * MathHelper.sin( (float) this.speedBoostTime / (float) this.maxSpeedBoostTime * (float) Math.PI); } float var8 = 0.91F; if (this.thisEntity.onGround) { var8 = 0.54600006F; int var9 = this.thisEntity.worldObj.getBlockId( MathHelper.floor_float((float) var4), MathHelper.floor_float((float) var5) - 1, MathHelper.floor_float((float) var6)); if (var9 > 0) { var8 = Block.blocksList[var9].slipperiness * 0.91F; } } float var23 = 0.16277136F / (var8 * var8 * var8); float var10 = MathHelper.sin(var2.rotationYaw * (float) Math.PI / 180.0F); float var11 = MathHelper.cos(var2.rotationYaw * (float) Math.PI / 180.0F); float var12 = var2.getAIMoveSpeed() * var23; float var13 = Math.max(var7, 1.0F); var13 = var12 / var13; float var14 = var7 * var13; float var15 = -(var14 * var10); float var16 = var14 * var11; if (MathHelper.abs(var15) > MathHelper.abs(var16)) { if (var15 < 0.0F) { var15 -= this.thisEntity.width / 2.0F; } if (var15 > 0.0F) { var15 += this.thisEntity.width / 2.0F; } var16 = 0.0F; } else { var15 = 0.0F; if (var16 < 0.0F) { var16 -= this.thisEntity.width / 2.0F; } if (var16 > 0.0F) { var16 += this.thisEntity.width / 2.0F; } } int var17 = MathHelper.floor_double(this.thisEntity.posX + (double) var15); int var18 = MathHelper.floor_double(this.thisEntity.posZ + (double) var16); PathPoint var19 = new PathPoint( MathHelper.floor_float(this.thisEntity.width + 1.0F), MathHelper.floor_float(this.thisEntity.height + var1.height + 1.0F), MathHelper.floor_float(this.thisEntity.width + 1.0F)); if (var4 != var17 || var6 != var18) { int var20 = this.thisEntity.worldObj.getBlockId(var4, var5, var6); int var21 = this.thisEntity.worldObj.getBlockId(var4, var5 - 1, var6); boolean var22 = this.func_98216_b(var20) || Block.blocksList[var20] == null && this.func_98216_b(var21); if (!var22 && PathFinder.func_82565_a(this.thisEntity, var17, var5, var18, var19, false, false, true) == 0 && PathFinder.func_82565_a( this.thisEntity, var4, var5 + 1, var6, var19, false, false, true) == 1 && PathFinder.func_82565_a( this.thisEntity, var17, var5 + 1, var18, var19, false, false, true) == 1) { var2.getJumpHelper().setJumping(); } } if (!var1.capabilities.isCreativeMode && this.currentSpeed >= this.maxSpeed * 0.5F && this.thisEntity.getRNG().nextFloat() < 0.006F && !this.speedBoosted) { ItemStack var24 = var1.getHeldItem(); if (var24 != null && var24.itemID == Item.carrotOnAStick.itemID) { var24.damageItem(1, var1); if (var24.stackSize == 0) { ItemStack var25 = new ItemStack(Item.fishingRod); var25.setTagCompound(var24.stackTagCompound); var1.inventory.mainInventory[var1.inventory.currentItem] = var25; } } } this.thisEntity.moveEntityWithHeading(0.0F, var7); }
@Override public boolean update() { EntityHuman passenger = (EntityHuman) this.getEntityHandle().passenger; EntityLiving entity = this.getEntityHandle(); float f = MathHelper.g(passenger.yaw - entity.yaw) * 0.5f; if (f > 5) f = 5; if (f < -5) f = -5; entity.yaw = MathHelper.g(entity.yaw + f); if (this.m_currentSpeed < this.m_maxSpeed) this.m_currentSpeed += (this.m_maxSpeed - this.m_currentSpeed) * 0.01; if (this.m_currentSpeed > this.m_maxSpeed) this.m_currentSpeed = this.m_maxSpeed; int x = MathHelper.floor(entity.locX); int y = MathHelper.floor(entity.locY); int z = MathHelper.floor(entity.locZ); float speed = this.m_currentSpeed; if (this.m_speedBoosted) { if (this.m_speedBoostTime++ > this.m_maxSpeedBoostTime) this.m_speedBoosted = false; speed += speed * 1.15 * MathHelper.sin( (float) (this.m_speedBoostTime / this.m_maxSpeedBoostTime * Math.PI)); } float f2 = 0.91f; if (entity.onGround) { f2 = 0.54600006F; Block block = entity.world.getType(MathHelper.d(x), MathHelper.d(y) - 1, MathHelper.d(z)); if (block.getMaterial() != Material.AIR) f2 = block.frictionFactor * 0.91f; } float f3 = 0.16277136F / (f2 * f2 * f2); float f4 = MathHelper.sin(entity.yaw * 3.1415927F / 180.0F); float f5 = MathHelper.cos(entity.yaw * 3.1415927F / 180.0F); float f6 = entity.bl() * f3; float f7 = Math.max(speed, 1.0F); f7 = f6 / f7; float f8 = speed * f7; float f9 = -(f8 * f4); float f10 = f8 * f5; if (MathHelper.abs(f9) > MathHelper.abs(f10)) { if (f9 < 0.0F) { f9 -= entity.width / 2.0F; } if (f9 > 0.0F) { f9 += entity.width / 2.0F; } f10 = 0.0F; } else { f9 = 0.0F; if (f10 < 0.0F) { f10 -= entity.width / 2.0F; } if (f10 > 0.0F) { f10 += entity.width / 2.0F; } } int nextX = MathHelper.floor(entity.locX + f9); int nextZ = MathHelper.floor(entity.locZ + f10); PathPoint point = new PathPoint( MathHelper.d(entity.width + 1), MathHelper.d(entity.length + passenger.length + 1), MathHelper.d(entity.width + 1)); if (x != nextX || z != nextZ) { Block type1 = entity.world.getType(x, y, z); Block type2 = entity.world.getType(x, y - 1, z); boolean isStep = this.isStep(type1) || type1 == null && this.isStep(type2); if (!isStep && Pathfinder.a(entity, nextX, y, nextZ, point, false, false, true) == 0 && Pathfinder.a(entity, x, y + 1, z, point, false, false, true) == 1 && Pathfinder.a(entity, nextX, y + 1, nextZ, point, false, false, true) == 1) NMSUtil.getControllerLook(entity).a(); } if (!passenger.abilities.canInstantlyBuild && this.m_currentSpeed >= this.m_maxSpeed * 0.5 && entity.aI().nextFloat() < 0.006f && !this.m_speedBoosted) { ItemStack item = passenger.be(); if (item != null && item.getItem() == Items.CARROT_STICK) { item.damage(1, passenger); if (item.count == 0) { ItemStack newItem = new ItemStack(Items.FISHING_ROD); newItem.setTag(item.tag); passenger.inventory.items[passenger.inventory.itemInHandIndex] = newItem; } } } entity.e(0, speed); return true; }
public void render() { update(); // System.out.println("Model delta time sec: " + deltaTime); if (!visible) return; if (bottomVisible) bottom.render(x2scale); frontWall.render(x2scale); backWall.render(x2scale); leftWall.render(x2scale); rightWall.render(x2scale); // windshield // cockpit1.render(scale); // cockpit2.render(scale); // cockpit3.render(scale); windshield.render(x2scale); // rotor supports rotor2.render(x2scale); rotor3.render(x2scale); tail.render(x2scale); if (ENABLE_ROTOR && !paused) { if (rotorSpeed > 0f) { if (timeSpun < SPIN_UP_TIME) { timeSpun += deltaTime * 3f; // spin up faster than spin down mainRotor.rotateAngleY += deltaTime * MAX_ROTOR_SPEED * rotorSpeed * timeSpun / SPIN_UP_TIME; tailRotor.rotateAngleZ -= deltaTime * MAX_ROTOR_SPEED * timeSpun / SPIN_UP_TIME; // not linked to throttle } else { mainRotor.rotateAngleY += deltaTime * MAX_ROTOR_SPEED * rotorSpeed; tailRotor.rotateAngleZ -= deltaTime * MAX_ROTOR_SPEED; } if (mainRotor.rotateAngleY > 2 * PI) mainRotor.rotateAngleY -= 2 * PI; mainRotor.render(x2scale); mainRotor.rotateAngleY += 1.5707f; // add second blade perp mainRotor.render(x2scale); if (tailRotor.rotateAngleZ < 2 * PI) tailRotor.rotateAngleZ += 2 * PI; tailRotor.render(x2scale); tailRotor.rotateAngleZ -= 1.5707f; // add second blade perp tailRotor.render(x2scale); } else { rotorSpeed = 0f; if (timeSpun > 0f) { timeSpun -= deltaTime; mainRotor.rotateAngleY += deltaTime * MAX_ROTOR_SPEED * (1 - MathHelper.cos(timeSpun / SPIN_UP_TIME)); tailRotor.rotateAngleZ += deltaTime * MAX_ROTOR_SPEED * (1 - MathHelper.cos(timeSpun / SPIN_UP_TIME)); // remember stopping position lastRotorRad = mainRotor.rotateAngleY; lastTailRotorRad = tailRotor.rotateAngleZ; } else { mainRotor.rotateAngleY = lastRotorRad; tailRotor.rotateAngleZ = lastTailRotorRad; } mainRotor.render(x2scale); mainRotor.rotateAngleY += 1.5707f; // add second blade perp mainRotor.render(x2scale); tailRotor.render(x2scale); tailRotor.rotateAngleZ -= 1.5707f; // add second blade perp tailRotor.render(x2scale); } } else { // show fixed rotor by rendering twice mainRotor.rotateAngleY = 0.7854f; mainRotor.render(x2scale); mainRotor.rotateAngleY += 1.5707f; mainRotor.render(x2scale); tailRotor.rotateAngleZ = 0.7854f; tailRotor.render(x2scale); tailRotor.rotateAngleZ += 1.5707f; tailRotor.render(x2scale); } }
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { bipedHead.rotateAngleY = f3 / 57.29578F; bipedHead.rotateAngleX = f4 / 57.29578F; bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY; bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX; bipedRightArm.rotateAngleX = MathHelper.cos(f * 0.6662F + 3.141593F) * 2.0F * f1 * 0.5F; bipedLeftArm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 2.0F * f1 * 0.5F; bipedRightArm.rotateAngleZ = 0.0F; bipedLeftArm.rotateAngleZ = 0.0F; bipedRightLeg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1; bipedLeftLeg.rotateAngleX = MathHelper.cos(f * 0.6662F + 3.141593F) * 1.4F * f1; bipedRightLeg.rotateAngleY = 0.0F; bipedLeftLeg.rotateAngleY = 0.0F; if (isRiding) { bipedRightArm.rotateAngleX += -0.6283185F; bipedLeftArm.rotateAngleX += -0.6283185F; bipedRightLeg.rotateAngleX = -1.256637F; bipedLeftLeg.rotateAngleX = -1.256637F; bipedRightLeg.rotateAngleY = 0.3141593F; bipedLeftLeg.rotateAngleY = -0.3141593F; } if (field_1279_h) { bipedLeftArm.rotateAngleX = bipedLeftArm.rotateAngleX * 0.5F - 0.3141593F; } if (field_1278_i) { bipedRightArm.rotateAngleX = bipedRightArm.rotateAngleX * 0.5F - 0.3141593F; } bipedRightArm.rotateAngleY = 0.0F; bipedLeftArm.rotateAngleY = 0.0F; if (onGround > -9990F) { float f6 = onGround; bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * 3.141593F * 2.0F) * 0.2F; bipedRightArm.offsetZ = MathHelper.sin(bipedBody.rotateAngleY) * 5F; bipedRightArm.offsetX = -MathHelper.cos(bipedBody.rotateAngleY) * 5F; bipedLeftArm.offsetZ = -MathHelper.sin(bipedBody.rotateAngleY) * 5F; bipedLeftArm.offsetX = MathHelper.cos(bipedBody.rotateAngleY) * 5F; bipedRightArm.rotateAngleY += bipedBody.rotateAngleY; bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY; bipedLeftArm.rotateAngleX += bipedBody.rotateAngleY; f6 = 1.0F - onGround; f6 *= f6; f6 *= f6; f6 = 1.0F - f6; float f7 = MathHelper.sin(f6 * 3.141593F); float f8 = MathHelper.sin(onGround * 3.141593F) * -(bipedHead.rotateAngleX - 0.7F) * 0.75F; bipedRightArm.rotateAngleX -= (double) f7 * 1.2D + (double) f8; bipedRightArm.rotateAngleY += bipedBody.rotateAngleY * 2.0F; bipedRightArm.rotateAngleZ = MathHelper.sin(onGround * 3.141593F) * -0.4F; } if (isSneak) { bipedBody.rotateAngleX = 0.5F; bipedRightLeg.rotateAngleX -= 0.0F; bipedLeftLeg.rotateAngleX -= 0.0F; bipedRightArm.rotateAngleX += 0.4F; bipedLeftArm.rotateAngleX += 0.4F; bipedRightLeg.offsetZ = 4F; bipedLeftLeg.offsetZ = 4F; bipedRightLeg.offsetY = 9F; bipedLeftLeg.offsetY = 9F; bipedHead.offsetY = 1.0F; } else { bipedBody.rotateAngleX = 0.0F; bipedRightLeg.offsetZ = 0.0F; bipedLeftLeg.offsetZ = 0.0F; bipedRightLeg.offsetY = 12F; bipedLeftLeg.offsetY = 12F; bipedHead.offsetY = 0.0F; } bipedRightArm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; bipedLeftArm.rotateAngleZ -= MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; bipedRightArm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F; bipedLeftArm.rotateAngleX -= MathHelper.sin(f2 * 0.067F) * 0.05F; }
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { RTailFin.rotateAngleX = MathHelper.cos(f * 0.6662F) * f1; LTailFin.rotateAngleX = MathHelper.cos(f * 0.6662F) * f1; }
static void ride(float sideMot, float forMot, EntityHuman passenger, EntityInsentient entity) { if (!(entity instanceof EntityBase)) throw new IllegalArgumentException("The entity field should implements EntityBase"); EntityBase entityBase = (EntityBase) entity; WrapperEntityInsentient wEntity = new WrapperEntityInsentient(entity); WrapperEntityHuman wPassenger = new WrapperEntityHuman(passenger); if (passenger != null) { entity.lastYaw = entity.yaw = passenger.yaw % 360f; entity.pitch = (passenger.pitch * 0.5F) % 360f; wEntity.setRenderYawOffset(entity.yaw); wEntity.setRotationYawHead(entity.yaw); sideMot = wPassenger.getMoveStrafing() * 0.25f; forMot = wPassenger.getMoveForward() * 0.5f; if (forMot <= 0.0F) forMot *= 0.25F; wEntity.setJumping(wPassenger.isJumping()); if (wPassenger.isJumping() && (entity.onGround || entityBase.canFly())) { entity.motY = 0.4D; float f2 = MathHelper.sin(entity.yaw * 0.017453292f); float f3 = MathHelper.cos(entity.yaw * 0.017453292f); entity.motX += (double) (-0.4f * f2); entity.motZ += (double) (0.4f * f3); } wEntity.setStepHeight(1.0f); wEntity.setJumpMovementFactor(wEntity.getMoveSpeed() * 0.1f); wEntity.setRotationYawHead(entity.yaw); if (wEntity.canPassengerSteer()) { wEntity.setMoveSpeed(0.35f * entityBase.getSpeed()); entityBase.g_(sideMot, forMot); } wEntity.setPrevLimbSwingAmount(wEntity.getLimbSwingAmount()); double dx = entity.locX - entity.lastX; double dz = entity.locZ - entity.lastZ; float f4 = MathHelper.sqrt(dx * dx + dz * dz) * 4; if (f4 > 1) f4 = 1; wEntity.setLimbSwingAmount( wEntity.getLimbSwingAmount() + (f4 - wEntity.getLimbSwingAmount()) * 0.4f); wEntity.setLimbSwing(wEntity.getLimbSwing() + wEntity.getLimbSwingAmount()); } else { wEntity.setStepHeight(0.5f); wEntity.setJumpMovementFactor(0.02f); entityBase.g_(sideMot, forMot); } }