Search in sources :

Example 1 with TileEntityDionaDungeonSpawner

use of stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDionaDungeonSpawner in project MorePlanets by SteveKunG.

the class RoomBossDiona method addComponentParts.

@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox boundingBox) {
    for (int i = 0; i <= this.sizeX; i++) {
        for (int j = 0; j <= this.sizeY; j++) {
            for (int k = 0; k <= this.sizeZ; k++) {
                if (i == 0 || i == this.sizeX || j == 0 || k == 0 || k == this.sizeZ) {
                    boolean placeBlock = true;
                    if (this.getDirection().getAxis() == EnumFacing.Axis.Z) {
                        int start = (this.boundingBox.maxX - this.boundingBox.minX) / 2 - 1;
                        int end = (this.boundingBox.maxX - this.boundingBox.minX) / 2 + 1;
                        if (i > start && i <= end && j < 3 && j > 0) {
                            if (this.getDirection() == EnumFacing.SOUTH && k == 0) {
                                placeBlock = false;
                            } else if (this.getDirection() == EnumFacing.NORTH && k == this.sizeZ) {
                                placeBlock = false;
                            }
                        }
                    } else {
                        int start = (this.boundingBox.maxZ - this.boundingBox.minZ) / 2 - 1;
                        int end = (this.boundingBox.maxZ - this.boundingBox.minZ) / 2 + 1;
                        if (k > start && k <= end && j < 3 && j > 0) {
                            if (this.getDirection() == EnumFacing.EAST && i == 0) {
                                placeBlock = false;
                            } else if (this.getDirection() == EnumFacing.WEST && i == this.sizeX) {
                                placeBlock = false;
                            }
                        }
                    }
                    if (placeBlock) {
                        this.setBlockState(world, this.configuration.getBrickBlock(), i, j, k, boundingBox);
                    } else {
                        this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                    }
                } else if (j == this.sizeY) {
                    if ((i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2) && rand.nextInt(4) == 0) {
                        this.setBlockState(world, this.configuration.getGlowstoneBlock(), i, j, k, boundingBox);
                    } else {
                        this.setBlockState(world, this.configuration.getBrickBlock(), i, j, k, boundingBox);
                    }
                } else if (j == 1 && (i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2)) {
                    if (rand.nextInt(4) == 0) {
                        this.setBlockState(world, this.configuration.getGlowstoneBlock(), i, j - 1, k, boundingBox);
                    } else {
                        this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                    }
                    if (rand.nextInt(6) == 0) {
                        this.setBlockState(world, MPBlocks.ZELIUS_EGG.getDefaultState(), i, j, k, boundingBox);
                    } else {
                        this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                    }
                } else {
                    this.setBlockState(world, Blocks.AIR.getDefaultState(), i, j, k, boundingBox);
                }
            }
        }
    }
    int spawnerX = this.sizeX / 2;
    int spawnerY = 1;
    int spawnerZ = this.sizeZ / 2;
    this.setBlockState(world, MPBlocks.DIONA_DUNGEON_SPAWNER.getDefaultState(), spawnerX, spawnerY, spawnerZ, boundingBox);
    BlockPos blockpos = new BlockPos(this.getXWithOffset(spawnerX, spawnerZ), this.getYWithOffset(spawnerY), this.getZWithOffset(spawnerX, spawnerZ));
    TileEntityDionaDungeonSpawner spawner = (TileEntityDionaDungeonSpawner) world.getTileEntity(blockpos);
    if (spawner == null) {
        spawner = new TileEntityDionaDungeonSpawner();
        world.setTileEntity(blockpos, spawner);
    }
    spawner.setRoom(new Vector3(this.boundingBox.minX + 1, this.boundingBox.minY + 1, this.boundingBox.minZ + 1), new Vector3(this.sizeX - 1, this.sizeY - 1, this.sizeZ - 1));
    spawner.setChestPos(this.chestPos);
    return true;
}
Also used : TileEntityDionaDungeonSpawner(stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDionaDungeonSpawner) BlockPos(net.minecraft.util.math.BlockPos) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Aggregations

Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)1 BlockPos (net.minecraft.util.math.BlockPos)1 TileEntityDionaDungeonSpawner (stevekung.mods.moreplanets.planets.diona.tileentity.TileEntityDionaDungeonSpawner)1