Java 类net.minecraft.block.BlockTorch 实例源码

项目:DecompiledMinecraft    文件:StructureVillagePieces.java   
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
    if (this.field_143015_k < 0)
    {
        this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);

        if (this.field_143015_k < 0)
        {
            return true;
        }

        this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
    }

    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 0, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
    boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH;
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn);
    return true;
}
项目:DecompiledMinecraft    文件:StructureVillagePieces.java   
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
    if (this.field_143015_k < 0)
    {
        this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);

        if (this.field_143015_k < 0)
        {
            return true;
        }

        this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
    }

    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 0, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
    boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH;
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn);
    return true;
}
项目:BaseClient    文件:StructureVillagePieces.java   
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
    if (this.field_143015_k < 0)
    {
        this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);

        if (this.field_143015_k < 0)
        {
            return true;
        }

        this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
    }

    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 0, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
    boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH;
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn);
    return true;
}
项目:BaseClient    文件:StructureVillagePieces.java   
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
    if (this.field_143015_k < 0)
    {
        this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);

        if (this.field_143015_k < 0)
        {
            return true;
        }

        this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
    }

    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 0, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
    boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH;
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn);
    return true;
}
项目:Backmemed    文件:StructureMineshaftPieces.java   
private void func_189921_a(World p_189921_1_, StructureBoundingBox p_189921_2_, int p_189921_3_, int p_189921_4_, int p_189921_5_, int p_189921_6_, int p_189921_7_, Random p_189921_8_)
{
    if (this.func_189918_a(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_7_, p_189921_6_, p_189921_5_))
    {
        IBlockState iblockstate = this.func_189917_F_();
        IBlockState iblockstate1 = this.func_189919_b();
        IBlockState iblockstate2 = Blocks.AIR.getDefaultState();
        this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_4_, p_189921_5_, p_189921_3_, p_189921_6_ - 1, p_189921_5_, iblockstate1, iblockstate2, false);
        this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_7_, p_189921_4_, p_189921_5_, p_189921_7_, p_189921_6_ - 1, p_189921_5_, iblockstate1, iblockstate2, false);

        if (p_189921_8_.nextInt(4) == 0)
        {
            this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_6_, p_189921_5_, p_189921_3_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
            this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_7_, p_189921_6_, p_189921_5_, p_189921_7_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
        }
        else
        {
            this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_6_, p_189921_5_, p_189921_7_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
            this.randomlyPlaceBlock(p_189921_1_, p_189921_2_, p_189921_8_, 0.05F, p_189921_3_ + 1, p_189921_6_, p_189921_5_ - 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
            this.randomlyPlaceBlock(p_189921_1_, p_189921_2_, p_189921_8_, 0.05F, p_189921_3_ + 1, p_189921_6_, p_189921_5_ + 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
        }
    }
}
项目:CustomWorldGen    文件:StructureMineshaftPieces.java   
private void func_189921_a(World p_189921_1_, StructureBoundingBox p_189921_2_, int p_189921_3_, int p_189921_4_, int p_189921_5_, int p_189921_6_, int p_189921_7_, Random p_189921_8_)
{
    if (this.func_189918_a(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_7_, p_189921_6_, p_189921_5_))
    {
        IBlockState iblockstate = this.func_189917_F_();
        IBlockState iblockstate1 = this.func_189919_b();
        IBlockState iblockstate2 = Blocks.AIR.getDefaultState();
        this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_4_, p_189921_5_, p_189921_3_, p_189921_6_ - 1, p_189921_5_, iblockstate1, iblockstate2, false);
        this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_7_, p_189921_4_, p_189921_5_, p_189921_7_, p_189921_6_ - 1, p_189921_5_, iblockstate1, iblockstate2, false);

        if (p_189921_8_.nextInt(4) == 0)
        {
            this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_6_, p_189921_5_, p_189921_3_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
            this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_7_, p_189921_6_, p_189921_5_, p_189921_7_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
        }
        else
        {
            this.fillWithBlocks(p_189921_1_, p_189921_2_, p_189921_3_, p_189921_6_, p_189921_5_, p_189921_7_, p_189921_6_, p_189921_5_, iblockstate, iblockstate2, false);
            this.randomlyPlaceBlock(p_189921_1_, p_189921_2_, p_189921_8_, 0.05F, p_189921_3_ + 1, p_189921_6_, p_189921_5_ - 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
            this.randomlyPlaceBlock(p_189921_1_, p_189921_2_, p_189921_8_, 0.05F, p_189921_3_ + 1, p_189921_6_, p_189921_5_ + 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
        }
    }
}
项目:Backmemed    文件:StructureStrongholdPieces.java   
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
    if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn))
    {
        return false;
    }
    else
    {
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 4, 6, true, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.entryDoor, 1, 1, 0);
        this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 6);
        IBlockState iblockstate = Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST);
        IBlockState iblockstate1 = Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST);
        this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 1, iblockstate);
        this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 1, iblockstate1);
        this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 5, iblockstate);
        this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 5, iblockstate1);

        if (this.expandsX)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 2, 0, 3, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        if (this.expandsZ)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 2, 4, 3, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        return true;
    }
}
项目:Backmemed    文件:StructureVillagePieces.java   
protected void func_189926_a(World p_189926_1_, EnumFacing p_189926_2_, int p_189926_3_, int p_189926_4_, int p_189926_5_, StructureBoundingBox p_189926_6_)
{
    if (!this.isZombieInfested)
    {
        this.setBlockState(p_189926_1_, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, p_189926_2_), p_189926_3_, p_189926_4_, p_189926_5_, p_189926_6_);
    }
}
项目:CustomWorldGen    文件:StructureStrongholdPieces.java   
/**
 * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
 * Mineshafts at the end, it adds Fences...
 */
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
    if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn))
    {
        return false;
    }
    else
    {
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 4, 6, true, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.entryDoor, 1, 1, 0);
        this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 6);
        IBlockState iblockstate = Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST);
        IBlockState iblockstate1 = Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST);
        this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 1, iblockstate);
        this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 1, iblockstate1);
        this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 5, iblockstate);
        this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 5, iblockstate1);

        if (this.expandsX)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 2, 0, 3, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        if (this.expandsZ)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 2, 4, 3, 4, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        return true;
    }
}
项目:CustomWorldGen    文件:StructureVillagePieces.java   
protected void func_189926_a(World p_189926_1_, EnumFacing p_189926_2_, int p_189926_3_, int p_189926_4_, int p_189926_5_, StructureBoundingBox p_189926_6_)
{
    if (!this.isZombieInfested)
    {
        this.setBlockState(p_189926_1_, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, p_189926_2_), p_189926_3_, p_189926_4_, p_189926_5_, p_189926_6_);
    }
}
项目:Structures    文件:StructureComponentNBT.java   
private boolean isDefered(StructureBlock sb) {
  Block block = GameRegistry.findBlock(sb.getModId(), sb.getBlockName());
  if(block == null) {
    return false;
  }

  return block instanceof BlockTorch || block instanceof BlockSand || block instanceof BlockGravel || block instanceof BlockAnvil 
      || block instanceof BlockTripWireHook || block instanceof  BlockTripWire|| block instanceof BlockRedstoneWire;
}
项目:Cyclic    文件:EntityTorchBolt.java   
@Override
protected void processImpact(RayTraceResult mop) {
  if (mop.entityHit != null) {
    //zero damage means just knockback
    mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
  }
  EnumFacing sideHit = mop.sideHit;
  BlockPos pos = mop.getBlockPos();
  BlockPos offset = mop.getBlockPos();
  if (sideHit != null) {
    offset = pos.offset(sideHit);
  }
  if (offset == null) {
    return;
  }
  World world = this.getEntityWorld();
  boolean isSideSolid = world.isSideSolid(mop.getBlockPos(), sideHit);
  boolean isValidBlockstate = BlockTorch.FACING.getAllowedValues().contains(sideHit);
  boolean isValidLocation = world.isAirBlock(offset) ||
      world.getBlockState(offset) == null ||
      world.getBlockState(offset).getBlock() == null ||
      world.getBlockState(offset).getBlock().isReplaceable(world, offset);
  if (isValidLocation && isValidBlockstate && isSideSolid && world.isRemote == false) {
    world.setBlockState(offset, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, sideHit));
  }
  //    else {
  //      UtilItemStack.dropItemStackInWorld(world, this.getPosition(), renderSnowball);
  //    }
  this.setDead();
}
项目:mod_quiver    文件:EntityTorchArrow.java   
@Override
   protected void handleInTileState(Block block, EnumFacing facing) {
       BlockPos blockpos = new BlockPos(this.xTile, this.yTile, this.zTile);
    BlockPos facingBlockPos = facingBlock(blockpos, facing);
    if (facing != EnumFacing.DOWN && Blocks.TORCH.canPlaceBlockAt(world, facingBlockPos)) {
        world.setBlockState(facingBlockPos, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, swapZFacing(facing)));
    } else {
        Block.spawnAsEntity(world, facingBlockPos, new ItemStack(ModFFQuiver.torchArrow));
    }
    this.setDead();
}
项目:Blocksteps    文件:TorchHandler.java   
@Override
public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List<BlockPos> availableBlocks)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(BlockTorch.FACING);

    return availableBlocks.contains(pos.offset(enumfacing.getOpposite()));
}
项目:GardenCollection    文件:BlockThinLog.java   
private int calcConnectYFlags (IBlockAccess world, int x, int y, int z) {
    Block block = world.getBlock(x, y, z);
    if (block != this)
        return 0;

    Block blockYNeg = world.getBlock(x, y - 1, z);
    boolean hardYNeg = isNeighborHardConnectionY(world, x, y - 1, z, blockYNeg, ForgeDirection.DOWN);
    boolean connectYNeg = hardYNeg || blockYNeg == this;

    Block blockYPos = world.getBlock(x, y + 1, z);
    boolean hardYPos = isNeighborHardConnectionY(world, x, y + 1, z, blockYPos, ForgeDirection.UP);
    boolean connectYPos = hardYPos || blockYPos == this|| blockYPos instanceof BlockTorch;

    return (connectYNeg ? 1 : 0) | (connectYPos ? 2 : 0) | (hardYNeg ? 4 : 0) | (hardYPos ? 8 : 0);
}
项目:ZeldaSwordSkills    文件:EntityWhip.java   
/**
 * Returns true if the whip can destroy the material type
 */
