当前位置: 首页>>代码示例>>Java>>正文


Java Vec3d.rotatePitch方法代码示例

本文整理汇总了Java中net.minecraft.util.math.Vec3d.rotatePitch方法的典型用法代码示例。如果您正苦于以下问题:Java Vec3d.rotatePitch方法的具体用法?Java Vec3d.rotatePitch怎么用?Java Vec3d.rotatePitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.math.Vec3d的用法示例。


在下文中一共展示了Vec3d.rotatePitch方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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())});
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:EntityLivingBase.java

示例2: 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())});
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:EntityLivingBase.java

示例3: 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);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:EntityLivingBase.java

示例4: 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);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:40,代码来源:EntityLivingBase.java

示例5: 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;
}
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:49,代码来源:DustSymbolWaterStrike.java

示例6: 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;
}
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:48,代码来源:DustSymbolEarthStrike.java

示例7: 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;
}
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:49,代码来源:DustSymbolAirStrike.java


注:本文中的net.minecraft.util.math.Vec3d.rotatePitch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。