Java Code Examples for net.minecraft.util.math.MathHelper#cos()
The following examples show how to use
net.minecraft.util.math.MathHelper#cos() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TileHaloInfuser.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
public void refreshEntities() { entities.forEach(entityHaloInfusionItem -> world.removeEntity(entityHaloInfusionItem)); entities.clear(); int count = HaloInfusionItemRegistry.getItems().size(); double radius = 3; for (int i = 0; i < count; i++) { float angle = (float) (i * Math.PI * 2.0 / count); double x = (pos.getX() + 0.5 + MathHelper.cos(angle) * radius); double z = (pos.getZ() + 0.5 + MathHelper.sin(angle) * radius); EntityHaloInfusionItem entity = new EntityHaloInfusionItem(world, HaloInfusionItemRegistry.EMPTY, getPos(), i); entity.setPosition(x, pos.getY() + 2, z); entity.forceSpawn = true; world.spawnEntity(entity); entities.add(entity); } }
Example 2
Source File: SaddleBags.java From MineLittlePony with MIT License | 6 votes |
@Override public void setRotationAndAngles(boolean rainboom, UUID interpolatorId, float move, float swing, float bodySwing, float ticks) { float pi = PI * (float) Math.pow(swing, 16); float mve = move * 0.6662f; float srt = swing / 10; bodySwing = MathHelper.cos(mve + pi) * srt; leftBag.pitch = bodySwing; rightBag.pitch = bodySwing; if (model instanceof IPegasus && model.isFlying()) { bodySwing = ((IPegasus)model).getWingRotationFactor(ticks) - ROTATE_270; bodySwing /= 10; } leftBag.roll = bodySwing; rightBag.roll = -bodySwing; dropAmount = hangLow ? 0.15F : 0; }
Example 3
Source File: ModelTofuChinger.java From TofuCraftReload with MIT License | 6 votes |
@Override public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { float f = ageInTicks - (float)entityIn.ticksExisted; float f1 = ((EntityTofuChinger)entityIn).getMouseAnimationScale(f); f1 = f1 * f1; this.head.rotateAngleY = netHeadYaw * 0.017453292F; this.head.rotateAngleX = headPitch * 0.017453292F - 0.8F * f1; this.chin.rotateAngleY = netHeadYaw * 0.017453292F; this.chin.rotateAngleX = headPitch * 0.017453292F; this.mainlegR.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; this.mainlegL.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; this.backlegR.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; this.backlegL.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; }
Example 4
Source File: HandEntity.java From pycode-minecraft with MIT License | 5 votes |
public void moveForward(float distance) { Vec3d pos = this.getPositionVector(); float f1 = -MathHelper.sin(this.rotationYaw * 0.017453292F); float f2 = MathHelper.cos(this.rotationYaw * 0.017453292F); pos = pos.addVector(distance * f1, 0, distance * f2); this.setPosition(pos.xCoord, pos.yCoord, pos.zCoord); }
Example 5
Source File: GCOreFeature.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override public boolean generate(ServerWorldAccess serverWorldAccess, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, GCOreFeatureConfig oreFeatureConfig) { float f = random.nextFloat() * 3.1415927F; float g = (float) oreFeatureConfig.size / 8.0F; int i = MathHelper.ceil(((float) oreFeatureConfig.size / 16.0F * 2.0F + 1.0F) / 2.0F); double d = (float) blockPos.getX() + MathHelper.sin(f) * g; double e = (float) blockPos.getX() - MathHelper.sin(f) * g; double h = (float) blockPos.getZ() + MathHelper.cos(f) * g; double j = (float) blockPos.getZ() - MathHelper.cos(f) * g; double l = blockPos.getY() + random.nextInt(3) - 2; double m = blockPos.getY() + random.nextInt(3) - 2; int n = blockPos.getX() - MathHelper.ceil(g) - i; int o = blockPos.getY() - 2 - i; int p = blockPos.getZ() - MathHelper.ceil(g) - i; int q = 2 * (MathHelper.ceil(g) + i); int r = 2 * (2 + i); for (int s = n; s <= n + q; ++s) { for (int t = p; t <= p + q; ++t) { if (o <= serverWorldAccess.getTopY(Heightmap.Type.OCEAN_FLOOR_WG, s, t)) { return this.generateVeinPart(serverWorldAccess, random, oreFeatureConfig, d, e, h, j, l, m, n, o, p, q, r); } } } return false; }
Example 6
Source File: ModelLion.java From TFC2 with GNU General Public License v3.0 | 5 votes |
/** * 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. */ @Override public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { float f6 = (180F / (float)Math.PI); this.HEAD.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); this.HEAD.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); this.LegLEFTFRONT.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.0F * p_78087_2_; this.LegLEFTREAR.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.4662F + (float)Math.PI) * 1.0F * p_78087_2_; this.LegRIGHTFRONT.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.0F * p_78087_2_; this.LegRIGHTREAR.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.4662F) * 1.0F * p_78087_2_; }
Example 7
Source File: WorldProviderPlanet.java From AdvancedRocketry with MIT License | 5 votes |
@Override public float getSunBrightness(float partialTicks) { float atmosphere = getAtmosphereDensity(new BlockPos(0,0,0)); Math.abs(1-atmosphere); //calculateCelestialAngle(p_76563_1_, p_76563_3_) float f1 = world.getCelestialAngle(partialTicks); float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.2F) - atmosphere/4f; if (f2 < 0.0F) { f2 = 0.0F ; } if (f2 > 1.0F) { f2 = 1.0F; } f2 = 1.0F - f2; //Eclipse handling if(this.world.isRemote) { DimensionProperties properties = getDimensionProperties(Minecraft.getMinecraft().player.getPosition()); if(properties.isMoon()) { f2 = eclipseValue(properties, f2, partialTicks); } else { for(int i : properties.getChildPlanets()) { DimensionProperties childProps = DimensionManager.getInstance().getDimensionProperties(i); f2 = eclipseValue(childProps, f2, partialTicks); } } } return f2*super.getSunBrightness(partialTicks); }
Example 8
Source File: AbstractPonyModel.java From MineLittlePony with MIT License | 5 votes |
/** * * Used to set the legs rotation based on walking/crouching animations. * * Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles} * */ protected void rotateLegs(float move, float swing, float ticks, T entity) { if (attributes.isSwimming) { rotateLegsSwimming(move, swing, ticks, entity); } else if (attributes.isGoingFast) { rotateLegsInFlight(move, swing, ticks, entity); } else { rotateLegsOnGround(move, swing, ticks, entity); } float sin = MathHelper.sin(torso.yaw) * 5; float cos = MathHelper.cos(torso.yaw) * 5; float spread = attributes.isGoingFast ? 2 : 1; rightArm.pivotZ = spread + sin; leftArm.pivotZ = spread - sin; float legRPX = cos - getLegOutset() - 0.001F; legRPX = getMetadata().getInterpolator(attributes.interpolatorId).interpolate("legOffset", legRPX, 3); rightArm.pivotX = -legRPX; rightLeg.pivotX = -legRPX; leftArm.pivotX = legRPX; leftLeg.pivotX = legRPX; rightArm.yaw += torso.yaw; leftArm.yaw += torso.yaw; rightArm.pivotY = leftArm.pivotY = 8; rightLeg.pivotZ = leftLeg.pivotZ = 10; }
Example 9
Source File: HallowedOreFeature.java From the-hallow with MIT License | 5 votes |
@Override public boolean generate(IWorld world, ChunkGenerator<? extends ChunkGeneratorConfig> chunkGenerator, Random random, BlockPos blockPos, HallowedOreFeatureConfig oreFeatureConfig) { float randomNumberFromZeroToPi = random.nextFloat() * 3.1415927F; float dividedSize = (float) oreFeatureConfig.size / 8.0F; int ceilSize = MathHelper.ceil(((float) oreFeatureConfig.size / 16.0F * 2.0F + 1.0F) / 2.0F); double positiveX = (blockPos.getX() + MathHelper.sin(randomNumberFromZeroToPi) * dividedSize); double negativeX = (blockPos.getX() - MathHelper.sin(randomNumberFromZeroToPi) * dividedSize); double positiveZ = (blockPos.getZ() + MathHelper.cos(randomNumberFromZeroToPi) * dividedSize); double negativeZ = (blockPos.getZ() - MathHelper.cos(randomNumberFromZeroToPi) * dividedSize); double positiveY = (blockPos.getY() + random.nextInt(3) - 2); double negativeY = (blockPos.getY() + random.nextInt(3) - 2); int startX = blockPos.getX() - MathHelper.ceil(dividedSize) - ceilSize; int y = blockPos.getY() - 2 - ceilSize; int startZ = blockPos.getZ() - MathHelper.ceil(dividedSize) - ceilSize; int xSize = 2 * (MathHelper.ceil(dividedSize) + ceilSize); int int_7 = 2 * (2 + ceilSize); for (int x = startX; x <= startX + xSize; ++x) { for (int z = startZ; z <= startZ + xSize; ++z) { if (y <= world.getTopY(Type.OCEAN_FLOOR_WG, x, z)) { return this.generateVeinPart(world, random, oreFeatureConfig, positiveX, negativeX, positiveZ, negativeZ, positiveY, negativeY, startX, y, startZ, xSize, int_7); } } } return false; }
Example 10
Source File: ModelDeer.java From Sakura_mod with MIT License | 5 votes |
@Override public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); this.head.rotateAngleX = 1.0821041362364843F; this.neck.rotateAngleX = (headPitch * 0.017453292F) -1.0927506446736497F; this.neck.rotateAngleY = (netHeadYaw * 0.017453292F); this.legR.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; this.legL.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; this.backlegR.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; this.backlegL.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; }
Example 11
Source File: ModelHippo.java From TFC2 with GNU General Public License v3.0 | 5 votes |
/** * 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. */ @Override public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { float f6 = (180F / (float)Math.PI); float rotationDiv = 2; this.Head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); this.Head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); this.Body.rotateAngleX = 0;//((float)Math.PI / 2F); this.LegLeftFront.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_/ rotationDiv; this.LegLeftRear.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_/ rotationDiv; this.LegRightFront.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_/ rotationDiv; this.LegRightRear.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_/ rotationDiv; }
Example 12
Source File: EntityGuard.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
public void spawnSweepParticles() { double d0 = (double) (-MathHelper.sin(this.rotationYaw * 0.017453292F)); double d1 = (double) MathHelper.cos(this.rotationYaw * 0.017453292F); if (this.world instanceof WorldServer) { ((WorldServer) this.world).spawnParticle(EnumParticleTypes.SWEEP_ATTACK, this.posX + d0, this.posY + (double) this.height * 0.5D, this.posZ + d1, 0, d0, 0.0D, d1, 0.0D, new int[0]); } }
Example 13
Source File: ModelOwl.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
@Override public void setRotationAngles(float limbSwing1, float limbSwing2, float rotationAngle, float headY, float headX, float yOffset, Entity entity) { head.rotateAngleX = headX / (180F / (float) Math.PI); head.rotateAngleY = headY / (180F / (float) Math.PI); if (entity instanceof EntityOwl) { EntityOwl owl = (EntityOwl) entity; body.rotateAngleX = owl.getBodyAngle(); wingL.rotateAngleZ = -owl.getWingAngle(); wingR.rotateAngleZ = owl.getWingAngle(); } else { body.rotateAngleX = 0; wingL.rotateAngleZ = 0; wingR.rotateAngleZ = 0; } if (!entity.isAirBorne) { float limbSpeed = 2.5f; legR.rotateAngleX = MathHelper.cos(limbSwing1 * limbSpeed) * 1.4F * limbSwing2; legL.rotateAngleX = MathHelper.cos(limbSwing1 * limbSpeed + (float) Math.PI) * 1.4F * limbSwing2; } else { legR.rotateAngleX = 0; legL.rotateAngleX = 0; } }
Example 14
Source File: ModelMammoth.java From TFC2 with GNU General Public License v3.0 | 5 votes |
/** * 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. */ @Override public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { float f6 = (180F / (float)Math.PI); float rotationDiv = 2; this.Head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); this.Head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); this.Body.rotateAngleX = 0;//((float)Math.PI / 2F); this.LegLeftFront.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_/ rotationDiv; this.LegLeftRear.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_/ rotationDiv; this.LegRightFront.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_/ rotationDiv; this.LegRightRear.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_/ rotationDiv; }
Example 15
Source File: RenderCyberlimbHand.java From Cyberware with MIT License | 5 votes |
private float getMapAngleFromPitch(float pitch) { float f = 1.0F - pitch / 45.0F + 0.1F; f = MathHelper.clamp_float(f, 0.0F, 1.0F); f = -MathHelper.cos(f * (float)Math.PI) * 0.5F + 0.5F; return f; }
Example 16
Source File: RotationUtils.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
public static Vec3d getClientLookVec() { EntityPlayerSP player = WMinecraft.getPlayer(); float f = MathHelper.cos(-player.rotationYaw * 0.017453292F - (float)Math.PI); float f1 = MathHelper.sin(-player.rotationYaw * 0.017453292F - (float)Math.PI); float f2 = -MathHelper.cos(-player.rotationPitch * 0.017453292F); float f3 = MathHelper.sin(-player.rotationPitch * 0.017453292F); return new Vec3d(f1 * f2, f3, f * f2); }
Example 17
Source File: ItemKotachi.java From Sakura_mod with MIT License | 4 votes |
@Override public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) { int k = EnchantmentHelper.getEnchantmentLevel(Enchantments.SWEEPING, stack); if (k > 0) { //big sweep!!! entityLiving.swingArm(entityLiving.getActiveHand()); float f = (float) entityLiving.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue(); f += EnchantmentHelper.getModifierForCreature(stack, entityLiving.getCreatureAttribute()) / 1.5F; float f3 = EnchantmentHelper.getSweepingDamageRatio(entityLiving) * f; float sweepingRatio = EnchantmentHelper.getSweepingDamageRatio(entityLiving); for (Entity entitylivingbase : worldIn.getEntitiesWithinAABB(Entity.class, entityLiving.getEntityBoundingBox().grow(1.4D + sweepingRatio * 1.2D, 0.3D + sweepingRatio * 0.15D, 1.4D + sweepingRatio * 1.2D))) { if (entitylivingbase != entityLiving && !entityLiving.isOnSameTeam(entitylivingbase)) { if (entitylivingbase instanceof EntityLivingBase) { if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer) entitylivingbase).isActiveItemStackBlocking()) { //disable shield ((EntityPlayer) entitylivingbase).disableShield(false); } ((EntityLivingBase) entitylivingbase).knockBack(entityLiving, 0.4F + 0.1F * EnchantmentHelper.getSweepingDamageRatio(entityLiving), MathHelper.sin(entityLiving.rotationYaw * 0.017453292F), (-MathHelper.cos(entityLiving.rotationYaw * 0.017453292F))); entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) entityLiving), f3); } if (entitylivingbase instanceof MultiPartEntityPart) { entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) entityLiving), f3); } } } worldIn.playSound(null, entityLiving.posX, entityLiving.posY, entityLiving.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, entityLiving.getSoundCategory(), 1.0F, 1.0F); if (worldIn instanceof WorldServer) { double d0 = (-MathHelper.sin(entityLiving.rotationYaw * 0.017453292F)); double d1 = MathHelper.cos(entityLiving.rotationYaw * 0.017453292F); ((WorldServer) worldIn).spawnParticle(EnumParticleTypes.SWEEP_ATTACK, entityLiving.posX + d0, entityLiving.posY + entityLiving.height * 0.5D, entityLiving.posZ + d1, 0, d0, 0.0D, d1, 0.0D); } stack.damageItem(2, entityLiving); ((EntityPlayer) entityLiving).getCooldownTracker().setCooldown(this, 16); } }
Example 18
Source File: ModelSamuraiIllager.java From Sakura_mod with MIT License | 4 votes |
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { this.head.rotateAngleY = netHeadYaw * 0.017453292F; this.head.rotateAngleX = headPitch * 0.017453292F; this.arms.rotationPointY = 3.0F; this.arms.rotationPointZ = -1.0F; this.arms.rotateAngleX = -0.75F; this.leg0.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F; this.leg1.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount * 0.5F; this.leg0.rotateAngleY = 0.0F; this.leg1.rotateAngleY = 0.0F; AbstractIllager.IllagerArmPose abstractillager$illagerarmpose = ((AbstractIllager) entityIn).getArmPose(); if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.ATTACKING) { float f = MathHelper.sin(this.swingProgress * (float) Math.PI); float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI); this.rightArm.rotateAngleZ = -0.3363323129985824F; this.leftArm.rotateAngleZ = 0.3363323129985824F; this.rightArm.rotateAngleY = -0.3363323129985824F; this.leftArm.rotateAngleY = 0.3363323129985824F; if (((EntityLivingBase) entityIn).getPrimaryHand() == EnumHandSide.RIGHT) { this.rightArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F; this.leftArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F; this.rightArm.rotateAngleX += f * 2.2F - f1 * 0.4F; this.leftArm.rotateAngleX += f * 2.2F - f1 * 0.4F; } else { this.rightArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F; this.leftArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F; this.rightArm.rotateAngleX += f * 2.2F - f1 * 0.4F; this.leftArm.rotateAngleX += f * 2.2F - f1 * 0.4F; } this.rightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.leftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.rightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.09F) * 0.05F; this.leftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.09F) * 0.05F; } else if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.SPELLCASTING) { this.rightArm.rotationPointZ = 0.0F; this.rightArm.rotationPointX = -5.0F; this.leftArm.rotationPointZ = 0.0F; this.leftArm.rotationPointX = 5.0F; this.rightArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F; this.leftArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F; this.rightArm.rotateAngleZ = 2.3561945F; this.leftArm.rotateAngleZ = -2.3561945F; this.rightArm.rotateAngleY = 0.0F; this.leftArm.rotateAngleY = 0.0F; } else if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.BOW_AND_ARROW) { this.rightArm.rotateAngleY = -0.1F + this.head.rotateAngleY; this.rightArm.rotateAngleX = -((float) Math.PI / 2F) + this.head.rotateAngleX; this.leftArm.rotateAngleX = -0.9424779F + this.head.rotateAngleX; this.leftArm.rotateAngleY = this.head.rotateAngleY - 0.4F; this.leftArm.rotateAngleZ = ((float) Math.PI / 2F); } }
Example 19
Source File: ItemJetpack.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void onAccelerate(ItemStack stack, IInventory inv, EntityPlayer player) { boolean hasFuel = false; MODES mode = getMode(stack); for(int i = 0; i < inv.getSizeInventory(); i++) { ItemStack fuelTank = inv.getStackInSlot(i); if(FluidUtils.containsFluid(fuelTank, AdvancedRocketryFluids.fluidHydrogen)) { hasFuel = FluidUtils.getFluidHandler(fuelTank).drain(1,true) != null; if(hasFuel) break; } } if(hasFuel) { if(mode == MODES.HOVER) { if(Configuration.jetPackThrust > DimensionManager.getInstance().getDimensionProperties(player.world.provider.getDimension()).getGravitationalMultiplier()) player.capabilities.isFlying = true; } else player.addVelocity(0, (double)Configuration.jetPackThrust*0.1f, 0); if(player.world.isRemote) { double xPos = player.posX; double zPos = player.posZ; float playerRot = (float) ((Math.PI/180f)*(player.rotationYaw - 55)); xPos = player.posX + MathHelper.cos(playerRot)*.4f; zPos = player.posZ + MathHelper.sin(playerRot)*.4f; float ejectSpeed = mode == MODES.HOVER ? 0.1f : 0.3f; //AdvancedRocketry.proxy.spawnParticle("smallRocketFlame", player.worldObj, xPos, player.posY - 0.75, zPos, (player.worldObj.rand.nextFloat() - 0.5f)/18f,-.1 ,(player.worldObj.rand.nextFloat() - 0.5f)/18f); AdvancedRocketry.proxy.spawnParticle("smallRocketFlame", player.world, xPos, player.posY + 0.75, zPos, 0, player.motionY -ejectSpeed ,0); playerRot = (float) ((Math.PI/180f)*(player.rotationYaw - 125)); xPos = player.posX + MathHelper.cos(playerRot)*.4f; zPos = player.posZ + MathHelper.sin(playerRot)*.4f; AdvancedRocketry.proxy.spawnParticle("smallRocketFlame", player.world, xPos, player.posY + 0.75, zPos, 0, player.motionY -ejectSpeed ,0); } if(player.motionY > -1) { player.fallDistance = 0; } } }
Example 20
Source File: ModelTofuMindCore.java From TofuCraftReload with MIT License | 4 votes |
@Override public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { this.head.rotateAngleY = netHeadYaw * 0.017453292F; this.head.rotateAngleX = headPitch * 0.017453292F; this.body.rotateAngleY = 0.0F; float f = 1.0F; this.handR.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbSwingAmount * 0.5F / f; this.handL.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 2.0F * limbSwingAmount * 0.5F / f; this.handR.rotateAngleZ = 0.0F; this.handL.rotateAngleY = 0.0F; this.handL.rotateAngleZ = 0.0F; this.handR.rotateAngleY = 0.0F; this.handR.rotateAngleZ = 0.0F; if (this.swingProgress > 0.0F) { EnumHandSide enumhandside = this.getMainHand(entityIn); ModelRenderer modelrenderer = this.getArmForSide(enumhandside); float f1 = this.swingProgress; this.body.rotateAngleY = MathHelper.sin(MathHelper.sqrt(f1) * ((float) Math.PI * 2F)) * 0.2F; if (enumhandside == EnumHandSide.LEFT) { this.body.rotateAngleY *= -1.0F; } this.handR.rotationPointZ = MathHelper.sin(this.body.rotateAngleY) * 5.0F; this.handR.rotationPointX = -MathHelper.cos(this.body.rotateAngleY) * 5.0F; this.handL.rotationPointZ = -MathHelper.sin(this.body.rotateAngleY) * 5.0F; this.handL.rotationPointX = MathHelper.cos(this.body.rotateAngleY) * 5.0F; this.handR.rotateAngleY += this.body.rotateAngleY; this.handL.rotateAngleY += this.body.rotateAngleY; this.handL.rotateAngleX += this.body.rotateAngleY; f1 = 1.0F - this.swingProgress; f1 = f1 * f1; f1 = f1 * f1; f1 = 1.0F - f1; float f2 = MathHelper.sin(f1 * (float) Math.PI); float f3 = MathHelper.sin(this.swingProgress * (float) Math.PI) * -(this.head.rotateAngleX - 0.7F) * 0.75F; modelrenderer.rotateAngleX = (float) ((double) modelrenderer.rotateAngleX - ((double) f2 * 1.2D + (double) f3)); modelrenderer.rotateAngleY += this.body.rotateAngleY * 2.0F; modelrenderer.rotateAngleZ += MathHelper.sin(this.swingProgress * (float) Math.PI) * -0.4F; } this.body.rotateAngleX = 0.0F; this.handR.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.handL.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F; this.handR.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F; this.handL.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F; }