protected boolean canBreakBlock(Block block, Material m, BlockPos pos, EnumFacing side) {
    EntityLivingBase thrower = getThrower();
    if (block instanceof IWhipBlock) {
        return ((IWhipBlock) block).canBreakBlock(getType(), thrower, worldObj, pos, side);
    }
    boolean isBreakable = block.getBlockHardness(worldObj, pos) >= 0.0F;
    boolean canPlayerEdit = false;
    if (thrower instanceof EntityPlayer) {
        canPlayerEdit = ((EntityPlayer) thrower).capabilities.allowEdit && Config.canHookshotBreakBlocks();
    }
    // can dislodge blocks such as torches, leaves, flowers, etc.
    return (isBreakable && canPlayerEdit && (block instanceof BlockTorch || m == Material.leaves || m == Material.plants));
}
项目:ForgeMods    文件:BlockThinLog.java   
private int calcConnectYFlags (IBlockAccess world, int x, int y, int z) {
    Block block = world.getBlock(x, y, z);
    if (block != this)
        return 0;

    Block blockYNeg = world.getBlock(x, y - 1, z);
    boolean hardYNeg = isNeighborHardConnectionY(blockYNeg);
    boolean connectYNeg = hardYNeg || blockYNeg == this;

    Block blockYPos = world.getBlock(x, y + 1, z);
    boolean hardYPos = isNeighborHardConnectionY(blockYPos);
    boolean connectYPos = hardYPos || blockYPos == this|| blockYPos instanceof BlockTorch;

    return (connectYNeg ? 1 : 0) | (connectYPos ? 2 : 0) | (hardYNeg ? 4 : 0) | (hardYPos ? 8 : 0);
}
项目:DecompiledMinecraft    文件:EntityDragon.java   
/**
 * Generate the portal when the dragon dies
 */
