Backported some generation improvements to the Bronze Dungeon.
This commit is contained in:
parent
04ffc6e042
commit
8d4108d1e0
|
@ -1,7 +1,11 @@
|
|||
package com.legacy.aether.entities.bosses.slider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityFlying;
|
||||
|
@ -40,6 +44,8 @@ public class EntitySlider extends EntityFlying implements IAetherBoss {
|
|||
|
||||
private int dungeonX, dungeonY, dungeonZ;
|
||||
|
||||
private int[] doorStart = new int[3], doorEnd = new int[3];
|
||||
|
||||
public float hurtAngle, hurtAngleX, hurtAngleZ;
|
||||
|
||||
public int chatTime, moveTime;
|
||||
|
@ -98,6 +104,9 @@ public class EntitySlider extends EntityFlying implements IAetherBoss {
|
|||
nbttagcompound.setInteger("dungeonY", this.dungeonY);
|
||||
nbttagcompound.setInteger("dungeonZ", this.dungeonZ);
|
||||
|
||||
nbttagcompound.setIntArray("doorStart", this.doorStart);
|
||||
nbttagcompound.setIntArray("doorEnd", this.doorEnd);
|
||||
|
||||
nbttagcompound.setBoolean("isAwake", this.isAwake());
|
||||
nbttagcompound.setString("bossName", this.getName());
|
||||
}
|
||||
|
@ -109,6 +118,9 @@ public class EntitySlider extends EntityFlying implements IAetherBoss {
|
|||
this.dungeonY = nbttagcompound.getInteger("dungeonY");
|
||||
this.dungeonZ = nbttagcompound.getInteger("dungeonZ");
|
||||
|
||||
this.doorStart = nbttagcompound.getIntArray("doorStart");
|
||||
this.doorEnd = nbttagcompound.getIntArray("doorEnd");
|
||||
|
||||
this.setAwake(nbttagcompound.getBoolean("isAwake"));
|
||||
this.setBossName(nbttagcompound.getString("bossName"));
|
||||
}
|
||||
|
@ -342,10 +354,109 @@ public class EntitySlider extends EntityFlying implements IAetherBoss {
|
|||
this.worldObj.spawnParticle("smoke", a, b, c, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
private void openDoor() {
|
||||
for (int y = this.dungeonY + 1; y < this.dungeonY + 5; y++) {
|
||||
for (int z = this.dungeonZ + 6; z < this.dungeonZ + 10; z++) {
|
||||
this.worldObj.setBlock(this.dungeonX + 15, y, z, Blocks.air);
|
||||
private boolean checkIsAir(int x1, int y1, int z1, int x2, int y2, int z2)
|
||||
{
|
||||
ArrayList<Block> blockList = Lists.newArrayListWithCapacity(9);
|
||||
|
||||
for (int x = x1; x < x2 + 1; x++)
|
||||
{
|
||||
for (int z = z1; z < z2 + 1; z++)
|
||||
{
|
||||
for (int y = y1; y < y2 + 1; y++)
|
||||
{
|
||||
blockList.add(this.worldObj.getBlock(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Set<Block> blockSet = new HashSet<>(blockList);
|
||||
|
||||
if (blockSet.size() == 1)
|
||||
{
|
||||
return blockList.get(1) == Blocks.air;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void openDoor()
|
||||
{
|
||||
for (int x = this.doorStart[0]; x < this.doorEnd[0] + 1; x++)
|
||||
{
|
||||
for (int y = this.doorStart[1]; y < this.doorEnd[1] + 1; y++)
|
||||
{
|
||||
for (int z = this.doorStart[2]; z < this.doorEnd[2] + 1; z++)
|
||||
{
|
||||
this.worldObj.setBlock(x, y, z, Blocks.air);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void closeDoor()
|
||||
{
|
||||
if (checkIsAir(this.dungeonX + 15, this.dungeonY + 1, this.dungeonZ + 6, this.dungeonX + 15, this.dungeonY + 4, this.dungeonZ + 9))
|
||||
{
|
||||
//EAST
|
||||
this.doorStart = new int[] {this.dungeonX + 15, this.dungeonY + 1, this.dungeonZ + 6};
|
||||
this.doorEnd = new int[] {this.dungeonX + 15, this.dungeonY + 4, this.dungeonZ + 9};
|
||||
|
||||
int x = this.dungeonX + 15;
|
||||
|
||||
for(int y = this.dungeonY + 1; y < this.dungeonY + 8; y++)
|
||||
{
|
||||
for(int z = this.dungeonZ + 5; z < this.dungeonZ + 11; z++)
|
||||
{
|
||||
this.worldObj.setBlock(x, y, z, BlocksAether.locked_carved_stone);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (checkIsAir(this.dungeonX, this.dungeonY + 1, this.dungeonZ + 6, this.dungeonX, this.dungeonY + 4, this.dungeonZ + 9))
|
||||
{
|
||||
//WEST
|
||||
this.doorStart = new int[] {this.dungeonX, this.dungeonY + 1, this.dungeonZ + 6};
|
||||
this.doorEnd = new int[] {this.dungeonX, this.dungeonY + 4, this.dungeonZ + 9};
|
||||
|
||||
int x = this.dungeonX;
|
||||
|
||||
for(int y = this.dungeonY + 1; y < this.dungeonY + 8; y++)
|
||||
{
|
||||
for(int z = this.dungeonZ + 5; z < this.dungeonZ + 11; z++)
|
||||
{
|
||||
this.worldObj.setBlock(x, y, z, BlocksAether.locked_carved_stone);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (checkIsAir(this.dungeonX + 6, this.dungeonY + 1, this.dungeonZ + 15, this.dungeonX + 9, this.dungeonY + 4, this.dungeonZ + 15))
|
||||
{
|
||||
//SOUTH
|
||||
this.doorStart = new int[] {this.dungeonX + 6, this.dungeonY + 1, this.dungeonZ + 15};
|
||||
this.doorEnd = new int[] {this.dungeonX + 9, this.dungeonY + 4, this.dungeonZ + 15};
|
||||
|
||||
int z = this.dungeonZ + 15;
|
||||
|
||||
for(int y = this.dungeonY + 1; y < this.dungeonY + 8; y++)
|
||||
{
|
||||
for(int x = this.dungeonX + 5; x < this.dungeonX + 11; x++)
|
||||
{
|
||||
this.worldObj.setBlock(x, y, z, BlocksAether.locked_carved_stone);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (checkIsAir(this.dungeonX + 6, this.dungeonY + 1, this.dungeonZ, this.dungeonX + 9, this.dungeonY + 4, this.dungeonZ))
|
||||
{
|
||||
//NORTH
|
||||
this.doorStart = new int[] {this.dungeonX + 6, this.dungeonY + 1, this.dungeonZ};
|
||||
this.doorEnd = new int[] {this.dungeonX + 9, this.dungeonY + 4, this.dungeonZ};
|
||||
|
||||
int z = this.dungeonZ;
|
||||
|
||||
for(int y = this.dungeonY + 1; y < this.dungeonY + 8; y++)
|
||||
{
|
||||
for(int x = this.dungeonX + 5; x < this.dungeonX + 11; x++)
|
||||
{
|
||||
this.worldObj.setBlock(x, y, z, BlocksAether.locked_carved_stone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -490,13 +601,7 @@ public class EntitySlider extends EntityFlying implements IAetherBoss {
|
|||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "aether_legacy:aeboss_slider.awaken", 2.5F, 1.0F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
this.setAttackTarget(player);
|
||||
|
||||
int x = this.dungeonX + 15;
|
||||
|
||||
for (int y = this.dungeonY + 1; y < this.dungeonY + 8; y++) {
|
||||
for (int z = this.dungeonZ + 5; z < this.dungeonZ + 11; z++) {
|
||||
this.worldObj.setBlock(x, y, z, BlocksAether.locked_carved_stone);
|
||||
}
|
||||
}
|
||||
this.closeDoor();
|
||||
|
||||
this.setAwake(true);
|
||||
}
|
||||
|
|
|
@ -265,8 +265,9 @@ public class ChunkProviderAether implements IChunkProvider {
|
|||
|
||||
biome.decorate(this.worldObj, this.rand, x, z);
|
||||
|
||||
if (this.rand.nextInt(10) == 0) {
|
||||
this.dungeon_bronze.generate(this.worldObj, this.rand, x + this.rand.nextInt(16), this.rand.nextInt(64) + 32, z + this.rand.nextInt(16));
|
||||
if (this.rand.nextInt(1) == 0)
|
||||
{
|
||||
this.dungeon_bronze.generate(this.worldObj, this.rand, x, this.rand.nextInt(96) + 24, z);
|
||||
}
|
||||
|
||||
SpawnerAnimals.performWorldGenSpawning(this.worldObj, biome, x + 8, z + 8, 16, 16, this.rand);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.legacy.aether.world.dungeon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -21,10 +23,13 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
|
||||
private int n;
|
||||
|
||||
private boolean finished;
|
||||
private boolean needsCorridor;
|
||||
|
||||
private boolean hasCorridor;
|
||||
|
||||
public BronzeDungeon() {
|
||||
finished = false;
|
||||
hasCorridor = false;
|
||||
needsCorridor = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,7 +38,7 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
replaceSolid = true;
|
||||
n = 0;
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(i, j, k), new PositionData(16, 12, 16)) || !isBoxSolid(world, new PositionData(i + 20, j, k + 2), new PositionData(12, 12, 12))) {
|
||||
if (!isBoxSolid(world, new PositionData(i, j - 3, k), new PositionData(16, 15, 16)) || !isBoxSolid(world, new PositionData(i + 20, j, k + 2), new PositionData(12, 12, 12))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -57,24 +62,145 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
int y = j;
|
||||
int z = k;
|
||||
|
||||
x = i + 20;
|
||||
y = j;
|
||||
z = k + 2;
|
||||
int rooms = random.nextInt(4);
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 12, 12))) {
|
||||
return true;
|
||||
}
|
||||
switch (rooms)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
//EAST
|
||||
x = i + 20;
|
||||
y = j;
|
||||
z = k + 2;
|
||||
|
||||
setBlocks(this.mainBlock(), this.mainLightBlock(), 20);
|
||||
addHollowBox(world, random, new PositionData(x, y, z), new PositionData(12, 12, 12));
|
||||
if (!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 12, 12))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
setBlocks(this.mainBlock(), this.mainLightBlock(), 20);
|
||||
addHollowBox(world, random, new PositionData(x, y, z), new PositionData(12, 12, 12));
|
||||
|
||||
addSquareTube(world, random, new PositionData(x - 5, y, z + 3), new PositionData(6, 6, 6), 0);
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
|
||||
for (int p = x + 2; p < x + 10; p += 3) {
|
||||
for (int q = z + 2; q < z + 10; q += 3) {
|
||||
world.setBlock(p, j, q, BlocksAether.carved_trap, 0, 2);
|
||||
addSquareTube(world, random, new PositionData(x - 5, y, z + 3), new PositionData(6, 6, 6), 0);
|
||||
|
||||
for (int p = x + 2; p < x + 10; p += 3) {
|
||||
for (int q = z + 2; q < z + 10; q += 3) {
|
||||
world.setBlock(p, j, q, BlocksAether.carved_trap, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
x = pos.getX() + 20;
|
||||
y = pos.getY();
|
||||
z = pos.getZ() + 2;
|
||||
|
||||
if(!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 12, 12)) || isSpaceTaken(world, new PositionData(x, y, z), new PositionData(12, 12, 12)))
|
||||
{
|
||||
this.placementStorage.clear();
|
||||
this.replacementStorage.clear();
|
||||
slider.setDead();
|
||||
return false;
|
||||
}
|
||||
|
||||
setBlocks(this.mainBlock(), this.mainLightBlock(), 20);
|
||||
addHollowBox(world, random, new PositionData(x, y, z), new PositionData(12, 12, 12));
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
|
||||
addSquareTube(world, random, new PositionData(x - 5, y, z + 3), new PositionData(6, 6, 6), 0);
|
||||
|
||||
for(int p = x + 2; p < x + 10; p += 3)
|
||||
{
|
||||
for(int q = z + 2; q < z + 10; q += 3)
|
||||
{
|
||||
if (this.placementStorage.get(new BlockPos.MutableBlockPos().setPos(p, pos.getY(), q)) != Blocks.AIR && this.placementStorage.get(new BlockPos.MutableBlockPos().setPos(p, pos.getY(), q)) != null)
|
||||
{
|
||||
this.storeReplacementBlock(world, new BlockPos(p, pos.getY(), q), BlocksAether.dungeon_trap.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
*/
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
//WEST
|
||||
x = i - 16;
|
||||
y = j;
|
||||
z = k + 2;
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 12, 12))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
setBlocks(this.mainBlock(), this.mainLightBlock(), 20);
|
||||
addHollowBox(world, random, new PositionData(x, y, z), new PositionData(12, 12, 12));
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
|
||||
addSquareTube(world, random, new PositionData(x + 11, y, z + 3), new PositionData(6, 6, 6), 0);
|
||||
|
||||
for (int p = x + 2; p < x + 10; p += 3) {
|
||||
for (int q = z + 2; q < z + 10; q += 3) {
|
||||
world.setBlock(p, j, q, BlocksAether.carved_trap, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
//SOUTH
|
||||
x = i + 2;
|
||||
y = j;
|
||||
z = k + 20;
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 12, 12))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
setBlocks(this.mainBlock(), this.mainLightBlock(), 20);
|
||||
addHollowBox(world, random, new PositionData(x, y, z), new PositionData(12, 12, 12));
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
|
||||
addSquareTube(world, random, new PositionData(x + 3, y, z - 5), new PositionData(6, 6, 6), 2);
|
||||
|
||||
for (int p = x + 2; p < x + 10; p += 3) {
|
||||
for (int q = z + 2; q < z + 10; q += 3) {
|
||||
world.setBlock(p, j, q, BlocksAether.carved_trap, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
//NORTH
|
||||
x = i + 2;
|
||||
y = j;
|
||||
z = k - 16;
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 12, 12))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
setBlocks(this.mainBlock(), this.mainLightBlock(), 20);
|
||||
addHollowBox(world, random, new PositionData(x, y, z), new PositionData(12, 12, 12));
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
|
||||
addSquareTube(world, random, new PositionData(x + 3, y, z + 11), new PositionData(6, 6, 6), 2);
|
||||
|
||||
for (int p = x + 2; p < x + 10; p += 3) {
|
||||
for (int q = z + 2; q < z + 10; q += 3) {
|
||||
world.setBlock(p, j, q, BlocksAether.carved_trap, 0, 2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,15 +209,20 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
generateNextRoom(world, random, new PositionData(x, y, z));
|
||||
generateNextRoom(world, random, new PositionData(x, y, z));
|
||||
|
||||
if (n > numRooms || !finished) {
|
||||
if (needsCorridor)
|
||||
{
|
||||
System.out.println("called 1");
|
||||
endCorridor(world, random, new PositionData(x, y, z));
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean generateNextRoom(World world, Random random, PositionData pos) {
|
||||
if (n > numRooms && !finished) {
|
||||
if (needsCorridor)
|
||||
{
|
||||
System.out.println("called 2");
|
||||
endCorridor(world, random, pos);
|
||||
return false;
|
||||
}
|
||||
|
@ -116,6 +247,7 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
}
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x, y, z), new PositionData(12, 8, 12))) {
|
||||
this.needsCorridor = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -185,101 +317,290 @@ public class BronzeDungeon extends AetherDungeon {
|
|||
|
||||
n++;
|
||||
|
||||
if (!generateNextRoom(world, random, new PositionData(x, y, z))) {
|
||||
if(!generateNextRoom(world, random, new PositionData(x, y, z)))
|
||||
{
|
||||
System.out.println("called 3");
|
||||
this.needsCorridor = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return generateNextRoom(world, random, new PositionData(x, y, z));
|
||||
}
|
||||
|
||||
public void endCorridor(World world, Random random, PositionData pos) {
|
||||
public boolean endCorridor(World world, Random random, PositionData pos)
|
||||
{
|
||||
ArrayList<Integer> sides = new ArrayList<>();
|
||||
sides.add(1);
|
||||
sides.add(2);
|
||||
sides.add(3);
|
||||
sides.add(4);
|
||||
|
||||
Collections.shuffle(sides);
|
||||
|
||||
if (generateEndCorridor(world, random, pos, sides.get(0)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (generateEndCorridor(world, random, pos, sides.get(1)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (generateEndCorridor(world, random, pos, sides.get(2)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (generateEndCorridor(world, random, pos, sides.get(3)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean generateEndCorridor(World world, Random random, PositionData pos, int switchCase)
|
||||
{
|
||||
replaceAir = false;
|
||||
boolean tunnelling = true;
|
||||
boolean flag;
|
||||
int dir = random.nextInt(3);
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
if (dir == 0) {
|
||||
x += 11;
|
||||
z += 3;
|
||||
|
||||
while (tunnelling) {
|
||||
if (isBoxEmpty(world, new PositionData(x, y, z), new PositionData(1, 8, 6)) || x - pos.getX() > 100) {
|
||||
tunnelling = false;
|
||||
switch (switchCase)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
//EAST
|
||||
|
||||
boolean tunnelling = true;
|
||||
boolean maxLength = false;
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
||||
x += 11;
|
||||
z += 3;
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x + 1, y, z), new PositionData(2, 8, 6)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
flag = true;
|
||||
System.out.println("east");
|
||||
|
||||
while (flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) {
|
||||
if (world.getBlock(x + 1, y, z) == this.mainBlock() || world.getBlock(x + 1, y, z) == this.lockedBlock() || world.getBlock(x + 1, y, z) == this.lockedLightBlock() || world.getBlock(x + 1, y, z) == this.mainLightBlock()) {
|
||||
x++;
|
||||
} else {
|
||||
flag = false;
|
||||
while(tunnelling)
|
||||
{
|
||||
if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(1, 8, 6)))
|
||||
{
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
if (hasBlock(world, new PositionData(x + 1, y, z), new PositionData(2, 8, 6), BlocksAether.carved_stone)
|
||||
|| hasBlock(world, new PositionData(x + 1, y, z), new PositionData(2, 8, 6), BlocksAether.locked_carved_stone))
|
||||
{
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
if (x - pos.getX() > 100)
|
||||
{
|
||||
maxLength = true;
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
addPlaneX(world, random, new PositionData(x, y, z), new PositionData(0, 8, 6));
|
||||
|
||||
setBlocks(Blocks.air, Blocks.air, 1);
|
||||
addPlaneX(world, random, new PositionData(x, y + 1, z + 1), new PositionData(0, 6, 4));
|
||||
|
||||
x++;
|
||||
}
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
if (maxLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
addPlaneX(world, random, new PositionData(x, y, z), new PositionData(0, 8, 6));
|
||||
setBlocks(Blocks.air, Blocks.air, 1);
|
||||
addPlaneX(world, random, new PositionData(x, y + 1, z + 1), new PositionData(0, 6, 4));
|
||||
x++;
|
||||
this.hasCorridor = true;
|
||||
this.needsCorridor = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
//WEST
|
||||
|
||||
boolean tunnelling = true;
|
||||
boolean maxLength = false;
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
||||
x -= 0;
|
||||
z += 3;
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x - 1, y, z), new PositionData(1, 8, 6)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
System.out.println("west");
|
||||
|
||||
while(tunnelling)
|
||||
{
|
||||
if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(1, 8, 6)))
|
||||
{
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
if (hasBlock(world, new PositionData(x - 1, y, z), new PositionData(1, 8, 6), BlocksAether.carved_stone)
|
||||
|| hasBlock(world, new PositionData(x - 1, y, z), new PositionData(1, 8, 6), BlocksAether.locked_carved_stone))
|
||||
{
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
if (pos.getX() - x > 100)
|
||||
{
|
||||
maxLength = true;
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
addPlaneX(world, random, new PositionData(x, y, z), new PositionData(0, 8, 6));
|
||||
|
||||
setBlocks(Blocks.air, Blocks.air, 1);
|
||||
addPlaneX(world, random, new PositionData(x, y + 1, z + 1), new PositionData(0, 6, 4));
|
||||
|
||||
x--;
|
||||
}
|
||||
|
||||
if (maxLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.hasCorridor = true;
|
||||
this.needsCorridor = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
//SOUTH
|
||||
// BUGGED
|
||||
|
||||
boolean tunnelling = true;
|
||||
boolean maxLength = false;
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
||||
x += 3;
|
||||
z += 11;
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x, y, z + 1), new PositionData(6, 8, 2)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
System.out.println("south");
|
||||
|
||||
while(tunnelling)
|
||||
{
|
||||
if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)))
|
||||
{
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
if (hasBlock(world, new PositionData(x, y, z + 1), new PositionData(6, 8, 2), BlocksAether.carved_stone)
|
||||
|| hasBlock(world, new PositionData(x, y, z + 1), new PositionData(6, 8, 2), BlocksAether.locked_carved_stone))
|
||||
{
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
if (z - pos.getZ() > 100)
|
||||
{
|
||||
maxLength = true;
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
addPlaneZ(world, random, new PositionData(x, y, z), new PositionData(6, 8, 0));
|
||||
|
||||
setBlocks(Blocks.air, Blocks.air, 1);
|
||||
addPlaneZ(world, random, new PositionData(x + 1, y + 1, z), new PositionData(4, 6, 0));
|
||||
|
||||
z++;
|
||||
}
|
||||
|
||||
if (maxLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.hasCorridor = true;
|
||||
this.needsCorridor = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
//NORTH
|
||||
|
||||
boolean tunnelling = true;
|
||||
boolean maxLength = false;
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
||||
x += 3;
|
||||
z -= 0;
|
||||
|
||||
if (!isBoxSolid(world, new PositionData(x, y, z - 1), new PositionData(6, 8, 1)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
System.out.println("north");
|
||||
|
||||
while(tunnelling)
|
||||
{
|
||||
if(isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)))
|
||||
{
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
if (hasBlock(world, new PositionData(x, y, z - 1), new PositionData(6, 8, 1), BlocksAether.carved_stone)
|
||||
|| hasBlock(world, new PositionData(x, y, z - 1), new PositionData(6, 8, 1), BlocksAether.locked_carved_stone))
|
||||
{
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
if (pos.getZ() - z > 100)
|
||||
{
|
||||
maxLength = true;
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
addPlaneZ(world, random, new PositionData(x, y, z), new PositionData(6, 8, 0));
|
||||
|
||||
setBlocks(Blocks.air, Blocks.air, 1);
|
||||
addPlaneZ(world, random, new PositionData(x + 1, y + 1, z), new PositionData(4, 6, 0));
|
||||
|
||||
z--;
|
||||
}
|
||||
|
||||
if (maxLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this.hasCorridor = true;
|
||||
this.needsCorridor = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dir == 1) {
|
||||
x += 3;
|
||||
z += 11;
|
||||
while (tunnelling) {
|
||||
if (isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)) || z - pos.getZ() > 100) {
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
flag = true;
|
||||
|
||||
while (flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) {
|
||||
if (world.getBlock(x, y, z + 1) == this.mainBlock() || world.getBlock(x, y, z + 1) == this.lockedBlock() || world.getBlock(x, y, z + 1) == this.lockedLightBlock() || world.getBlock(x, y, z + 1) == this.mainLightBlock()) {
|
||||
z++;
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
addPlaneZ(world, random, new PositionData(x, y, z), new PositionData(6, 8, 0));
|
||||
setBlocks(Blocks.air, Blocks.air, 1);
|
||||
addPlaneZ(world, random, new PositionData(x + 1, y + 1, z), new PositionData(4, 6, 0));
|
||||
z++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dir == 2) {
|
||||
x += 3;
|
||||
z -= 0;
|
||||
while (tunnelling) {
|
||||
if (isBoxEmpty(world, new PositionData(x, y, z), new PositionData(6, 8, 1)) || pos.getY() - z > 100) {
|
||||
tunnelling = false;
|
||||
}
|
||||
|
||||
flag = true;
|
||||
|
||||
while (flag && (world.getBlock(x, y, z) == this.mainBlock() || world.getBlock(x, y, z) == this.lockedBlock() || world.getBlock(x, y, z) == this.lockedLightBlock() || world.getBlock(x, y, z) == this.mainLightBlock())) {
|
||||
if (world.getBlock(x, y, z - 1) == this.mainBlock() || world.getBlock(x, y, z - 1) == this.lockedBlock() || world.getBlock(x, y, z - 1) == this.lockedLightBlock() || world.getBlock(x, y, z - 1) == this.mainLightBlock()) {
|
||||
z--;
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
setBlocks(this.fillerBlock(), this.fillerBlock1(), 5);
|
||||
addPlaneZ(world, random, new PositionData(x, y, z), new PositionData(6, 8, 0));
|
||||
setBlocks(Blocks.air, Blocks.air, 1);
|
||||
addPlaneZ(world, random, new PositionData(x + 1, y + 1, z), new PositionData(4, 6, 0));
|
||||
z--;
|
||||
}
|
||||
}
|
||||
finished = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private ItemStack getNormalLoot(Random random) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.legacy.aether.world.dungeon.util;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import com.legacy.aether.blocks.BlocksAether;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -260,6 +261,22 @@ public abstract class AetherDungeon extends WorldGenerator {
|
|||
return flag;
|
||||
}
|
||||
|
||||
public boolean hasBlock(World world, PositionData pos, PositionData radius, Block block) {
|
||||
boolean flag = false;
|
||||
|
||||
for (int lineX = pos.getX(); lineX < pos.getX() + radius.getX(); lineX++) {
|
||||
for (int lineY = pos.getY(); lineY < pos.getY() + radius.getY(); lineY++) {
|
||||
for (int lineZ = pos.getZ(); lineZ < pos.getZ() + radius.getZ(); lineZ++) {
|
||||
if (world.getBlock(lineX, lineY, lineZ) == block) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
protected void setBlock(World world, Random random, int x, int y, int z, Block state, Block extraState, int chance) {
|
||||
if (random.nextInt(chance) == 0) {
|
||||
this.setBlockAndNotifyAdequately(world, x, y, z, extraState, 0);
|
||||
|
|
Loading…
Reference in a new issue