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


Java Blocks.IRON_BARS属性代码示例

本文整理汇总了Java中net.minecraft.init.Blocks.IRON_BARS属性的典型用法代码示例。如果您正苦于以下问题:Java Blocks.IRON_BARS属性的具体用法?Java Blocks.IRON_BARS怎么用?Java Blocks.IRON_BARS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.IRON_BARS属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

@Override
public void update() {
    /*
     * Most of the Electrostatic Compressor's logic can be found in TickHandlerPneumaticCraft#handleElectrostaticGeneration().
     */
    if (getWorld().getTotalWorldTime() % 40 == 0) {
        for (ironBarsBeneath = 0; ironBarsBeneath < 128; ironBarsBeneath++) {
            if (getWorld().getBlockState(getPos().offset(EnumFacing.DOWN, ironBarsBeneath + 1)).getBlock() != Blocks.IRON_BARS) {
                break;
            }
        }
    }
    super.update();
    if (!getWorld().isRemote) {
        if (lastRedstoneState != shouldEmitRedstone()) {
            lastRedstoneState = !lastRedstoneState;
            updateNeighbours();
        }
        struckByLightningCooldown--;
    }

}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:TileEntityElectrostaticCompressor.java

示例2: getElectrostaticGrid

/**
 * All Iron bar blocks blocks will be added to the given arraylist of coordinates. This method
 * will be recursively called until the whole grid of iron bars is on the list.
 *
 * @param set
 * @param world
 * @param pos
 */
