本文整理匯總了Java中net.minecraft.util.MathHelper.sin方法的典型用法代碼示例。如果您正苦於以下問題:Java MathHelper.sin方法的具體用法?Java MathHelper.sin怎麽用?Java MathHelper.sin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.MathHelper
的用法示例。
在下文中一共展示了MathHelper.sin方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: attackEntityFromPart
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public boolean attackEntityFromPart(EntityDragonPart dragonPart, DamageSource source, float p_70965_3_)
{
if (dragonPart != this.dragonPartHead)
{
p_70965_3_ = p_70965_3_ / 4.0F + 1.0F;
}
float f = this.rotationYaw * (float)Math.PI / 180.0F;
float f1 = MathHelper.sin(f);
float f2 = MathHelper.cos(f);
this.targetX = this.posX + (double)(f1 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F);
this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D;
this.targetZ = this.posZ - (double)(f2 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F);
this.target = null;
if (source.getEntity() instanceof EntityPlayer || source.isExplosion())
{
this.attackDragonFrom(source, p_70965_3_);
}
return true;
}
示例2: renderLitParticles
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public void renderLitParticles(Entity entityIn, float p_78872_2_)
{
float f = 0.017453292F;
float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F);
float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F);
float f3 = -f2 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
float f4 = f1 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
float f5 = MathHelper.cos(entityIn.rotationPitch * 0.017453292F);
for (int i = 0; i < 2; ++i)
{
List list = this.fxLayers[3][i];
if (!list.isEmpty())
{
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
for (int j = 0; j < list.size(); ++j)
{
EntityFX entityfx = (EntityFX)list.get(j);
entityfx.renderParticle(worldrenderer, entityIn, p_78872_2_, f1, f5, f2, f3, f4);
}
}
}
}
示例3: setRotationAngles
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
/**
* 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 p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn);
this.villagerNose.offsetX = this.villagerNose.offsetY = this.villagerNose.offsetZ = 0.0F;
float f = 0.01F * (float)(entityIn.getEntityId() % 10);
this.villagerNose.rotateAngleX = MathHelper.sin((float)entityIn.ticksExisted * f) * 4.5F * (float)Math.PI / 180.0F;
this.villagerNose.rotateAngleY = 0.0F;
this.villagerNose.rotateAngleZ = MathHelper.cos((float)entityIn.ticksExisted * f) * 2.5F * (float)Math.PI / 180.0F;
if (this.field_82900_g)
{
this.villagerNose.rotateAngleX = -0.9F;
this.villagerNose.offsetZ = -0.09375F;
this.villagerNose.offsetY = 0.1875F;
}
}
示例4: renderParticle
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_)
{
float f = 0.25F;
float f1 = 0.5F;
float f2 = 0.125F;
float f3 = 0.375F;
float f4 = 7.1F * MathHelper.sin(((float)this.particleAge + partialTicks - 1.0F) * 0.25F * (float)Math.PI);
this.particleAlpha = 0.6F - ((float)this.particleAge + partialTicks - 1.0F) * 0.25F * 0.5F;
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex(0.5D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex(0.5D, 0.125D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex(0.25D, 0.125D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex(0.25D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();
}
示例5: getSkyBrightness
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public float getSkyBrightness(float par1)
{
final float var2 = FMLClientHandler.instance().getClient().theWorld.getCelestialAngle(par1);
float var3 = 1.0F - (MathHelper.sin(var2 * (float) Math.PI * 2.0F) * 2.0F + 0.25F);
if (var3 < 0.0F)
{
var3 = 0.0F;
}
if (var3 > 1.0F)
{
var3 = 1.0F;
}
return var3 * var3 * 1F;
}
示例6: getViewVector
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
protected Vector3f getViewVector(Entity entityIn, double partialTicks)
{
float f = (float)((double)entityIn.prevRotationPitch + (double)(entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks);
float f1 = (float)((double)entityIn.prevRotationYaw + (double)(entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks);
if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 2)
{
f += 180.0F;
}
float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
float f4 = -MathHelper.cos(-f * 0.017453292F);
float f5 = MathHelper.sin(-f * 0.017453292F);
return new Vector3f(f3 * f4, f5, f2 * f4);
}
示例7: updateRiderPosition
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public void updateRiderPosition()
{
super.updateRiderPosition();
float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F);
float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F);
float f2 = 0.1F;
float f3 = 0.0F;
this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + (double)(this.height * 0.5F) + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1));
if (this.riddenByEntity instanceof EntityLivingBase)
{
((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset;
}
}
示例8: getShakeAngle
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public float getShakeAngle(float p_70923_1_, float p_70923_2_)
{
float f = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F;
if (f < 0.0F)
{
f = 0.0F;
}
else if (f > 1.0F)
{
f = 1.0F;
}
return MathHelper.sin(f * (float)Math.PI) * MathHelper.sin(f * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI;
}
示例9: func_177077_a
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
private int func_177077_a(EntityItem itemIn, double p_177077_2_, double p_177077_4_, double p_177077_6_, float p_177077_8_, IBakedModel p_177077_9_)
{
ItemStack itemstack = itemIn.getEntityItem();
Item item = itemstack.getItem();
if (item == null)
{
return 0;
}
else
{
boolean flag = p_177077_9_.isGui3d();
int i = this.func_177078_a(itemstack);
float f = 0.25F;
float f1 = MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y;
GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);
if (flag || this.renderManager.options != null)
{
float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI);
GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F);
}
if (!flag)
{
float f6 = -0.0F * (float)(i - 1) * 0.5F;
float f4 = -0.0F * (float)(i - 1) * 0.5F;
float f5 = -0.046875F * (float)(i - 1) * 0.5F;
GlStateManager.translate(f6, f4, f5);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
return i;
}
}
示例10: func_82213_w
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
private double func_82213_w(int p_82213_1_)
{
if (p_82213_1_ <= 0)
{
return this.posZ;
}
else
{
float f = (this.renderYawOffset + (float)(180 * (p_82213_1_ - 1))) / 180.0F * (float)Math.PI;
float f1 = MathHelper.sin(f);
return this.posZ + (double)f1 * 1.3D;
}
}
示例11: jump
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
@Override
public void jump() {
super.jump();
if (this.isSprinting()) {
try {
Sprint sprint = Serenity.getInstance().getModuleManager().getModule(Sprint.class);
if (sprint.isEnabled() && sprint.omnidirectional.getValue()) {
float f = (float) Math.toRadians(this.rotationYaw);
this.motionX += (double) (MathHelper.sin(f) * 0.2F);
this.motionZ -= (double) (MathHelper.cos(f) * 0.2F);
float yaw = this.rotationYaw;
if (this.moveForward < 0) {
yaw += 180;
}
if (this.moveStrafing > 0) {
yaw -= 90 * (this.moveForward > 0 ? 0.5F : this.moveForward < 0 ? -0.5F : 1);
}
if (this.moveStrafing < 0) {
yaw += 90 * (this.moveForward > 0 ? 0.5F : this.moveForward < 0 ? -0.5F : 1);
}
f = (float) Math.toRadians(yaw);
this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
}
} catch (Exception e) {}
}
}
示例12: setRotationAngles
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
/**
* 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 p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
float f = (MathHelper.sin(p_78087_1_ * 0.02F) * 0.1F + 1.25F) * p_78087_4_;
this.coverRight.rotateAngleY = (float)Math.PI + f;
this.coverLeft.rotateAngleY = -f;
this.pagesRight.rotateAngleY = f;
this.pagesLeft.rotateAngleY = -f;
this.flippingPageRight.rotateAngleY = f - f * 2.0F * p_78087_2_;
this.flippingPageLeft.rotateAngleY = f - f * 2.0F * p_78087_3_;
this.pagesRight.rotationPointX = MathHelper.sin(f);
this.pagesLeft.rotationPointX = MathHelper.sin(f);
this.flippingPageRight.rotationPointX = MathHelper.sin(f);
this.flippingPageLeft.rotationPointX = MathHelper.sin(f);
}
示例13: setRotationAngles
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
/**
* 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 p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn)
{
float f = p_78087_3_ * (float)Math.PI * -0.1F;
for (int i = 0; i < 4; ++i)
{
this.blazeSticks[i].rotationPointY = -2.0F + MathHelper.cos(((float)(i * 2) + p_78087_3_) * 0.25F);
this.blazeSticks[i].rotationPointX = MathHelper.cos(f) * 9.0F;
this.blazeSticks[i].rotationPointZ = MathHelper.sin(f) * 9.0F;
++f;
}
f = ((float)Math.PI / 4F) + p_78087_3_ * (float)Math.PI * 0.03F;
for (int j = 4; j < 8; ++j)
{
this.blazeSticks[j].rotationPointY = 2.0F + MathHelper.cos(((float)(j * 2) + p_78087_3_) * 0.25F);
this.blazeSticks[j].rotationPointX = MathHelper.cos(f) * 7.0F;
this.blazeSticks[j].rotationPointZ = MathHelper.sin(f) * 7.0F;
++f;
}
f = 0.47123894F + p_78087_3_ * (float)Math.PI * -0.05F;
for (int k = 8; k < 12; ++k)
{
this.blazeSticks[k].rotationPointY = 11.0F + MathHelper.cos(((float)k * 1.5F + p_78087_3_) * 0.5F);
this.blazeSticks[k].rotationPointX = MathHelper.cos(f) * 5.0F;
this.blazeSticks[k].rotationPointZ = MathHelper.sin(f) * 5.0F;
++f;
}
this.blazeHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
this.blazeHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
}
示例14: generate
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
float f = rand.nextFloat() * (float)Math.PI;
double d0 = (double)((float)(position.getX() + 8) + MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F);
double d1 = (double)((float)(position.getX() + 8) - MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F);
double d2 = (double)((float)(position.getZ() + 8) + MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F);
double d3 = (double)((float)(position.getZ() + 8) - MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F);
double d4 = (double)(position.getY() + rand.nextInt(3) - 2);
double d5 = (double)(position.getY() + rand.nextInt(3) - 2);
for (int i = 0; i < this.numberOfBlocks; ++i)
{
float f1 = (float)i / (float)this.numberOfBlocks;
double d6 = d0 + (d1 - d0) * (double)f1;
double d7 = d4 + (d5 - d4) * (double)f1;
double d8 = d2 + (d3 - d2) * (double)f1;
double d9 = rand.nextDouble() * (double)this.numberOfBlocks / 16.0D;
double d10 = (double)(MathHelper.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D;
double d11 = (double)(MathHelper.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D;
int j = MathHelper.floor_double(d6 - d10 / 2.0D);
int k = MathHelper.floor_double(d7 - d11 / 2.0D);
int l = MathHelper.floor_double(d8 - d10 / 2.0D);
int i1 = MathHelper.floor_double(d6 + d10 / 2.0D);
int j1 = MathHelper.floor_double(d7 + d11 / 2.0D);
int k1 = MathHelper.floor_double(d8 + d10 / 2.0D);
for (int l1 = j; l1 <= i1; ++l1)
{
double d12 = ((double)l1 + 0.5D - d6) / (d10 / 2.0D);
if (d12 * d12 < 1.0D)
{
for (int i2 = k; i2 <= j1; ++i2)
{
double d13 = ((double)i2 + 0.5D - d7) / (d11 / 2.0D);
if (d12 * d12 + d13 * d13 < 1.0D)
{
for (int j2 = l; j2 <= k1; ++j2)
{
double d14 = ((double)j2 + 0.5D - d8) / (d10 / 2.0D);
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D)
{
BlockPos blockpos = new BlockPos(l1, i2, j2);
if (this.predicate.apply(worldIn.getBlockState(blockpos)))
{
worldIn.setBlockState(blockpos, this.oreBlock, 2);
}
}
}
}
}
}
}
}
return true;
}
示例15: getNightVisionBrightness
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
private float getNightVisionBrightness(EntityLivingBase entitylivingbaseIn, float partialTicks)
{
int i = entitylivingbaseIn.getActivePotionEffect(Potion.nightVision).getDuration();
return i > 200 ? 1.0F : 0.7F + MathHelper.sin(((float)i - partialTicks) * (float)Math.PI * 0.2F) * 0.3F;
}