net.minecraft.block.BlockLadder Java Examples

The following examples show how to use net.minecraft.block.BlockLadder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinBlockLadder.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @author CCBlueX
 */
@Overwrite
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
    final IBlockState iblockstate = worldIn.getBlockState(pos);

    if(iblockstate.getBlock() instanceof BlockLadder) {
        final FastClimb fastClimb = (FastClimb) LiquidBounce.moduleManager.getModule(FastClimb.class);
        final float f = fastClimb.getState() && fastClimb.getModeValue().get().equalsIgnoreCase("AAC3.0.0") ? 0.99f : 0.125f;

        switch(iblockstate.getValue(FACING)) {
            case NORTH:
                this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
                break;
            case SOUTH:
                this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
                break;
            case WEST:
                this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
                break;
            case EAST:
            default:
                this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
        }
    }
}
 
Example #2
Source File: MixinBlockLadder.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @author CCBlueX
 */
@Overwrite
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
    final IBlockState iblockstate = worldIn.getBlockState(pos);

    if(iblockstate.getBlock() instanceof BlockLadder) {
        final FastClimb fastClimb = (FastClimb) LiquidBounce.moduleManager.getModule(FastClimb.class);
        final float f = fastClimb.getState() && fastClimb.getModeValue().get().equalsIgnoreCase("AAC3.0.0") ? 0.99f : 0.125f;

        switch(iblockstate.getValue(FACING)) {
            case NORTH:
                this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
                break;
            case SOUTH:
                this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
                break;
            case WEST:
                this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
                break;
            case EAST:
            default:
                this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
        }
    }
}
 
