1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion.git synced 2025-04-10 20:15:42 +02:00

Prepare end territory generator and StructureWorld for debugging

This commit is contained in:
chylex 2015-11-10 02:27:42 +01:00
parent 93de46893c
commit 21b1aad13b
3 changed files with 27 additions and 8 deletions
src/main/java/chylex/hee/world

View File

@ -49,9 +49,9 @@ public enum EndTerritory{
}
/**
* Preloads required chunks and generates the territory in a specified location.
* Preloads required chunks and generates the territory in a specified location. For {@code useChunkDirectly}, see {@link StructureWorld#generateInWorld(World,Random,int,int,int,boolean)}.
*/
public void generateTerritory(ChunkCoordIntPair startPoint, World world, Random rand){
public void generateTerritory(ChunkCoordIntPair startPoint, World world, Random rand, boolean useChunkDirectly){
for(int chunkX = 0; chunkX < chunkSize; chunkX++){
for(int chunkZ = 0; chunkZ < chunkSize; chunkZ++){
world.getChunkFromChunkCoords(startPoint.chunkXPos+chunkX,startPoint.chunkZPos+chunkZ);
@ -60,14 +60,14 @@ public enum EndTerritory{
StructureWorld structureWorld = createWorld(world);
constructor.construct(structureWorld,rand).generate();
structureWorld.generateInWorld(world,rand,16*startPoint.chunkXPos+structureWorld.getArea().x2,info.getBottomY(rand),16*startPoint.chunkZPos+structureWorld.getArea().z2);
structureWorld.generateInWorld(world,rand,16*startPoint.chunkXPos+structureWorld.getArea().x2,info.getBottomY(rand),16*startPoint.chunkZPos+structureWorld.getArea().z2,true);
}
/**
* Preloads required chunks and generates the territory using the custom index based distribution system.
*/
public void generateTerritory(int index, World world, Random rand){
generateTerritory(getStartPoint(index),world,rand);
generateTerritory(getStartPoint(index),world,rand,false);
}
public static final int chunksBetween = 64; // 1024 blocks
@ -77,7 +77,8 @@ public enum EndTerritory{
public static final HeeTest $debugTest = new HeeTest(){
@Override
public void run(String...args){
THE_HUB.generateTerritory(0,world,world.rand);
TerritoryTheHub.$regenerate = true;
THE_HUB.generateTerritory(THE_HUB.getStartPoint(0),world,new Random(world.getSeed()),true);
}
};
}

View File

@ -7,6 +7,8 @@ import chylex.hee.world.feature.noise.GenerateIslandNoise;
import chylex.hee.world.structure.StructureWorld;
public class TerritoryTheHub extends TerritoryGenerator{
public static boolean $regenerate = false; // TODO remove
private final GenerateIslandNoise island;
public TerritoryTheHub(StructureWorld world, Random rand){
@ -16,9 +18,19 @@ public class TerritoryTheHub extends TerritoryGenerator{
@Override
public void generate(){
if ($regenerate){
for(int x = -size; x < size; x++){
for(int z = -size; z < size; z++){
for(int y = 0; y < height; y++){
world.setAir(x,y,z);
}
}
}
}
island.generate(world);
int lowest = 128;
int lowest = height;
for(int x = -1; x <= 1; x++){
for(int z = -1; z <= 1; z++){
@ -29,6 +41,10 @@ public class TerritoryTheHub extends TerritoryGenerator{
for(int x = -1; x <= 1; x++){
for(int z = -1; z <= 1; z++){
world.setBlock(x,lowest,z,Blocks.end_portal,Meta.endPortalActive);
for(int y = lowest+1; y < height; y++){
if (!world.isAir(x,y,z))world.setAir(x,y,z);
}
}
}
}

View File

@ -218,8 +218,10 @@ public final class StructureWorld{
for(y = 0; y < sizeY; y++){
if (blocks[++index] != null){
pos.set(centerX+x,bottomY+y,centerZ+z);
world.getChunkFromBlockCoords(pos.x,pos.z).func_150807_a(pos.x&15,pos.y,pos.z&15,blocks[index],metadata[index]);
world.markBlockForUpdate(pos.x,pos.y,pos.z); // TODO optimize
if (world.getChunkFromBlockCoords(pos.x,pos.z).func_150807_a(pos.x&15,pos.y,pos.z&15,blocks[index],metadata[index])){
world.markBlockForUpdate(pos.x,pos.y,pos.z); // TODO optimize
}
}
}
}