private void generatePortal(BlockPos pos)
{
    int i = 4;
    double d0 = 12.25D;
    double d1 = 6.25D;

    for (int j = -1; j <= 32; ++j)
    {
        for (int k = -4; k <= 4; ++k)
        {
            for (int l = -4; l <= 4; ++l)
            {
                double d2 = (double)(k * k + l * l);

                if (d2 <= 12.25D)
                {
                    BlockPos blockpos = pos.add(k, j, l);

                    if (j < 0)
                    {
                        if (d2 <= 6.25D)
                        {
                            this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
                        }
                    }
                    else if (j > 0)
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState());
                    }
                    else if (d2 > 6.25D)
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
                    }
                    else
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.end_portal.getDefaultState());
                    }
                }
            }
        }
    }

    this.worldObj.setBlockState(pos, Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(pos.up(), Blocks.bedrock.getDefaultState());
    BlockPos blockpos1 = pos.up(2);
    this.worldObj.setBlockState(blockpos1, Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(blockpos1.west(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST));
    this.worldObj.setBlockState(blockpos1.east(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST));
    this.worldObj.setBlockState(blockpos1.north(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
    this.worldObj.setBlockState(blockpos1.south(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
    this.worldObj.setBlockState(pos.up(3), Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(pos.up(4), Blocks.dragon_egg.getDefaultState());
}
项目:DecompiledMinecraft    文件:EntityDragon.java   
/**
 * Generate the portal when the dragon dies
 */
private void generatePortal(BlockPos pos)
{
    int i = 4;
    double d0 = 12.25D;
    double d1 = 6.25D;

    for (int j = -1; j <= 32; ++j)
    {
        for (int k = -4; k <= 4; ++k)
        {
            for (int l = -4; l <= 4; ++l)
            {
                double d2 = (double)(k * k + l * l);

                if (d2 <= 12.25D)
                {
                    BlockPos blockpos = pos.add(k, j, l);

                    if (j < 0)
                    {
                        if (d2 <= 6.25D)
                        {
                            this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
                        }
                    }
                    else if (j > 0)
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState());
                    }
                    else if (d2 > 6.25D)
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
                    }
                    else
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.end_portal.getDefaultState());
                    }
                }
            }
        }
    }

    this.worldObj.setBlockState(pos, Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(pos.up(), Blocks.bedrock.getDefaultState());
    BlockPos blockpos1 = pos.up(2);
    this.worldObj.setBlockState(blockpos1, Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(blockpos1.west(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST));
    this.worldObj.setBlockState(blockpos1.east(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST));
    this.worldObj.setBlockState(blockpos1.north(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
    this.worldObj.setBlockState(blockpos1.south(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
    this.worldObj.setBlockState(pos.up(3), Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(pos.up(4), Blocks.dragon_egg.getDefaultState());
}
项目:BaseClient    文件:BetterSnow.java   
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_)
{
    if (p_checkBlock_0_.isFullCube())
    {
        return false;
    }
    else if (p_checkBlock_0_.isOpaqueCube())
    {
        return false;
    }
    else if (p_checkBlock_0_ instanceof BlockSnow)
    {
        return false;
    }
    else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass))
    {
        if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall))
        {
            if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP)
            {
                return true;
            }
            else
            {
                if (p_checkBlock_0_ instanceof BlockLever)
                {
                    Object object = p_checkBlock_1_.getValue(BlockLever.FACING);

                    if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z)
                    {
                        return true;
                    }
                }

                return false;
            }
        }
        else
        {
            return true;
        }
    }
    else
    {
        return true;
    }
}
项目:BaseClient    文件:EntityDragon.java   
/**
 * Generate the portal when the dragon dies
 */
private void generatePortal(BlockPos pos)
{
    int i = 4;
    double d0 = 12.25D;
    double d1 = 6.25D;

    for (int j = -1; j <= 32; ++j)
    {
        for (int k = -4; k <= 4; ++k)
        {
            for (int l = -4; l <= 4; ++l)
            {
                double d2 = (double)(k * k + l * l);

                if (d2 <= 12.25D)
                {
                    BlockPos blockpos = pos.add(k, j, l);

                    if (j < 0)
                    {
                        if (d2 <= 6.25D)
                        {
                            this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
                        }
                    }
                    else if (j > 0)
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState());
                    }
                    else if (d2 > 6.25D)
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
                    }
                    else
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.end_portal.getDefaultState());
                    }
                }
            }
        }
    }

    this.worldObj.setBlockState(pos, Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(pos.up(), Blocks.bedrock.getDefaultState());
    BlockPos blockpos1 = pos.up(2);
    this.worldObj.setBlockState(blockpos1, Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(blockpos1.west(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST));
    this.worldObj.setBlockState(blockpos1.east(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST));
    this.worldObj.setBlockState(blockpos1.north(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
    this.worldObj.setBlockState(blockpos1.south(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
    this.worldObj.setBlockState(pos.up(3), Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(pos.up(4), Blocks.dragon_egg.getDefaultState());
}
项目:BaseClient    文件:BetterSnow.java   
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_)
{
    if (p_checkBlock_0_.isFullCube())
    {
        return false;
    }
    else if (p_checkBlock_0_.isOpaqueCube())
    {
        return false;
    }
    else if (p_checkBlock_0_ instanceof BlockSnow)
    {
        return false;
    }
    else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass))
    {
        if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall))
        {
            if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP)
            {
                return true;
            }
            else
            {
                if (p_checkBlock_0_ instanceof BlockLever)
                {
                    Object object = p_checkBlock_1_.getValue(BlockLever.FACING);

                    if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z)
                    {
                        return true;
                    }
                }

                return false;
            }
        }
        else
        {
            return true;
        }
    }
    else
    {
        return true;
    }
}
项目:BaseClient    文件:EntityDragon.java   
/**
 * Generate the portal when the dragon dies
 */
