當前位置: 首頁>>代碼示例>>Java>>正文


Java EnumFacing.random方法代碼示例

本文整理匯總了Java中net.minecraft.util.EnumFacing.random方法的典型用法代碼示例。如果您正苦於以下問題:Java EnumFacing.random方法的具體用法?Java EnumFacing.random怎麽用?Java EnumFacing.random使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.EnumFacing的用法示例。


在下文中一共展示了EnumFacing.random方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldExecute

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public boolean shouldExecute()
{
    if (this.field_179485_a.getAttackTarget() != null)
    {
        return false;
    }
    else if (!this.field_179485_a.getNavigator().noPath())
    {
        return false;
    }
    else
    {
        Random random = this.field_179485_a.getRNG();

        if (random.nextInt(10) == 0)
        {
            this.facing = EnumFacing.random(random);
            BlockPos blockpos = (new BlockPos(this.field_179485_a.posX, this.field_179485_a.posY + 0.5D, this.field_179485_a.posZ)).offset(this.facing);
            IBlockState iblockstate = this.field_179485_a.worldObj.getBlockState(blockpos);

            if (BlockSilverfish.canContainSilverfish(iblockstate))
            {
                this.field_179484_c = true;
                return true;
            }
        }

        this.field_179484_c = false;
        return super.shouldExecute();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:32,代碼來源:EntitySilverfish.java

示例2: shouldExecute

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public boolean shouldExecute()
{
    if (this.entity.getAttackTarget() != null)
    {
        return false;
    }
    else if (!this.entity.getNavigator().noPath())
    {
        return false;
    }
    else
    {
        Random random = this.entity.getRNG();

        if (this.entity.world.getGameRules().getBoolean("mobGriefing") && random.nextInt(10) == 0)
        {
            this.facing = EnumFacing.random(random);
            BlockPos blockpos = (new BlockPos(this.entity.posX, this.entity.posY + 0.5D, this.entity.posZ)).offset(this.facing);
            IBlockState iblockstate = this.entity.world.getBlockState(blockpos);

            if (BlockSilverfish.canContainSilverfish(iblockstate))
            {
                this.doMerge = true;
                return true;
            }
        }

        this.doMerge = false;
        return super.shouldExecute();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:32,代碼來源:EntitySilverfish.java

示例3: shouldExecute

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (!this.silverfish.worldObj.getGameRules().getBoolean("mobGriefing"))
    {
        return false;
    }
    else if (this.silverfish.getAttackTarget() != null)
    {
        return false;
    }
    else if (!this.silverfish.getNavigator().noPath())
    {
        return false;
    }
    else
    {
        Random random = this.silverfish.getRNG();

        if (random.nextInt(10) == 0)
        {
            this.facing = EnumFacing.random(random);
            BlockPos blockpos = (new BlockPos(this.silverfish.posX, this.silverfish.posY + 0.5D, this.silverfish.posZ)).offset(this.facing);
            IBlockState iblockstate = this.silverfish.worldObj.getBlockState(blockpos);

            if (BlockSilverfish.canContainSilverfish(iblockstate))
            {
                this.doMerge = true;
                return true;
            }
        }

        this.doMerge = false;
        return super.shouldExecute();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:39,代碼來源:EntitySilverfish.java

示例4: randomDisplayTick

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (((Boolean)state.getValue(WET)).booleanValue())
    {
        EnumFacing enumfacing = EnumFacing.random(rand);

        if (enumfacing != EnumFacing.UP && !World.doesBlockHaveSolidTopSurface(worldIn, pos.offset(enumfacing)))
        {
            double d0 = (double)pos.getX();
            double d1 = (double)pos.getY();
            double d2 = (double)pos.getZ();

            if (enumfacing == EnumFacing.DOWN)
            {
                d1 = d1 - 0.05D;
                d0 += rand.nextDouble();
                d2 += rand.nextDouble();
            }
            else
            {
                d1 = d1 + rand.nextDouble() * 0.8D;

                if (enumfacing.getAxis() == EnumFacing.Axis.X)
                {
                    d2 += rand.nextDouble();

                    if (enumfacing == EnumFacing.EAST)
                    {
                        ++d0;
                    }
                    else
                    {
                        d0 += 0.05D;
                    }
                }
                else
                {
                    d0 += rand.nextDouble();

                    if (enumfacing == EnumFacing.SOUTH)
                    {
                        ++d2;
                    }
                    else
                    {
                        d2 += 0.05D;
                    }
                }
            }

            worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:55,代碼來源:BlockSponge.java

示例5: randomDisplayTick

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (((Boolean)stateIn.getValue(WET)).booleanValue())
    {
        EnumFacing enumfacing = EnumFacing.random(rand);

        if (enumfacing != EnumFacing.UP && !worldIn.getBlockState(pos.offset(enumfacing)).isFullyOpaque())
        {
            double d0 = (double)pos.getX();
            double d1 = (double)pos.getY();
            double d2 = (double)pos.getZ();

            if (enumfacing == EnumFacing.DOWN)
            {
                d1 = d1 - 0.05D;
                d0 += rand.nextDouble();
                d2 += rand.nextDouble();
            }
            else
            {
                d1 = d1 + rand.nextDouble() * 0.8D;

                if (enumfacing.getAxis() == EnumFacing.Axis.X)
                {
                    d2 += rand.nextDouble();

                    if (enumfacing == EnumFacing.EAST)
                    {
                        ++d0;
                    }
                    else
                    {
                        d0 += 0.05D;
                    }
                }
                else
                {
                    d0 += rand.nextDouble();

                    if (enumfacing == EnumFacing.SOUTH)
                    {
                        ++d2;
                    }
                    else
                    {
                        d2 += 0.05D;
                    }
                }
            }

            worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:55,代碼來源:BlockSponge.java

示例6: randomDisplayTick

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (((Boolean)stateIn.getValue(WET)).booleanValue())
    {
        EnumFacing enumfacing = EnumFacing.random(rand);

        if (enumfacing != EnumFacing.UP && !worldIn.getBlockState(pos.offset(enumfacing)).isFullyOpaque())
        {
            double d0 = (double)pos.getX();
            double d1 = (double)pos.getY();
            double d2 = (double)pos.getZ();

            if (enumfacing == EnumFacing.DOWN)
            {
                d1 = d1 - 0.05D;
                d0 += rand.nextDouble();
                d2 += rand.nextDouble();
            }
            else
            {
                d1 = d1 + rand.nextDouble() * 0.8D;

                if (enumfacing.getAxis() == EnumFacing.Axis.X)
                {
                    d2 += rand.nextDouble();

                    if (enumfacing == EnumFacing.EAST)
                    {
                        ++d0;
                    }
                    else
                    {
                        d0 += 0.05D;
                    }
                }
                else
                {
                    d0 += rand.nextDouble();

                    if (enumfacing == EnumFacing.SOUTH)
                    {
                        ++d2;
                    }
                    else
                    {
                        d2 += 0.05D;
                    }
                }
            }

            worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:56,代碼來源:BlockSponge.java


注:本文中的net.minecraft.util.EnumFacing.random方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。