當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。