本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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]);
}
}
}
示例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]);
}
}
}
示例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]);
}
}
}