private void generatePortal(BlockPos pos)
{
    int i = 4;
    double d0 = 12.25D;
    double d1 = 6.25D;

    for (int j = -1; j <= 32; ++j)
    {
        for (int k = -4; k <= 4; ++k)
        {
            for (int l = -4; l <= 4; ++l)
            {
                double d2 = (double)(k * k + l * l);

                if (d2 <= 12.25D)
                {
                    BlockPos blockpos = pos.add(k, j, l);

                    if (j < 0)
                    {
                        if (d2 <= 6.25D)
                        {
                            this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
                        }
                    }
                    else if (j > 0)
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState());
                    }
                    else if (d2 > 6.25D)
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState());
                    }
                    else
                    {
                        this.worldObj.setBlockState(blockpos, Blocks.end_portal.getDefaultState());
                    }
                }
            }
        }
    }

    this.worldObj.setBlockState(pos, Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(pos.up(), Blocks.bedrock.getDefaultState());
    BlockPos blockpos1 = pos.up(2);
    this.worldObj.setBlockState(blockpos1, Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(blockpos1.west(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST));
    this.worldObj.setBlockState(blockpos1.east(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST));
    this.worldObj.setBlockState(blockpos1.north(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
    this.worldObj.setBlockState(blockpos1.south(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
    this.worldObj.setBlockState(pos.up(3), Blocks.bedrock.getDefaultState());
    this.worldObj.setBlockState(pos.up(4), Blocks.dragon_egg.getDefaultState());
}
项目:Backmemed    文件:StructureStrongholdPieces.java   
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
    if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn))
    {
        return false;
    }
    else
    {
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 9, 8, 10, true, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.entryDoor, 4, 3, 0);

        if (this.leftLow)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 1, 0, 5, 3, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        if (this.rightLow)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 3, 1, 9, 5, 3, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        if (this.leftHigh)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 7, 0, 7, 9, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        if (this.rightHigh)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 5, 7, 9, 7, 9, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 10, 7, 3, 10, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 2, 1, 8, 2, 6, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 5, 4, 4, 9, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 8, 1, 5, 8, 4, 9, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 4, 7, 3, 4, 9, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 3, 5, 3, 3, 6, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 3, 3, 4, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 6, 3, 4, 6, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 5, 1, 7, 7, 1, 8, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 9, 7, 1, 9, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 7, 7, 2, 7, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 7, 4, 5, 9, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 7, 8, 5, 9, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 7, 7, 5, 9, Blocks.DOUBLE_STONE_SLAB.getDefaultState(), Blocks.DOUBLE_STONE_SLAB.getDefaultState(), false);
        this.setBlockState(worldIn, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 6, 5, 6, structureBoundingBoxIn);
        return true;
    }
}
项目:Backmemed    文件:WorldGenEndPodium.java   
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(new BlockPos(position.getX() - 4, position.getY() - 1, position.getZ() - 4), new BlockPos(position.getX() + 4, position.getY() + 32, position.getZ() + 4)))
    {
        double d0 = blockpos$mutableblockpos.getDistance(position.getX(), blockpos$mutableblockpos.getY(), position.getZ());

        if (d0 <= 3.5D)
        {
            if (blockpos$mutableblockpos.getY() < position.getY())
            {
                if (d0 <= 2.5D)
                {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
                }
                else if (blockpos$mutableblockpos.getY() < position.getY())
                {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.END_STONE.getDefaultState());
                }
            }
            else if (blockpos$mutableblockpos.getY() > position.getY())
            {
                this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.AIR.getDefaultState());
            }
            else if (d0 > 2.5D)
            {
                this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
            }
            else if (this.activePortal)
            {
                this.setBlockAndNotifyAdequately(worldIn, new BlockPos(blockpos$mutableblockpos), Blocks.END_PORTAL.getDefaultState());
            }
            else
            {
                this.setBlockAndNotifyAdequately(worldIn, new BlockPos(blockpos$mutableblockpos), Blocks.AIR.getDefaultState());
            }
        }
    }

    for (int i = 0; i < 4; ++i)
    {
        this.setBlockAndNotifyAdequately(worldIn, position.up(i), Blocks.BEDROCK.getDefaultState());
    }

    BlockPos blockpos = position.up(2);

    for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
    {
        this.setBlockAndNotifyAdequately(worldIn, blockpos.offset(enumfacing), Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, enumfacing));
    }

    return true;
}
项目:Backmemed    文件:BetterSnow.java   
private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_)
{
    if (p_checkBlock_1_.isFullCube())
    {
        return false;
    }
    else if (p_checkBlock_1_.isOpaqueCube())
    {
        return false;
    }
    else if (p_checkBlock_0_ instanceof BlockSnow)
    {
        return false;
    }
    else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass))
    {
        if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall))
        {
            if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP)
            {
                return true;
            }
            else
            {
                if (p_checkBlock_0_ instanceof BlockLever)
                {
                    Object object = p_checkBlock_1_.getValue(BlockLever.FACING);

                    if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z)
                    {
                        return true;
                    }
                }

                return false;
            }
        }
        else
        {
            return true;
        }
    }
    else
    {
        return true;
    }
}
项目:CustomWorldGen    文件:StructureStrongholdPieces.java   
/**
 * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
 * Mineshafts at the end, it adds Fences...
 */
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
{
    if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn))
    {
        return false;
    }
    else
    {
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 9, 8, 10, true, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.entryDoor, 4, 3, 0);

        if (this.leftLow)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 1, 0, 5, 3, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        if (this.rightLow)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 3, 1, 9, 5, 3, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        if (this.leftHigh)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 7, 0, 7, 9, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        if (this.rightHigh)
        {
            this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 5, 7, 9, 7, 9, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        }

        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 10, 7, 3, 10, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 2, 1, 8, 2, 6, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 5, 4, 4, 9, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 8, 1, 5, 8, 4, 9, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 4, 7, 3, 4, 9, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 3, 5, 3, 3, 6, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 3, 3, 4, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 6, 3, 4, 6, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 5, 1, 7, 7, 1, 8, false, randomIn, StructureStrongholdPieces.STRONGHOLD_STONES);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 9, 7, 1, 9, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 7, 7, 2, 7, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 7, 4, 5, 9, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 7, 8, 5, 9, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false);
        this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 7, 7, 5, 9, Blocks.DOUBLE_STONE_SLAB.getDefaultState(), Blocks.DOUBLE_STONE_SLAB.getDefaultState(), false);
        this.setBlockState(worldIn, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 6, 5, 6, structureBoundingBoxIn);
        return true;
    }
}
项目:CustomWorldGen    文件:WorldGenEndPodium.java   
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(new BlockPos(position.getX() - 4, position.getY() - 1, position.getZ() - 4), new BlockPos(position.getX() + 4, position.getY() + 32, position.getZ() + 4)))
    {
        double d0 = blockpos$mutableblockpos.getDistance(position.getX(), blockpos$mutableblockpos.getY(), position.getZ());

        if (d0 <= 3.5D)
        {
            if (blockpos$mutableblockpos.getY() < position.getY())
            {
                if (d0 <= 2.5D)
                {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
                }
                else if (blockpos$mutableblockpos.getY() < position.getY())
                {
                    this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.END_STONE.getDefaultState());
                }
            }
            else if (blockpos$mutableblockpos.getY() > position.getY())
            {
                this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.AIR.getDefaultState());
            }
            else if (d0 > 2.5D)
            {
                this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
            }
            else if (this.activePortal)
            {
                this.setBlockAndNotifyAdequately(worldIn, new BlockPos(blockpos$mutableblockpos), Blocks.END_PORTAL.getDefaultState());
            }
            else
            {
                this.setBlockAndNotifyAdequately(worldIn, new BlockPos(blockpos$mutableblockpos), Blocks.AIR.getDefaultState());
            }
        }
    }

    for (int i = 0; i < 4; ++i)
    {
        this.setBlockAndNotifyAdequately(worldIn, position.up(i), Blocks.BEDROCK.getDefaultState());
    }

    BlockPos blockpos = position.up(2);

    for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
    {
        this.setBlockAndNotifyAdequately(worldIn, blockpos.offset(enumfacing), Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, enumfacing));
    }

    return true;
}
项目:MC-Prefab    文件:StructureAlternateStart.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos,
        EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    HouseConfiguration houseConfig = (HouseConfiguration) configuration;

    if ((!houseConfig.addBed && foundBlock instanceof BlockBed) || (!houseConfig.addChest && foundBlock instanceof BlockChest)
            || (!houseConfig.addTorches && foundBlock instanceof BlockTorch)
            || (!houseConfig.addCraftingTable && (foundBlock instanceof BlockWorkbench || foundBlock instanceof BlockFurnace)))
    {
        // Don't place the block, returning true means that this has been
        // "handled"
        return true;
    }

    if (foundBlock instanceof BlockFurnace)
    {
        this.furnacePosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockTrapDoor && houseConfig.addMineShaft)
    {
        // The trap door will still be added, but the mine shaft may not be
        // built.
        this.trapDoorPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockChest && this.chestPosition == null)
    {
        this.chestPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockStandingSign)
    {
        this.signPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }

    if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS.getRegistryName().getResourcePath()))
    {
        blockState = blockState.withProperty(BlockStainedGlass.COLOR, houseConfig.glassColor);
        block.setBlockState(blockState);
        this.priorityOneBlocks.add(block);

        return true;
    }
    else if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourcePath()))
    {
        block.setBlockState(foundBlock.getStateFromMeta(houseConfig.glassColor.getMetadata()));
        this.priorityOneBlocks.add(block);
        return true;
    }

    return false;
}
项目:Structures    文件:RotationHelper.java   
private static BlockType getBlockType(Block block) {

    if(block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame
        || block instanceof BlockCocoa) {
      return BlockType.BED;
    }
    if(block instanceof BlockRail) {
      return BlockType.RAIL;
    }
    if(block instanceof BlockRailPowered || block instanceof BlockRailDetector) {
      return BlockType.RAIL_POWERED;
    }
    if(block instanceof BlockStairs) {
      return BlockType.STAIR;
    }
    if(block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder
        || block == Blocks.wall_sign) {
      return BlockType.CHEST;
    }
    if(block == Blocks.standing_sign) {
      return BlockType.SIGNPOST;
    }
    if(block instanceof BlockDoor) {
      return BlockType.DOOR;
    }
    if(block instanceof BlockButton) {
      return BlockType.BUTTON;
    }
    if(block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) {
      return BlockType.REDSTONE_REPEATER;
    }
    if(block instanceof BlockTrapDoor) {
      return BlockType.TRAPDOOR;
    }
    if(block instanceof BlockHugeMushroom) {
      return BlockType.MUSHROOM_CAP;
    }
    if(block instanceof BlockVine) {
      return BlockType.VINE;
    }
    if(block instanceof BlockSkull) {
      return BlockType.SKULL;
    }
    if(block instanceof BlockAnvil) {
      return BlockType.ANVIL;
    }
    if(block instanceof BlockLog) {
      return BlockType.LOG;
    }
    if(block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) {
      return BlockType.DISPENSER;
    }
    if(block instanceof BlockTorch) {
      return BlockType.TORCH;
    }
    if(block instanceof BlockLever) {
      return BlockType.LEVER;
    }
    if(block instanceof BlockTripWireHook) {
      return BlockType.TRIP_WIRE_HOOK;
    }

    return null;
  }
