本文整理汇总了Java中net.minecraft.world.World.canLightningStrike方法的典型用法代码示例。如果您正苦于以下问题:Java World.canLightningStrike方法的具体用法?Java World.canLightningStrike怎么用?Java World.canLightningStrike使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.canLightningStrike方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
int i = ((Integer)state.getValue(MOISTURE)).intValue();
if (!this.hasWater(worldIn, pos) && !worldIn.canLightningStrike(pos.up()))
{
if (i > 0)
{
worldIn.setBlockState(pos, state.withProperty(MOISTURE, Integer.valueOf(i - 1)), 2);
}
else if (!this.hasCrops(worldIn, pos))
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
}
}
else if (i < 7)
{
worldIn.setBlockState(pos, state.withProperty(MOISTURE, Integer.valueOf(7)), 2);
}
}
示例2: catchOnFire
import net.minecraft.world.World; //导入方法依赖的package包/类
private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age)
{
int i = this.getFlammability(worldIn.getBlockState(pos).getBlock());
if (random.nextInt(chance) < i)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (random.nextInt(age + 10) < 5 && !worldIn.canLightningStrike(pos))
{
int j = age + random.nextInt(5) / 4;
if (j > 15)
{
j = 15;
}
worldIn.setBlockState(pos, this.getDefaultState().withProperty(AGE, Integer.valueOf(j)), 3);
}
else
{
worldIn.setBlockToAir(pos);
}
if (iblockstate.getBlock() == Blocks.tnt)
{
Blocks.tnt.onBlockDestroyedByPlayer(worldIn, pos, iblockstate.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true)));
}
}
}
示例3: randomDisplayTick
import net.minecraft.world.World; //导入方法依赖的package包/类
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (worldIn.canLightningStrike(pos.up()) && !World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && rand.nextInt(15) == 1)
{
double d0 = (double)((float)pos.getX() + rand.nextFloat());
double d1 = (double)pos.getY() - 0.05D;
double d2 = (double)((float)pos.getZ() + rand.nextFloat());
worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
示例4: canDie
import net.minecraft.world.World; //导入方法依赖的package包/类
protected boolean canDie(World worldIn, BlockPos pos)
{
return worldIn.canLightningStrike(pos) || worldIn.canLightningStrike(pos.west()) || worldIn.canLightningStrike(pos.east()) || worldIn.canLightningStrike(pos.north()) || worldIn.canLightningStrike(pos.south());
}