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


Java World.canLightningStrike方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:BlockFarmland.java

示例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)));
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:BlockFire.java

示例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]);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:11,代码来源:BlockLeaves.java

示例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());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockFire.java


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