- 103
- 2
- 2
Хочу сделать в деревне "башню волшебника", сейчас там генерируется домик с жителем у которого профессия "Колдун" с помощью такого кода:
Можно ли как-то использовать .schematic файлы из MCEdit?
Код:
@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox box)
{
if(groundLevel < 0)
{
groundLevel = this.getAverageGroundLevel(world, box);
if(groundLevel < 0)
return true;
boundingBox.offset(0, groundLevel-boundingBox.maxY+10-1, 0);
}
//Stair
//Clear Space
this.fillWithBlocks(world, box, 0, 0, 0, 10, 9, 8, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
//Cobble
this.fillWithBlocks(world, box, 1, 0, 1, 9, 0, 8, Blocks.COBBLESTONE.getDefaultState(), Blocks.COBBLESTONE.getDefaultState(), false);
this.fillWithBlocks(world, box, 6, 0, 1, 9, 0, 2, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
//Stair
this.setBlockState(world, Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH), 4, 0, 0, box);
//Pillars
this.fillWithBlocks(world, box, 1, 1, 3, 1, 4, 3, BlocksRegister.REDPLANKS.getDefaultState(), BlocksRegister.REDPLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 1, 1, 8, 1, 6, 8, BlocksRegister.REDPLANKS.getDefaultState(), BlocksRegister.REDPLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 9, 1, 3, 9, 6, 3, BlocksRegister.REDPLANKS.getDefaultState(), BlocksRegister.REDPLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 9, 1, 8, 9, 6, 8, BlocksRegister.REDPLANKS.getDefaultState(), BlocksRegister.REDPLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 1, 4, 3, 9, 4, 8, BlocksRegister.REDPLANKS.getDefaultState(), BlocksRegister.REDPLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 6, 5, 3, 6, 7, 3, BlocksRegister.REDPLANKS.getDefaultState(), BlocksRegister.REDPLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 1, 5, 5, 1, 6, 5, BlocksRegister.REDPLANKS.getDefaultState(), BlocksRegister.REDPLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 2, 4, 5, 8, 4, 7, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false);
//Wool
this.fillWithBlocks(world, box, 2, 0, 3, 5, 0, 4, Blocks.WOOL.getStateFromMeta(13), Blocks.WOOL.getStateFromMeta(13), false);
this.fillWithBlocks(world, box, 2, 0, 4, 8, 0, 7, Blocks.WOOL.getStateFromMeta(13), Blocks.WOOL.getStateFromMeta(13), false);
this.fillWithBlocks(world, box, 6, 4, 4, 8, 4, 4, Blocks.WOOL.getStateFromMeta(13), Blocks.WOOL.getStateFromMeta(13), false);
this.fillWithBlocks(world, box, 2, 4, 5, 7, 4, 5, Blocks.WOOL.getStateFromMeta(13), Blocks.WOOL.getStateFromMeta(13), false);
this.fillWithBlocks(world, box, 2, 4, 6, 6, 4, 6, Blocks.WOOL.getStateFromMeta(13), Blocks.WOOL.getStateFromMeta(13), false);
this.fillWithBlocks(world, box, 2, 4, 7, 4, 4, 7, Blocks.WOOL.getStateFromMeta(13), Blocks.WOOL.getStateFromMeta(13), false);
//Walls
//Front
this.fillWithBlocks(world, box, 2, 1, 3, 8, 3, 3, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 7, 5, 3, 8, 6, 3, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 7, 7, 3, box);
this.fillWithBlocks(world, box, 6, 5, 4, 6, 7, 4, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 2, 5, 5, 5, 6, 5, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 3, 7, 5, 5, 7, 5, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 5, 8, 5, box);
//Back
this.fillWithBlocks(world, box, 2, 1, 8, 8, 3, 8, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 2, 5, 8, 8, 6, 8, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 3, 7, 8, 7, 7, 8, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 5, 8, 8, box);
//Left
this.fillWithBlocks(world, box, 1, 1, 4, 1, 3, 7, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 1, 5, 6, 1, 5, 7, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
//Right
this.fillWithBlocks(world, box, 9, 1, 4, 9, 3, 7, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
this.fillWithBlocks(world, box, 9, 5, 4, 9, 6, 7, Blocks.PLANKS.getDefaultState(), Blocks.PLANKS.getDefaultState(), false);
//Windows
//Front
this.setBlockState(world, Blocks.GLASS_PANE.getDefaultState(), 2, 2, 3, box);
this.setBlockState(world, Blocks.GLASS_PANE.getDefaultState(), 6, 2, 3, box);
this.setBlockState(world, Blocks.GLASS_PANE.getDefaultState(), 8, 2, 3, box);
this.fillWithBlocks(world, box, 7, 6, 3, 8, 6, 3, Blocks.GLASS_PANE.getDefaultState(), Blocks.GLASS_PANE.getDefaultState(), false);
//Back
this.fillWithBlocks(world, box, 3, 2, 8, 5, 2, 8, Blocks.GLASS_PANE.getDefaultState(), Blocks.GLASS_PANE.getDefaultState(), false);
this.fillWithBlocks(world, box, 3, 6, 8, 4, 6, 8, Blocks.GLASS_PANE.getDefaultState(), Blocks.GLASS_PANE.getDefaultState(), false);
this.fillWithBlocks(world, box, 6, 6, 8, 7, 6, 8, Blocks.GLASS_PANE.getDefaultState(), Blocks.GLASS_PANE.getDefaultState(), false);
//Left
this.fillWithBlocks(world, box, 1, 2, 5, 1, 2, 6, Blocks.GLASS_PANE.getDefaultState(), Blocks.GLASS_PANE.getDefaultState(), false);
this.fillWithBlocks(world, box, 1, 6, 6, 1, 6, 7, Blocks.GLASS_PANE.getDefaultState(), Blocks.GLASS_PANE.getDefaultState(), false);
//Right
this.fillWithBlocks(world, box, 9, 2, 5, 9, 2, 6, Blocks.GLASS_PANE.getDefaultState(), Blocks.GLASS_PANE.getDefaultState(), false);
this.fillWithBlocks(world, box, 9, 6, 5, 9, 6, 6, Blocks.GLASS_PANE.getDefaultState(), Blocks.GLASS_PANE.getDefaultState(), false);
//Fences
this.fillWithBlocks(world, box, 1, 1, 1, 1, 1, 2, Blocks.ACACIA_FENCE.getStateFromMeta(0), Blocks.ACACIA_FENCE.getStateFromMeta(0), false);
this.fillWithBlocks(world, box, 2, 1, 1, 3, 1, 1, Blocks.ACACIA_FENCE.getStateFromMeta(0), Blocks.ACACIA_FENCE.getStateFromMeta(0), false);
this.fillWithBlocks(world, box, 5, 1, 1, 5, 1, 2, Blocks.ACACIA_FENCE.getStateFromMeta(0), Blocks.ACACIA_FENCE.getStateFromMeta(0), false);
this.fillWithBlocks(world, box, 1, 5, 3, 1, 5, 4, Blocks.ACACIA_FENCE.getStateFromMeta(0), Blocks.ACACIA_FENCE.getStateFromMeta(0), false);
this.fillWithBlocks(world, box, 2, 5, 3, 5, 5, 3, Blocks.ACACIA_FENCE.getStateFromMeta(0), Blocks.ACACIA_FENCE.getStateFromMeta(0), false);
this.fillWithBlocks(world, box, 7, 1, 6, 7, 5, 6, Blocks.ACACIA_FENCE.getStateFromMeta(0), Blocks.ACACIA_FENCE.getStateFromMeta(0), false);
//Doors
this.generateDoor(world, box, rand, 4, 1, 3, EnumFacing.NORTH, Blocks.OAK_DOOR);
if(getCoordBaseMode()==EnumFacing.SOUTH||getCoordBaseMode()==EnumFacing.WEST)
{
this.placeDoor(world, box, rand, 3, 5, 5, EnumFacing.NORTH, EnumHingePosition.LEFT);
this.placeDoor(world, box, rand, 4, 5, 5, EnumFacing.NORTH, EnumHingePosition.RIGHT);
}
else
{
this.placeDoor(world, box, rand, 3, 5, 5, EnumFacing.NORTH, EnumHingePosition.LEFT);
this.placeDoor(world, box, rand, 4, 5, 5, EnumFacing.NORTH, EnumHingePosition.RIGHT);
}
//Stairs
IBlockState stairs = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH);
setBlockState(world, stairs, 8, 1, 6, box);
stairs = stairs.withRotation(Rotation.COUNTERCLOCKWISE_90);
// stairMeta = this.getMetadataWithOffset(Blocks.OAK_STAIRS, 1);
setBlockState(world, Blocks.PLANKS.getDefaultState(), 8, 1, 7, box);
setBlockState(world, stairs, 7, 2, 7, box);
setBlockState(world, stairs, 6, 3, 7, box);
setBlockState(world, stairs, 5, 4, 7, box);
//Roof
IBlockState brickSlab = Blocks.STONE_SLAB.getDefaultState().withProperty(BlockStoneSlab.VARIANT, BlockStoneSlab.EnumType.BRICK);
IBlockState brickSlabInverted = brickSlab.withProperty(BlockSlab.HALF, EnumBlockHalf.TOP);
this.fillWithBlocks(world, box, 0, 6, 4, 0, 6, 8, brickSlabInverted, brickSlabInverted, false);
this.fillWithBlocks(world, box, 1, 7, 4, 1, 7, 8, brickSlab, brickSlab, false);
this.fillWithBlocks(world, box, 3, 8, 4, 3, 8, 8, brickSlab, brickSlab, false);
this.fillWithBlocks(world, box, 5, 9, 2, 5, 9, 8, brickSlab, brickSlab, false);
this.fillWithBlocks(world, box, 7, 8, 2, 7, 8, 8, brickSlab, brickSlab, false);
this.fillWithBlocks(world, box, 9, 7, 2, 9, 7, 8, brickSlab, brickSlab, false);
this.fillWithBlocks(world, box, 10, 6, 2, 10, 6, 8, brickSlabInverted, brickSlabInverted, false);
IBlockState brickStairs = Blocks.BRICK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.EAST);
this.fillWithBlocks(world, box, 2, 7, 4, 2, 7, 8, brickStairs, brickStairs, false);
this.fillWithBlocks(world, box, 4, 8, 4, 4, 8, 8, brickStairs, brickStairs, false);
brickStairs = brickStairs.withRotation(Rotation.CLOCKWISE_180);
this.fillWithBlocks(world, box, 6, 8, 2, 6, 8, 8, brickStairs, brickStairs, false);
this.fillWithBlocks(world, box, 8, 7, 2, 8, 7, 8, brickStairs, brickStairs, false);
this.fillWithBlocks(world, box, 2, 7, 5, 2, 8, 5, Blocks.BRICK_BLOCK.getDefaultState(), Blocks.BRICK_BLOCK.getDefaultState(), false);
this.fillWithBlocks(world, box, 7, 8, 4, 7, 9, 4, Blocks.BRICK_BLOCK.getDefaultState(), Blocks.BRICK_BLOCK.getDefaultState(), false);
for(int zz = 0; zz <= 9; zz++)
for(int xx = 0; xx <= 10; xx++)
{
this.clearCurrentPositionBlocksUpwards(world, xx, 10, zz, box);
this.replaceAirAndLiquidDownwards(world, Blocks.COBBLESTONE.getDefaultState(), xx, -1, zz, box);
}
this.spawnVillagers(world, box, 4, 1, 2, 1);
return true;
}