项目:Rediscovered-Mod-1.8    文件:EntityGoodDragon.java   
/**
 * Creates the ender portal leading back to the normal world after defeating the enderdragon.
 */
private void func_175499_a(BlockPos p_175499_1_)
{
    boolean flag = true;
    double d0 = 12.25D;
    double d1 = 6.25D;

    for (int i = -1; i <= 32; ++i)
    {
        for (int j = -4; j <= 4; ++j)
        {
            for (int k = -4; k <= 4; ++k)
            {
                double d2 = (double)(j * j + k * k);

                if (d2 <= 12.25D)
                {
                    BlockPos blockpos1 = p_175499_1_.add(j, i, k);

                    if (i < 0)
                    {
                        if (d2 <= 6.25D)
                        {
                            this.worldObj.setBlockState(blockpos1, mod_Rediscovered.CryingObsidian.getDefaultState());
                        }
                    }
                    else if (i > 0)
                    {
                        this.worldObj.setBlockState(blockpos1, Blocks.air.getDefaultState());
                    }
                    else if (d2 > 6.25D)
                    {
                        this.worldObj.setBlockState(blockpos1, mod_Rediscovered.CryingObsidian.getDefaultState());
                    }
                    else
                    {
                        this.worldObj.setBlockState(blockpos1, Blocks.fire.getDefaultState());
                    }
                }
            }
        }
    }

    this.worldObj.setBlockState(p_175499_1_, mod_Rediscovered.CryingObsidian.getDefaultState());
    this.worldObj.setBlockState(p_175499_1_.up(), mod_Rediscovered.CryingObsidian.getDefaultState());
    BlockPos blockpos2 = p_175499_1_.up(2);
    this.worldObj.setBlockState(blockpos2, mod_Rediscovered.CryingObsidian.getDefaultState());
    this.worldObj.setBlockState(blockpos2.west(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST));
    this.worldObj.setBlockState(blockpos2.east(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST));
    this.worldObj.setBlockState(blockpos2.north(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
    this.worldObj.setBlockState(blockpos2.south(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
    this.worldObj.setBlockState(p_175499_1_.up(3), mod_Rediscovered.CryingObsidian.getDefaultState());
    this.worldObj.setBlockState(p_175499_1_.up(4), mod_Rediscovered.DragonEggRed.getDefaultState());
}
项目:Rediscovered-Mod-1.8.8    文件:EntityGoodDragon.java   
/**
 * Creates the ender portal leading back to the normal world after defeating the enderdragon.
 */
private void func_175499_a(BlockPos p_175499_1_)
{
    boolean flag = true;
    double d0 = 12.25D;
    double d1 = 6.25D;

    for (int i = -1; i <= 32; ++i)
    {
        for (int j = -4; j <= 4; ++j)
        {
            for (int k = -4; k <= 4; ++k)
            {
                double d2 = (double)(j * j + k * k);

                if (d2 <= 12.25D)
                {
                    BlockPos blockpos1 = p_175499_1_.add(j, i, k);

                    if (i < 0)
                    {
                        if (d2 <= 6.25D)
                        {
                            this.worldObj.setBlockState(blockpos1, mod_Rediscovered.CryingObsidian.getDefaultState());
                        }
                    }
                    else if (i > 0)
                    {
                        this.worldObj.setBlockState(blockpos1, Blocks.air.getDefaultState());
                    }
                    else if (d2 > 6.25D)
                    {
                        this.worldObj.setBlockState(blockpos1, mod_Rediscovered.CryingObsidian.getDefaultState());
                    }
                    else
                    {
                        this.worldObj.setBlockState(blockpos1, Blocks.fire.getDefaultState());
                    }
                }
            }
        }
    }

    this.worldObj.setBlockState(p_175499_1_, mod_Rediscovered.CryingObsidian.getDefaultState());
    this.worldObj.setBlockState(p_175499_1_.up(), mod_Rediscovered.CryingObsidian.getDefaultState());
    BlockPos blockpos2 = p_175499_1_.up(2);
    this.worldObj.setBlockState(blockpos2, mod_Rediscovered.CryingObsidian.getDefaultState());
    this.worldObj.setBlockState(blockpos2.west(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST));
    this.worldObj.setBlockState(blockpos2.east(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST));
    this.worldObj.setBlockState(blockpos2.north(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
    this.worldObj.setBlockState(blockpos2.south(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));
    this.worldObj.setBlockState(p_175499_1_.up(3), mod_Rediscovered.CryingObsidian.getDefaultState());
    this.worldObj.setBlockState(p_175499_1_.up(4), mod_Rediscovered.DragonEggRed.getDefaultState());
}
项目:AbyssalCraft    文件:StructureDreadlandsMinePieces.java   
/**
 * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes
 * Mineshafts at the end, it adds Fences...
 */
@Override
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
    if (isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
        return false;
    else
    {
        int i = sectionCount * 5 - 1;
        fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 1, i, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
        generateMaybeBox(par1World, par3StructureBoundingBox, par2Random, 0.8F, 0, 2, 0, 2, 2, i, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false, 0);

        int j;
        int k;

        for (j = 0; j < sectionCount; ++j)
        {
            k = 2 + j * 5;
            fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, k, 0, 1, k, ACBlocks.dreadlands_wood_fence.getDefaultState(), Blocks.AIR.getDefaultState(), false);
            fillWithBlocks(par1World, par3StructureBoundingBox, 2, 0, k, 2, 1, k, ACBlocks.dreadlands_wood_fence.getDefaultState(), Blocks.AIR.getDefaultState(), false);

            if (par2Random.nextInt(4) == 0)
            {
                fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, k, 0, 2, k, ACBlocks.dreadlands_planks.getDefaultState(), Blocks.AIR.getDefaultState(), false);
                fillWithBlocks(par1World, par3StructureBoundingBox, 2, 2, k, 2, 2, k, ACBlocks.dreadlands_planks.getDefaultState(), Blocks.AIR.getDefaultState(), false);
            } else
                fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, k, 2, 2, k, ACBlocks.dreadlands_planks.getDefaultState(), Blocks.AIR.getDefaultState(), false);

            randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k - 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH));
            randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k + 1, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH));

            if (par2Random.nextInt(100) == 0)
                generateChest(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, ACLoot.CHEST_DREADLANDS_MINESHAFT);

            if (par2Random.nextInt(100) == 0)
                generateChest(par1World, par3StructureBoundingBox, par2Random, 2, 0, k + 1, ACLoot.CHEST_DREADLANDS_MINESHAFT);
        }

        for (j = 0; j <= 2; ++j)
            for (k = 0; k <= i; ++k)
            {
                byte b0 = -1;
                IBlockState block1 = getBlockStateFromPos(par1World, j, b0, k, par3StructureBoundingBox);

                if (block1.getMaterial() == Material.AIR)
                {
                    byte b1 = -1;
                    setBlockState(par1World, ACBlocks.dreadlands_planks.getDefaultState(), j, b1, k, par3StructureBoundingBox);
                }
            }

        if (hasRails){

            IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH);

            for (j = 0; j <= i; ++j)
            {
                IBlockState block = getBlockStateFromPos(par1World, 1, -1, j, par3StructureBoundingBox);

                if (block.getMaterial() != Material.AIR && block.isFullBlock())
                    randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.7F, 1, 0, j, iblockstate);
            }
        }

        return true;
    }
}
项目:GardenCollection    文件:BlockThinLog.java   
public int calcConnectionFlags (IBlockAccess world, int x, int y, int z) {
    int flagsY = calcConnectYFlags(world, x, y, z);
    int flagsZNeg = calcConnectYFlags(world, x, y, z - 1);
    int flagsZPos = calcConnectYFlags(world, x, y, z + 1);
    int flagsXNeg = calcConnectYFlags(world, x - 1, y, z);
    int flagsXPos = calcConnectYFlags(world, x + 1, y, z);

    int connectFlagsY = flagsY & 3;
    int connectFlagsZNeg = flagsZNeg & 3;
    int connectFlagsZPos = flagsZPos & 3;
    int connectFlagsXNeg = flagsXNeg & 3;
    int connectFlagsXPos = flagsXPos & 3;

    Block blockZNeg = world.getBlock(x, y, z - 1);
    Block blockZPos = world.getBlock(x, y, z + 1);
    Block blockXNeg = world.getBlock(x - 1, y, z);
    Block blockXPos = world.getBlock(x + 1, y, z);

    boolean hardZNeg = isNeighborHardConnection(world, x, y, z - 1, blockZNeg, ForgeDirection.NORTH) || blockZNeg instanceof BlockTorch;
    boolean hardZPos = isNeighborHardConnection(world, x, y, z + 1, blockZPos, ForgeDirection.SOUTH) || blockZPos instanceof BlockTorch;
    boolean hardXNeg = isNeighborHardConnection(world, x - 1, y, z, blockXNeg, ForgeDirection.WEST) || blockXNeg instanceof BlockTorch;
    boolean hardXPos = isNeighborHardConnection(world, x + 1, y, z, blockXPos, ForgeDirection.EAST) || blockXPos instanceof BlockTorch;

    boolean hardConnection = (flagsY & 4) != 0;
    boolean hardConnectionZNeg = hardConnection && (flagsZNeg & 4) != 0;
    boolean hardConnectionZPos = hardConnection && (flagsZPos & 4) != 0;
    boolean hardConnectionXNeg = hardConnection && (flagsXNeg & 4) != 0;
    boolean hardConnectionXPos = hardConnection && (flagsXPos & 4) != 0;

    boolean connectZNeg = (connectFlagsY == 0 && hardZNeg)
        || (blockZNeg == this && !hardConnectionZNeg && (connectFlagsY != 3 || connectFlagsZNeg != 3));
    boolean connectZPos = (connectFlagsY == 0 && hardZPos)
        || (blockZPos == this && !hardConnectionZPos && (connectFlagsY != 3 || connectFlagsZPos != 3));
    boolean connectXNeg = (connectFlagsY == 0 && hardXNeg)
        || (blockXNeg == this && !hardConnectionXNeg && (connectFlagsY != 3 || connectFlagsXNeg != 3));
    boolean connectXPos = (connectFlagsY == 0 && hardXPos)
        || (blockXPos == this && !hardConnectionXPos && (connectFlagsY != 3 || connectFlagsXPos != 3));

    boolean connectSide = connectZNeg | connectZPos | connectXNeg | connectXPos;
    if (!connectSide && (connectFlagsY & 1) == 0) {
        if (hardZNeg)
            connectZNeg = true;
        if (hardZPos)
            connectZPos = true;
        if (hardXNeg)
            connectXNeg = true;
        if (hardXPos)
            connectXPos = true;
    }

    if (!(connectZNeg | connectZPos | connectXNeg | connectXPos))
        connectFlagsY = 3;

    if (connectFlagsY == 2 && hardZNeg)
        connectZNeg = true;
    if (connectFlagsY == 2 && hardZPos)
        connectZPos = true;
    if (connectFlagsY == 2 && hardXNeg)
        connectXNeg = true;
    if (connectFlagsY == 2 && hardXPos)
        connectXPos = true;

    return connectFlagsY | (connectZNeg ? 4 : 0) | (connectZPos ? 8 : 0) |
        (connectXNeg ? 16 : 0) | (connectXPos ? 32 : 0);
}
项目:ForgeMods    文件:BlockThinLog.java   
public int calcConnectionFlags (IBlockAccess world, int x, int y, int z) {
    int flagsY = calcConnectYFlags(world, x, y, z);
    int flagsZNeg = calcConnectYFlags(world, x, y, z - 1);
    int flagsZPos = calcConnectYFlags(world, x, y, z + 1);
    int flagsXNeg = calcConnectYFlags(world, x - 1, y, z);
    int flagsXPos = calcConnectYFlags(world, x + 1, y, z);

    int connectFlagsY = flagsY & 3;
    int connectFlagsZNeg = flagsZNeg & 3;
    int connectFlagsZPos = flagsZPos & 3;
    int connectFlagsXNeg = flagsXNeg & 3;
    int connectFlagsXPos = flagsXPos & 3;

    Block blockZNeg = world.getBlock(x, y, z - 1);
    Block blockZPos = world.getBlock(x, y, z + 1);
    Block blockXNeg = world.getBlock(x - 1, y, z);
    Block blockXPos = world.getBlock(x + 1, y, z);

    boolean hardZNeg = isNeighborHardConnection(blockZNeg) || blockZNeg instanceof BlockTorch;
    boolean hardZPos = isNeighborHardConnection(blockZPos) || blockZPos instanceof BlockTorch;
    boolean hardXNeg = isNeighborHardConnection(blockXNeg) || blockXNeg instanceof BlockTorch;
    boolean hardXPos = isNeighborHardConnection(blockXPos) || blockXPos instanceof BlockTorch;

    boolean hardConnection = (flagsY & 4) != 0;
    boolean hardConnectionZNeg = hardConnection && (flagsZNeg & 4) != 0;
    boolean hardConnectionZPos = hardConnection && (flagsZPos & 4) != 0;
    boolean hardConnectionXNeg = hardConnection && (flagsXNeg & 4) != 0;
    boolean hardConnectionXPos = hardConnection && (flagsXPos & 4) != 0;

    boolean connectZNeg = (connectFlagsY == 0 && hardZNeg)
        || (blockZNeg == this && !hardConnectionZNeg && (connectFlagsY != 3 || connectFlagsZNeg != 3));
    boolean connectZPos = (connectFlagsY == 0 && hardZPos)
        || (blockZPos == this && !hardConnectionZPos && (connectFlagsY != 3 || connectFlagsZPos != 3));
    boolean connectXNeg = (connectFlagsY == 0 && hardXNeg)
        || (blockXNeg == this && !hardConnectionXNeg && (connectFlagsY != 3 || connectFlagsXNeg != 3));
    boolean connectXPos = (connectFlagsY == 0 && hardXPos)
        || (blockXPos == this && !hardConnectionXPos && (connectFlagsY != 3 || connectFlagsXPos != 3));

    boolean connectSide = connectZNeg | connectZPos | connectXNeg | connectXPos;
    if (!connectSide && (connectFlagsY & 1) == 0) {
        if (hardZNeg)
            connectZNeg = true;
        if (hardZPos)
            connectZPos = true;
        if (hardXNeg)
            connectXNeg = true;
        if (hardXPos)
            connectXPos = true;
    }

    if (!(connectZNeg | connectZPos | connectXNeg | connectXPos))
        connectFlagsY = 3;

    if (connectFlagsY == 2 && hardZNeg)
        connectZNeg = true;
    if (connectFlagsY == 2 && hardZPos)
        connectZPos = true;
    if (connectFlagsY == 2 && hardXNeg)
        connectXNeg = true;
    if (connectFlagsY == 2 && hardXPos)
        connectXPos = true;

    return connectFlagsY | (connectZNeg ? 4 : 0) | (connectZPos ? 8 : 0) |
        (connectXNeg ? 16 : 0) | (connectXPos ? 32 : 0);
}
项目:Andrew2448PowersuitAddons    文件:AddonConfig.java   
public static void loadPowerModules() {
    List<IModularItem> ARMORONLY = Arrays.asList((IModularItem) ModularPowersuits.powerArmorHead, ModularPowersuits.powerArmorTorso, ModularPowersuits.powerArmorLegs, ModularPowersuits.powerArmorFeet);
    List<IModularItem> ALLITEMS = Arrays.asList((IModularItem) ModularPowersuits.powerArmorHead, ModularPowersuits.powerArmorTorso, ModularPowersuits.powerArmorLegs, ModularPowersuits.powerArmorFeet, ModularPowersuits.powerTool);
    List<IModularItem> HEADONLY = Arrays.asList((IModularItem) ModularPowersuits.powerArmorHead);
    List<IModularItem> TORSOONLY = Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso);
    List<IModularItem> LEGSONLY = Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs);
    List<IModularItem> FEETONLY = Arrays.asList((IModularItem) ModularPowersuits.powerArmorFeet);
    List<IModularItem> TOOLONLY = Arrays.asList((IModularItem) ModularPowersuits.powerTool);

    addModule(new InPlaceAssemblerModule(TOOLONLY));
    addModule(new KineticGeneratorModule(LEGSONLY));
    addModule(new SolarGeneratorModule(HEADONLY));
    addModule(new AutoFeederModule(HEADONLY));
    addModule(new MagnetModule(TORSOONLY));
    addModule(new OreScannerModule(TOOLONLY));
    addModule(new LeafBlowerModule(TOOLONLY));
    addModule(new ThermalGeneratorModule(TORSOONLY));
    addModule(new MobRepulsorModule(TORSOONLY));
    addModule(new FlintAndSteelModule(TOOLONLY));
    addModule(new ClockModule(HEADONLY));
    addModule(new CompassModule(HEADONLY));
    addModule(new LightningModule(TOOLONLY));
    addModule(new WaterTankModule(TORSOONLY));
    //addModule(new BucketModule(TOOLONLY));
    //addModule(new DimensionalRift(TORSOONLY));

    if (ModCompatability.isIndustrialCraftLoaded()) {
        addModule(new EUReaderModule(TOOLONLY));
        addModule(new TreetapModule(TOOLONLY));
    }

    if (ModCompatability.isThermalExpansionLoaded()) {
        addModule(new TEMultimeterModule(TOOLONLY));
    }

    try {
        torch = (BlockTorch) Block.blocksList[Block.torchWood.blockID];
        addModule(new TorchPlacerModule(TOOLONLY));
    } catch (Exception e) {
        AddonLogger.logError("Some mod is overriding the default torch. MPSA Torch Placer Module is being disabled.");
    }
}