Example #3
Source File: TofuVillagerHouse.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * 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.averageGroundLvl < 0) {
        this.averageGroundLvl = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);

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

        this.boundingBox.offset(0, this.averageGroundLvl - this.boundingBox.maxY + 9 - 1, 0);
    }

    IBlockState iblockstate1 = this.getBiomeSpecificBlockState(BlockLoader.TOFUISHI_BRICK.getDefaultState());
    IBlockState iblockstate2 = this.getBiomeSpecificBlockState(BlockLoader.TOFUISHI_BRICK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH));
    IBlockState air = Blocks.AIR.getDefaultState();
    IBlockState iblockstate3 = BlockLoader.ISHITOFU.getDefaultState();

    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 6, 4, 6, iblockstate1, iblockstate1, false);
    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 5, 3, 5, air, air, false);

    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 0, 2, 3, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 3, 2, 6, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 6, 2, 3, structureBoundingBoxIn);

    this.setBlockState(worldIn, Blocks.BOOKSHELF.getDefaultState(), 1, 1, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.BOOKSHELF.getDefaultState(), 1, 2, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.BOOKSHELF.getDefaultState(), 1, 3, 5, structureBoundingBoxIn);

    this.setBlockState(worldIn, Blocks.CRAFTING_TABLE.getDefaultState(), 1, 1, 4, structureBoundingBoxIn);

    this.setBlockState(worldIn, BlockLoader.SALTFURNACE.getDefaultState(), 1, 5, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.CAULDRON.getDefaultState(), 1, 6, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.ISHITOFU.getDefaultState(), 5, 5, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.TOFUISHI_BRICK.getDefaultState(), 5, 6, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.ISHITOFU.getDefaultState(), 4, 5, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.TOFUISHI_BRICK.getDefaultState(), 5, 6, 1, structureBoundingBoxIn);

    IBlockState iblockstate5 = BlockLoader.TOFUISHI_BRICK_LADDER.getDefaultState().withProperty(BlockLadder.FACING, EnumFacing.SOUTH);
    this.setBlockState(worldIn, iblockstate5, 5, 1, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, iblockstate5, 5, 2, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, iblockstate5, 5, 3, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, iblockstate5, 5, 4, 5, structureBoundingBoxIn);
    //2F
    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 6, 9, 6, iblockstate1, iblockstate1, false);
    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 5, 8, 5, air, air, false);

    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 9, 0, iblockstate3, iblockstate3, false);
    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 0, 6, 9, 0, iblockstate3, iblockstate3, false);
    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 6, 0, 9, 6, iblockstate3, iblockstate3, false);
    this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 6, 6, 9, 6, iblockstate3, iblockstate3, false);

    this.setBlockState(worldIn, BlockLoader.ISHITOFU.getDefaultState(), 1, 5, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.TOFU_LEAVE.getDefaultState(), 1, 6, 5, structureBoundingBoxIn);

    BlockPos blockpos = new BlockPos(this.getXWithOffset(2, 5), this.getYWithOffset(5), this.getZWithOffset(2, 5));

    this.generateChest(worldIn, structureBoundingBoxIn, randomIn, blockpos, TofuLootTables.tofuhouse, BlockLoader.TOFUCHEST.getDefaultState().withProperty(BlockTofuChest.FACING, EnumFacing.EAST));

    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 0, 6, 3, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 3, 6, 6, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 6, 6, 3, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 3, 6, 0, structureBoundingBoxIn);


    if (this.getBlockStateFromPos(worldIn, 3, 0, -1, structureBoundingBoxIn).getMaterial() == Material.AIR && this.getBlockStateFromPos(worldIn, 3, -1, -1, structureBoundingBoxIn).getMaterial() != Material.AIR) {
        this.setBlockState(worldIn, iblockstate2, 3, 0, -1, structureBoundingBoxIn);

    }


    this.placeTorch(worldIn, EnumFacing.NORTH, 3, 3, 1, structureBoundingBoxIn);
    this.placeTorch(worldIn, EnumFacing.SOUTH, 3, 3, 5, structureBoundingBoxIn);
    this.placeTorch(worldIn, EnumFacing.SOUTH, 3, 7, 5, structureBoundingBoxIn);

    this.createVillageDoor(worldIn, structureBoundingBoxIn, randomIn, 3, 1, 0, EnumFacing.NORTH);


    this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 1, 4, 2);

    for (int l = 0; l < 6; ++l) {
        for (int k = 0; k < 6; ++k) {
            this.clearCurrentPositionBlocksUpwards(worldIn, k, 9, l, structureBoundingBoxIn);
            this.replaceAirAndLiquidDownwards(worldIn, iblockstate1, k, -1, l, structureBoundingBoxIn);
        }
    }

    return true;
}
 
