/** * Build a platform to sustain the barbarians. * @param target the target to build it. * @param world the world to build it in. */ private static void buildPlatform(final BlockPos target, final World world) { final IBlockState platformBlock = Blocks.WOODEN_SLAB.getDefaultState(); for (int z = 0; z < 5; z++) { for (int x = 0; x < 5; x++) { final int sum = x * x + z * z; if (sum < (5 * 5) / 4) { world.setBlockState(new BlockPos(target.getX() + x, target.getY()-1, target.getZ() + z), platformBlock); world.setBlockState(new BlockPos(target.getX() + x, target.getY()-1, target.getZ() -z), platformBlock); world.setBlockState(new BlockPos(target.getX() -x, target.getY()-1, target.getZ() + z), platformBlock); world.setBlockState(new BlockPos(target.getX() -x, target.getY()-1, target.getZ() -z), platformBlock); } } } } }
@Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (stack.getCount() != 0 && player.canPlayerEdit(pos.offset(facing), facing, stack)) { IBlockState state = world.getBlockState(pos); if (state.getBlock() == this.singleSlab) { AncientSlabBlock.EnumBlockHalf half = state.getValue(BlockSlab.HALF); if ((facing == EnumFacing.UP && half == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && half == BlockSlab.EnumBlockHalf.TOP)) { AxisAlignedBB collisionBox = state.getSelectedBoundingBox(world, pos); IBlockState doubleSlabState = this.doubleSlab.getDefaultState(); if (collisionBox != Block.NULL_AABB && world.checkNoEntityCollision(collisionBox.offset(pos)) && world.setBlockState(pos, doubleSlabState, 11)) { SoundType sound = this.doubleSlab.getSoundType(); world.playSound(player, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, (sound.getVolume() + 1.0F) / 2.0F, sound.getPitch() * 0.8F); stack.shrink(1); } return EnumActionResult.SUCCESS; } } return this.tryPlace(player, stack, world, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ); } else { return EnumActionResult.FAIL; } }
@Override protected void generateLayers() { BlockWrapper us = new BlockWrapper(Blocks.STONE_SLAB.getDefaultState().withProperty(BlockSlab.HALF, BlockSlab.EnumBlockHalf.TOP)); // upside down stone slab BlockWrapper rs = new BlockWrapper(Blocks.STONE_SLAB); BlockWrapper ds = new BlockWrapper(Blocks.DOUBLE_STONE_SLAB); BlockWrapper cb = new BlockWrapper(Blocks.STONEBRICK.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.CHISELED)); // chiseled brick BlockWrapper sb = new BlockWrapper(Blocks.STONEBRICK); BlockWrapper cs = new BlockWrapper(Blocks.STONE_SLAB.getDefaultState().withProperty(BlockStoneSlab.VARIANT, BlockStoneSlab.EnumType.COBBLESTONE)); // cobblestone slab BlockWrapper co = new BlockWrapper(Blocks.COBBLESTONE); BlockWrapper wa = new BlockWrapper(Blocks.WATER);
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 9, 0, 6, iblockstate, iblockstate, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 9, 4, 6, iblockstate, iblockstate, false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 9, 5, 6, Blocks.STONE_SLAB.getDefaultState(), Blocks.STONE_SLAB.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 8, 5, 5, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, iblockstate3, iblockstate3, false); this.setBlockState(worldIn, Blocks.FURNACE.getDefaultState(), 6, 2, 3, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.FURNACE.getDefaultState(), 6, 3, 3, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.DOUBLE_STONE_SLAB.getDefaultState(), 8, 1, 1, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.GLASS_PANE.getDefaultState(), 0, 2, 4, structureBoundingBoxIn);
IBlockState defaultSlabState = Blocks.WOODEN_SLAB.getDefaultState(); for (EnumVanillaWoodType woodType : EnumVanillaWoodType.VALUES) { BlockPlanks.EnumType vanillaType = woodType.getVanillaType();