本文整理匯總了Java中net.minecraft.util.math.Vec3d.rotateYaw方法的典型用法代碼示例。如果您正苦於以下問題:Java Vec3d.rotateYaw方法的具體用法?Java Vec3d.rotateYaw怎麽用?Java Vec3d.rotateYaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.math.Vec3d
的用法示例。
在下文中一共展示了Vec3d.rotateYaw方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: renderBrokenItemStack
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
/**
* Renders broken item particles using the given ItemStack
*/
public void renderBrokenItemStack(ItemStack stack)
{
this.playSound(SoundEvents.ENTITY_ITEM_BREAK, 0.8F, 0.8F + this.world.rand.nextFloat() * 0.4F);
for (int i = 0; i < 5; ++i)
{
Vec3d vec3d = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
vec3d = vec3d.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d = vec3d.rotateYaw(-this.rotationYaw * 0.017453292F);
double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
Vec3d vec3d1 = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
vec3d1 = vec3d1.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d1 = vec3d1.rotateYaw(-this.rotationYaw * 0.017453292F);
vec3d1 = vec3d1.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
this.world.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
}
}
示例2: doClientRenderEffects
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
/**
* Generates particle effects appropriate to the phase (or sometimes sounds).
* Called by dragon's onLivingUpdate. Only used when worldObj.isRemote.
*/
public void doClientRenderEffects()
{
Vec3d vec3d = this.dragon.getHeadLookVec(1.0F).normalize();
vec3d.rotateYaw(-((float)Math.PI / 4F));
double d0 = this.dragon.dragonPartHead.posX;
double d1 = this.dragon.dragonPartHead.posY + (double)(this.dragon.dragonPartHead.height / 2.0F);
double d2 = this.dragon.dragonPartHead.posZ;
for (int i = 0; i < 8; ++i)
{
double d3 = d0 + this.dragon.getRNG().nextGaussian() / 2.0D;
double d4 = d1 + this.dragon.getRNG().nextGaussian() / 2.0D;
double d5 = d2 + this.dragon.getRNG().nextGaussian() / 2.0D;
this.dragon.world.spawnParticle(EnumParticleTypes.DRAGON_BREATH, d3, d4, d5, -vec3d.xCoord * 0.07999999821186066D + this.dragon.motionX, -vec3d.yCoord * 0.30000001192092896D + this.dragon.motionY, -vec3d.zCoord * 0.07999999821186066D + this.dragon.motionZ, new int[0]);
vec3d.rotateYaw(0.19634955F);
}
}
示例3: renderBrokenItemStack
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
/**
* Renders broken item particles using the given ItemStack
*/
public void renderBrokenItemStack(ItemStack stack)
{
this.playSound(SoundEvents.ENTITY_ITEM_BREAK, 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F);
for (int i = 0; i < 5; ++i)
{
Vec3d vec3d = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
vec3d = vec3d.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d = vec3d.rotateYaw(-this.rotationYaw * 0.017453292F);
double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
Vec3d vec3d1 = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
vec3d1 = vec3d1.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d1 = vec3d1.rotateYaw(-this.rotationYaw * 0.017453292F);
vec3d1 = vec3d1.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
}
}
示例4: doClientRenderEffects
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
/**
* Generates particle effects appropriate to the phase (or sometimes sounds).
* Called by dragon's onLivingUpdate. Only used when worldObj.isRemote.
*/
public void doClientRenderEffects()
{
Vec3d vec3d = this.dragon.getHeadLookVec(1.0F).normalize();
vec3d.rotateYaw(-((float)Math.PI / 4F));
double d0 = this.dragon.dragonPartHead.posX;
double d1 = this.dragon.dragonPartHead.posY + (double)(this.dragon.dragonPartHead.height / 2.0F);
double d2 = this.dragon.dragonPartHead.posZ;
for (int i = 0; i < 8; ++i)
{
double d3 = d0 + this.dragon.getRNG().nextGaussian() / 2.0D;
double d4 = d1 + this.dragon.getRNG().nextGaussian() / 2.0D;
double d5 = d2 + this.dragon.getRNG().nextGaussian() / 2.0D;
this.dragon.worldObj.spawnParticle(EnumParticleTypes.DRAGON_BREATH, d3, d4, d5, -vec3d.xCoord * 0.07999999821186066D + this.dragon.motionX, -vec3d.yCoord * 0.30000001192092896D + this.dragon.motionY, -vec3d.zCoord * 0.07999999821186066D + this.dragon.motionZ, new int[0]);
vec3d.rotateYaw(0.19634955F);
}
}
示例5: renderMinigunFirstPerson
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
private void renderMinigunFirstPerson() {
EntityPlayer player = Minecraft.getMinecraft().player;
ItemStack stack = player.getHeldItemMainhand();
if (stack.getItem() == Itemss.MINIGUN) {
Minigun minigun = ((ItemMinigun) Itemss.MINIGUN).getMinigun(stack, player);
if (minigun.isMinigunActivated() && minigun.getMinigunSpeed() == Minigun.MAX_GUN_SPEED) {
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderUtils.glColorHex(0x40000000 | minigun.getAmmoColor());
for (int i = 0; i < 5; i++) {
Vec3d directionVec = player.getLookVec().normalize();
Vec3d vec2 = new Vec3d(directionVec.x, directionVec.y, directionVec.z);
vec2 = vec2.rotateYaw(-(float)Math.PI / 2f);
minigunFire.startX = vec2.x ;
minigunFire.startY = 1.0;
minigunFire.startZ = vec2.z;
minigunFire.endX = directionVec.x * 20 + player.getRNG().nextDouble() - 0.5;
minigunFire.endY = directionVec.y * 20 + player.getEyeHeight() + player.getRNG().nextDouble() - 0.5;
minigunFire.endZ = directionVec.z * 20 + player.getRNG().nextDouble() - 0.5;
minigunFire.render();
}
GlStateManager.color(1, 1, 1, 1);
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
}
}
示例6: updateItemUse
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
/**
* Plays sounds and makes particles for item in use state
*/
protected void updateItemUse(ItemStack stack, int eatingParticleCount)
{
if (!stack.func_190926_b() && this.isHandActive())
{
if (stack.getItemUseAction() == EnumAction.DRINK)
{
this.playSound(SoundEvents.ENTITY_GENERIC_DRINK, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
}
if (stack.getItemUseAction() == EnumAction.EAT)
{
for (int i = 0; i < eatingParticleCount; ++i)
{
Vec3d vec3d = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
vec3d = vec3d.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d = vec3d.rotateYaw(-this.rotationYaw * 0.017453292F);
double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
Vec3d vec3d1 = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
vec3d1 = vec3d1.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d1 = vec3d1.rotateYaw(-this.rotationYaw * 0.017453292F);
vec3d1 = vec3d1.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
if (stack.getHasSubtypes())
{
this.world.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem()), stack.getMetadata()});
}
else
{
this.world.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
}
}
this.playSound(SoundEvents.ENTITY_GENERIC_EAT, 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
}
}
}
示例7: doClientRenderEffects
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
/**
* Generates particle effects appropriate to the phase (or sometimes sounds).
* Called by dragon's onLivingUpdate. Only used when worldObj.isRemote.
*/
public void doClientRenderEffects()
{
++this.flameTicks;
if (this.flameTicks % 2 == 0 && this.flameTicks < 10)
{
Vec3d vec3d = this.dragon.getHeadLookVec(1.0F).normalize();
vec3d.rotateYaw(-((float)Math.PI / 4F));
double d0 = this.dragon.dragonPartHead.posX;
double d1 = this.dragon.dragonPartHead.posY + (double)(this.dragon.dragonPartHead.height / 2.0F);
double d2 = this.dragon.dragonPartHead.posZ;
for (int i = 0; i < 8; ++i)
{
double d3 = d0 + this.dragon.getRNG().nextGaussian() / 2.0D;
double d4 = d1 + this.dragon.getRNG().nextGaussian() / 2.0D;
double d5 = d2 + this.dragon.getRNG().nextGaussian() / 2.0D;
for (int j = 0; j < 6; ++j)
{
this.dragon.world.spawnParticle(EnumParticleTypes.DRAGON_BREATH, d3, d4, d5, -vec3d.xCoord * 0.07999999821186066D * (double)j, -vec3d.yCoord * 0.6000000238418579D, -vec3d.zCoord * 0.07999999821186066D * (double)j, new int[0]);
}
vec3d.rotateYaw(0.19634955F);
}
}
}
示例8: updateItemUse
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
/**
* Plays sounds and makes particles for item in use state
*/
protected void updateItemUse(@Nullable ItemStack stack, int eatingParticleCount)
{
if (stack != null && this.isHandActive())
{
if (stack.getItemUseAction() == EnumAction.DRINK)
{
this.playSound(SoundEvents.ENTITY_GENERIC_DRINK, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
if (stack.getItemUseAction() == EnumAction.EAT)
{
for (int i = 0; i < eatingParticleCount; ++i)
{
Vec3d vec3d = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
vec3d = vec3d.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d = vec3d.rotateYaw(-this.rotationYaw * 0.017453292F);
double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
Vec3d vec3d1 = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
vec3d1 = vec3d1.rotatePitch(-this.rotationPitch * 0.017453292F);
vec3d1 = vec3d1.rotateYaw(-this.rotationYaw * 0.017453292F);
vec3d1 = vec3d1.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
if (stack.getHasSubtypes())
{
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem()), stack.getMetadata()});
}
else
{
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
}
}
this.playSound(SoundEvents.ENTITY_GENERIC_EAT, 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
}
}
}
示例9: doClientRenderEffects
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
/**
* Generates particle effects appropriate to the phase (or sometimes sounds).
* Called by dragon's onLivingUpdate. Only used when worldObj.isRemote.
*/
public void doClientRenderEffects()
{
++this.flameTicks;
if (this.flameTicks % 2 == 0 && this.flameTicks < 10)
{
Vec3d vec3d = this.dragon.getHeadLookVec(1.0F).normalize();
vec3d.rotateYaw(-((float)Math.PI / 4F));
double d0 = this.dragon.dragonPartHead.posX;
double d1 = this.dragon.dragonPartHead.posY + (double)(this.dragon.dragonPartHead.height / 2.0F);
double d2 = this.dragon.dragonPartHead.posZ;
for (int i = 0; i < 8; ++i)
{
double d3 = d0 + this.dragon.getRNG().nextGaussian() / 2.0D;
double d4 = d1 + this.dragon.getRNG().nextGaussian() / 2.0D;
double d5 = d2 + this.dragon.getRNG().nextGaussian() / 2.0D;
for (int j = 0; j < 6; ++j)
{
this.dragon.worldObj.spawnParticle(EnumParticleTypes.DRAGON_BREATH, d3, d4, d5, -vec3d.xCoord * 0.07999999821186066D * (double)j, -vec3d.yCoord * 0.6000000238418579D, -vec3d.zCoord * 0.07999999821186066D * (double)j, new int[0]);
}
vec3d.rotateYaw(0.19634955F);
}
}
}
示例10: WaterStrike
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
public static Object WaterStrike(Object... args)
{
ScriptExecutor executor = (ScriptExecutor)args[0];
Random rand = new Random();
Float damage = new Float((Double)executor.resolveInput((short)2));
Double speed = (Double)executor.resolveInput((short)4);
Vec3d look = executor.player.getLookVec().scale(speed == null ? 1.1D : speed);
if (damage == null)
{
damage = 1.0F;
}
//based on code from entityGuardian
double d0 = look.xCoord - executor.player.posX;
double d1 = look.yCoord - (executor.player.posY + (double)executor.player.getEyeHeight());
double d2 = look.zCoord - executor.player.posZ;
double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 = d0 / d3;
d1 = d1 / d3;
d2 = d2 / d3;
double d4 = rand.nextDouble();
look = look.rotateYaw((float)((rand.nextGaussian()) * 4.0D * Math.PI / 180.0D));
look = look.rotatePitch((float)((rand.nextGaussian()) * 4.0D * Math.PI / 180.0D));
Minecraft.getMinecraft().effectRenderer.addEffect(new WaterStrikeFX(executor.player.worldObj,
executor.player.posX + d0 * d4,
executor.player.posY + d1 * d4 + (double)executor.player.getEyeHeight()*0.5F,
executor.player.posZ + d2 * d4,
look.xCoord,
look.yCoord,
look.zCoord,
damage,
executor.player));
executor.resolveOutput((short)3, true);
return true;
}
示例11: EarthStrike
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
public static Object EarthStrike(Object... args)
{
ScriptExecutor executor = (ScriptExecutor)args[0];
Random rand = new Random();
Float damage = new Float((Double)executor.resolveInput((short)2));
Double speed = (Double)executor.resolveInput((short)4);
Vec3d look = executor.player.getLookVec().scale(speed == null ? 1.1D : speed);
if (damage == null)
{
damage = 1.0F;
}
//based on code from entityGuardian
double d0 = look.xCoord - executor.player.posX;
double d1 = look.yCoord - (executor.player.posY + (double)executor.player.getEyeHeight());
double d2 = look.zCoord - executor.player.posZ;
double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 = d0 / d3;
d1 = d1 / d3;
d2 = d2 / d3;
double d4 = rand.nextDouble();
look = look.rotateYaw((float)((rand.nextGaussian()) * 4.0D * Math.PI / 180.0D));
look = look.rotatePitch((float)((rand.nextGaussian()) * 4.0D * Math.PI / 180.0D));
Minecraft.getMinecraft().effectRenderer.addEffect(new EarthStrikeFX(executor.player.worldObj,
executor.player.posX + d0 * d4,
executor.player.posY + d1 * d4 + (double)executor.player.getEyeHeight()*0.5F,
executor.player.posZ + d2 * d4,
look.xCoord,
look.yCoord,
look.zCoord,
damage,
executor.player));
executor.resolveOutput((short)3, true);
return true;
}
示例12: AirStrike
import net.minecraft.util.math.Vec3d; //導入方法依賴的package包/類
public static Object AirStrike(Object... args)
{
ScriptExecutor executor = (ScriptExecutor)args[0];
Random rand = new Random();
Float damage = new Float((Double)executor.resolveInput((short)2));
Double speed = (Double)executor.resolveInput((short)4);
Vec3d look = executor.player.getLookVec().scale(speed == null ? 1.1D : speed);
if (damage == null)
{
damage = 1.0F;
}
//based on code from entityGuardian
double d0 = look.xCoord - executor.player.posX;
double d1 = look.yCoord - (executor.player.posY + (double)executor.player.getEyeHeight());
double d2 = look.zCoord - executor.player.posZ;
double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 = d0 / d3;
d1 = d1 / d3;
d2 = d2 / d3;
double d4 = rand.nextDouble();
look = look.rotateYaw((float)((rand.nextGaussian()) * 4.0D * Math.PI / 180.0D));
look = look.rotatePitch((float)((rand.nextGaussian()) * 4.0D * Math.PI / 180.0D));
Minecraft.getMinecraft().effectRenderer.addEffect(new AirStrikeFX(executor.player.worldObj,
executor.player.posX + d0 * d4,
executor.player.posY + d1 * d4 + (double)executor.player.getEyeHeight()*0.5F,
executor.player.posZ + d2 * d4,
look.xCoord,
look.yCoord,
look.zCoord,
damage,
executor.player));
executor.resolveOutput((short)3, true);
return true;
}