public static void getElectrostaticGrid(Set<BlockPos> set, World world, BlockPos pos) {
    for (EnumFacing d : EnumFacing.VALUES) {
        BlockPos newPos = pos.offset(d);
        Block block = world.getBlockState(newPos).getBlock();
        if ((block == Blocks.IRON_BARS || block == Blockss.ELECTROSTATIC_COMPRESSOR) && set.add(newPos)) {
            getElectrostaticGrid(set, world, newPos);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:TickHandlerPneumaticCraft.java

示例3: func_190735_dq

protected int func_190735_dq()
{
    int i = 1;

    if (this.rand.nextFloat() < 0.01F)
    {
        int j = 0;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

        for (int k = (int)this.posX - 4; k < (int)this.posX + 4 && j < 14; ++k)
        {
            for (int l = (int)this.posY - 4; l < (int)this.posY + 4 && j < 14; ++l)
            {
                for (int i1 = (int)this.posZ - 4; i1 < (int)this.posZ + 4 && j < 14; ++i1)
                {
                    Block block = this.world.getBlockState(blockpos$mutableblockpos.setPos(k, l, i1)).getBlock();

                    if (block == Blocks.IRON_BARS || block == Blocks.BED)
                    {
                        if (this.rand.nextFloat() < 0.3F)
                        {
                            ++i;
                        }

                        ++j;
                    }
                }
            }
        }
    }

    return i;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:33,代码来源:EntityZombieVillager.java

示例4: getConversionTimeBoost

/**
 * Return the amount of time decremented from conversionTime every tick.
 */
protected int getConversionTimeBoost()
{
    int i = 1;

    if (this.rand.nextFloat() < 0.01F)
    {
        int j = 0;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

        for (int k = (int)this.posX - 4; k < (int)this.posX + 4 && j < 14; ++k)
        {
            for (int l = (int)this.posY - 4; l < (int)this.posY + 4 && j < 14; ++l)
            {
                for (int i1 = (int)this.posZ - 4; i1 < (int)this.posZ + 4 && j < 14; ++i1)
                {
                    Block block = this.worldObj.getBlockState(blockpos$mutableblockpos.setPos(k, l, i1)).getBlock();

                    if (block == Blocks.IRON_BARS || block == Blocks.BED)
                    {
                        if (this.rand.nextFloat() < 0.3F)
                        {
                            ++i;
                        }

                        ++j;
                    }
                }
            }
        }
    }

    return i;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:36,代码来源:EntityZombie.java

示例5: destroyBlocksInAABB

/**
 * Destroys all blocks that aren't associated with 'The End' inside the given bounding box.
 */
private boolean destroyBlocksInAABB(AxisAlignedBB p_70972_1_)
{
    int i = MathHelper.floor(p_70972_1_.minX);
    int j = MathHelper.floor(p_70972_1_.minY);
    int k = MathHelper.floor(p_70972_1_.minZ);
    int l = MathHelper.floor(p_70972_1_.maxX);
    int i1 = MathHelper.floor(p_70972_1_.maxY);
    int j1 = MathHelper.floor(p_70972_1_.maxZ);
    boolean flag = false;
    boolean flag1 = false;

    for (int k1 = i; k1 <= l; ++k1)
    {
        for (int l1 = j; l1 <= i1; ++l1)
        {
            for (int i2 = k; i2 <= j1; ++i2)
            {
                BlockPos blockpos = new BlockPos(k1, l1, i2);
                IBlockState iblockstate = this.world.getBlockState(blockpos);
                Block block = iblockstate.getBlock();

                if (iblockstate.getMaterial() != Material.AIR && iblockstate.getMaterial() != Material.FIRE)
                {
                    if (!this.world.getGameRules().getBoolean("mobGriefing"))
                    {
                        flag = true;
                    }
                    else if (block != Blocks.BARRIER && block != Blocks.OBSIDIAN && block != Blocks.END_STONE && block != Blocks.BEDROCK && block != Blocks.END_PORTAL && block != Blocks.END_PORTAL_FRAME)
                    {
                        if (block != Blocks.COMMAND_BLOCK && block != Blocks.REPEATING_COMMAND_BLOCK && block != Blocks.CHAIN_COMMAND_BLOCK && block != Blocks.IRON_BARS && block != Blocks.END_GATEWAY)
                        {
                            flag1 = this.world.setBlockToAir(blockpos) || flag1;
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                    else
                    {
                        flag = true;
                    }
                }
            }
        }
    }

    if (flag1)
    {
        double d0 = p_70972_1_.minX + (p_70972_1_.maxX - p_70972_1_.minX) * (double)this.rand.nextFloat();
        double d1 = p_70972_1_.minY + (p_70972_1_.maxY - p_70972_1_.minY) * (double)this.rand.nextFloat();
        double d2 = p_70972_1_.minZ + (p_70972_1_.maxZ - p_70972_1_.minZ) * (double)this.rand.nextFloat();
        this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }

    return flag;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:60,代码来源:EntityDragon.java

示例6: destroyBlocksInAABB

/**
 * Destroys all blocks that aren't associated with 'The End' inside the given bounding box.
 */
private boolean destroyBlocksInAABB(AxisAlignedBB p_70972_1_)
{
    int i = MathHelper.floor_double(p_70972_1_.minX);
    int j = MathHelper.floor_double(p_70972_1_.minY);
    int k = MathHelper.floor_double(p_70972_1_.minZ);
    int l = MathHelper.floor_double(p_70972_1_.maxX);
    int i1 = MathHelper.floor_double(p_70972_1_.maxY);
    int j1 = MathHelper.floor_double(p_70972_1_.maxZ);
    boolean flag = false;
    boolean flag1 = false;

    for (int k1 = i; k1 <= l; ++k1)
    {
        for (int l1 = j; l1 <= i1; ++l1)
        {
            for (int i2 = k; i2 <= j1; ++i2)
            {
                BlockPos blockpos = new BlockPos(k1, l1, i2);
                IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
                Block block = iblockstate.getBlock();

                if (!block.isAir(iblockstate, this.worldObj, blockpos) && iblockstate.getMaterial() != Material.FIRE)
                {
                    if (!this.worldObj.getGameRules().getBoolean("mobGriefing"))
                    {
                        flag = true;
                    }
                    else if (block.canEntityDestroy(iblockstate, this.worldObj, blockpos, this))
                    {
                        if (block != Blocks.COMMAND_BLOCK && block != Blocks.REPEATING_COMMAND_BLOCK && block != Blocks.CHAIN_COMMAND_BLOCK && block != Blocks.IRON_BARS && block != Blocks.END_GATEWAY)
                        {
                            flag1 = this.worldObj.setBlockToAir(blockpos) || flag1;
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                    else
                    {
                        flag = true;
                    }
                }
            }
        }
    }

    if (flag1)
    {
        double d0 = p_70972_1_.minX + (p_70972_1_.maxX - p_70972_1_.minX) * (double)this.rand.nextFloat();
        double d1 = p_70972_1_.minY + (p_70972_1_.maxY - p_70972_1_.minY) * (double)this.rand.nextFloat();
        double d2 = p_70972_1_.minZ + (p_70972_1_.maxZ - p_70972_1_.minZ) * (double)this.rand.nextFloat();
        this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }

    return flag;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:60,代码来源:EntityDragon.java


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