Example #4
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) {
    if (this.averageGroundLvl < 0) {
        this.averageGroundLvl = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);

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

        this.boundingBox.offset(0, this.averageGroundLvl - this.boundingBox.maxY + 9 - 1, 0);
    }


    IBlockState iblockstate = this.getBiomeSpecificBlockState(BlockLoader.tofuTerrain.getDefaultState());
    IBlockState iblockstate1 = this.getBiomeSpecificBlockState(BlockLoader.TOFUISHI_BRICK.getDefaultState());
    IBlockState iblockstate2 = this.getBiomeSpecificBlockState(BlockLoader.TOFUISHI_BRICK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH));
    IBlockState air = Blocks.AIR.getDefaultState();
    IBlockState iblockstate3 = BlockLoader.ISHITOFU.getDefaultState();

    this.fillWithBlocks(worldIn,structureBoundingBoxIn,0,0,0,6,4,6,iblockstate1,iblockstate1,false);
    this.fillWithBlocks(worldIn,structureBoundingBoxIn,1,1,1,5,3,5,air,air,false);

    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 0, 2, 3, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 3, 2, 6, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 6, 2, 3, structureBoundingBoxIn);

    this.setBlockState(worldIn, Blocks.BOOKSHELF.getDefaultState(), 1, 1, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.BOOKSHELF.getDefaultState(), 1, 2, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.BOOKSHELF.getDefaultState(), 1, 3, 5, structureBoundingBoxIn);

    this.setBlockState(worldIn, Blocks.CRAFTING_TABLE.getDefaultState(), 1, 1, 4, structureBoundingBoxIn);

    this.setBlockState(worldIn, BlockLoader.ISHITOFU.getDefaultState(), 1, 5, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.TOFU_LEAVE.getDefaultState(), 1, 6, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.ISHITOFU.getDefaultState(), 5, 5, 1, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.TOFU_LEAVE.getDefaultState(), 5, 6, 1, structureBoundingBoxIn);

    IBlockState iblockstate5 = BlockLoader.TOFUISHI_BRICK_LADDER.getDefaultState().withProperty(BlockLadder.FACING, EnumFacing.SOUTH);
    this.setBlockState(worldIn, iblockstate5, 5, 1, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, iblockstate5, 5, 2, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, iblockstate5, 5, 3, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, iblockstate5, 5, 4, 5, structureBoundingBoxIn);
    //2F
    this.fillWithBlocks(worldIn,structureBoundingBoxIn,0,5,0,6,9,6,iblockstate1,iblockstate1,false);
    this.fillWithBlocks(worldIn,structureBoundingBoxIn,1,5,1,5,8,5,air,air,false);

    this.fillWithBlocks(worldIn,structureBoundingBoxIn,0,0,0,0,9,0,iblockstate3,iblockstate3,false);
    this.fillWithBlocks(worldIn,structureBoundingBoxIn,6,0,0,6,9,0,iblockstate3,iblockstate3,false);
    this.fillWithBlocks(worldIn,structureBoundingBoxIn,0,0,6,0,9,6,iblockstate3,iblockstate3,false);
    this.fillWithBlocks(worldIn,structureBoundingBoxIn,6,0,6,6,9,6,iblockstate3,iblockstate3,false);

    this.setBlockState(worldIn, BlockLoader.ISHITOFU.getDefaultState(), 1, 5, 5, structureBoundingBoxIn);
    this.setBlockState(worldIn, BlockLoader.TOFU_LEAVE.getDefaultState(), 1, 6, 5, structureBoundingBoxIn);

    BlockPos blockpos = new BlockPos(this.getXWithOffset(2,5), this.getYWithOffset(5), this.getZWithOffset(2,5));

    this.generateChest(worldIn,structureBoundingBoxIn,randomIn,blockpos, TofuLootTables.tofuhouse,BlockLoader.TOFUCHEST.getDefaultState().withProperty(BlockTofuChest.FACING, EnumFacing.EAST));

    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 0, 6, 3, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 3, 6, 6, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 6, 6, 3, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 3, 6, 0, structureBoundingBoxIn);



    if (this.getBlockStateFromPos(worldIn, 3, 0, -1, structureBoundingBoxIn).getMaterial() == Material.AIR && this.getBlockStateFromPos(worldIn, 3, -1, -1, structureBoundingBoxIn).getMaterial() != Material.AIR)
    {
        this.setBlockState(worldIn, iblockstate2, 3, 0, -1, structureBoundingBoxIn);

    }


    this.placeTorch(worldIn, EnumFacing.NORTH, 3, 3, 1, structureBoundingBoxIn);
    this.placeTorch(worldIn, EnumFacing.SOUTH, 3, 3, 5, structureBoundingBoxIn);
    this.placeTorch(worldIn, EnumFacing.SOUTH, 3, 7, 5, structureBoundingBoxIn);

    this.placeDoor(worldIn, structureBoundingBoxIn, randomIn, 3, 1, 0, EnumFacing.NORTH);

    for (int j = 0; j < 7; ++j)
    {
        for (int i = 0; i < 7; ++i)
        {
            this.clearCurrentPositionBlocksUpwards(worldIn, i, 10, j, structureBoundingBoxIn);
            this.replaceAirAndLiquidDownwards(worldIn, iblockstate, i, -1, j, structureBoundingBoxIn);
        }
    }

    this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 6, 4, 2,2);

    this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 1, 4, 1);
    return true;
}