use of stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNibiruDungeonSpawner in project MorePlanets by SteveKunG.
the class RoomBossNibiru 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);
}
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.SPACE_DUNGEON_SPAWNER.getDefaultState().withProperty(BlockSpaceDungeonSpawner.PLANET, BlockSpaceDungeonSpawner.DungeonType.NIBIRU), spawnerX, spawnerY, spawnerZ, boundingBox);
BlockPos blockpos = new BlockPos(this.getXWithOffset(spawnerX, spawnerZ), this.getYWithOffset(spawnerY), this.getZWithOffset(spawnerX, spawnerZ));
TileEntityNibiruDungeonSpawner spawner = (TileEntityNibiruDungeonSpawner) world.getTileEntity(blockpos);
if (spawner == null) {
spawner = new TileEntityNibiruDungeonSpawner();
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;
}
Aggregations