mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-21 04:32:29 +00:00
Ruin things... but only THAT bit.
This commit is contained in:
1 parent
ec09006587
commit
f1ae638bfd
2 files changed
+51
-12
No files matched your search
@@ -2,6 +2,7 @@ package fox.spiteful.avaritia.compat.botania.alfheim;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.compat.botania.alfheim.Ruin.BlockArray;
|
||||
import fox.spiteful.avaritia.compat.botania.alfheim.Ruin.BlockMeta;
|
||||
|
||||
@@ -34,22 +35,39 @@ public class ComponentCityParts {
|
||||
}
|
||||
this.genRand.setSeed(this.randSeed);
|
||||
|
||||
int border = 16;
|
||||
|
||||
int minx = Math.max(this.boundingBox.minX, bounds.minX - border);
|
||||
int maxx = Math.min(this.boundingBox.maxX, bounds.maxX + border);
|
||||
int minz = Math.max(this.boundingBox.minZ, bounds.minZ - border);
|
||||
int maxz = Math.min(this.boundingBox.maxZ, bounds.maxZ + border);
|
||||
|
||||
int xsize = this.boundingBox.getXSize();
|
||||
int ysize = this.boundingBox.getYSize();
|
||||
int zsize = this.boundingBox.getZSize();
|
||||
|
||||
BlockArray blocks = new BlockArray(xsize, ysize, zsize);
|
||||
int axsize = (maxx-minx)+1;
|
||||
int aysize = ysize;
|
||||
int azsize = (maxz-minz)+1;
|
||||
|
||||
blocks.fillBlocks(outline, 0, outline, xsize-outline-1, ysize, zsize-outline-1, new BlockMeta(Blocks.cobblestone, 0));
|
||||
int xoffset = minx - this.boundingBox.minX;
|
||||
int zoffset = minz - this.boundingBox.minZ;
|
||||
|
||||
new Ruin(blocks, 0.3 + this.genRand.nextDouble()*0.7, this.genRand);
|
||||
Lumberjack.info("xyz: "+this.boundingBox+", chunk: "+bounds+", size: "+xsize+","+ysize+","+zsize+", mxmy: "+minx+","+minz+"; "+maxx+","+maxz+", asize: "+axsize+","+aysize+","+azsize+", offset: "+xoffset+","+zoffset);
|
||||
|
||||
for (int x = 0; x<xsize; x++) {
|
||||
for (int y = 0; y<ysize; y++) {
|
||||
for (int z = 0; z<zsize; z++) {
|
||||
BlockArray blocks = new BlockArray(axsize, aysize, azsize);
|
||||
|
||||
blocks.fillBlocks(outline-xoffset, 0, outline-zoffset, (xsize-outline-1)-xoffset, ysize, (zsize-outline-1)-zoffset, new BlockMeta(Blocks.cobblestone, 0));
|
||||
//blocks.fillBlocks(-xoffset, 0, -zoffset, (xsize-1)-xoffset, ysize, (zsize-1)-zoffset, new BlockMeta(Blocks.cobblestone, 0));
|
||||
|
||||
new Ruin(blocks, 0.3 + this.genRand.nextDouble()*0.7, this.genRand, xsize,ysize,zsize, xoffset,0,zoffset);
|
||||
|
||||
for (int x = 0; x<axsize; x++) {
|
||||
for (int y = 0; y<aysize; y++) {
|
||||
for (int z = 0; z<azsize; z++) {
|
||||
BlockMeta block = blocks.getBlock(x, y, z);
|
||||
if (block != null) {
|
||||
this.placeBlockAtCurrentPosition(world, block.block, block.meta, x, y, z, bounds);
|
||||
this.placeBlockAtCurrentPosition(world, block.block, block.meta, x + xoffset, y, z + zoffset, bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +123,7 @@ public class ComponentCityParts {
|
||||
this.partSizeZ = tag.getInteger("Depth");
|
||||
this.partPosY = tag.getInteger("HPos");
|
||||
this.randSeed = tag.getLong("RSeed");
|
||||
this.genRand.setSeed(this.randSeed);
|
||||
this.genRand = new Random(this.randSeed);
|
||||
}
|
||||
|
||||
protected boolean processHeight(World world, StructureBoundingBox bounds, int offset)
|
||||
|
||||
@@ -17,25 +17,46 @@ public class Ruin {
|
||||
public Random rand;
|
||||
public BlockRuinPalette palette;
|
||||
|
||||
public int xSize;
|
||||
public int ySize;
|
||||
public int zSize;
|
||||
public int xOffset;
|
||||
public int yOffset;
|
||||
public int zOffset;
|
||||
|
||||
public Ruin(BlockArray blocks, double ruinLevel, Random rand) {
|
||||
this(blocks, ruinLevel, rand, new BlockRuinPalette());
|
||||
}
|
||||
public Ruin(BlockArray blocks, double ruinLevel, Random rand, BlockRuinPalette palette) {
|
||||
this (blocks, ruinLevel, rand, blocks.xSize, blocks.ySize, blocks.zSize, 0,0,0, palette);
|
||||
}
|
||||
public Ruin(BlockArray blocks, double ruinLevel, Random rand, int xSize, int ySize, int zSize, int xOffset, int yOffset, int zOffset) {
|
||||
this (blocks, ruinLevel, rand, xSize, ySize, zSize, xOffset,yOffset,zOffset, new BlockRuinPalette());
|
||||
}
|
||||
public Ruin(BlockArray blocks, double ruinLevel, Random rand, int xSize, int ySize, int zSize, int xOffset, int yOffset, int zOffset, BlockRuinPalette palette) {
|
||||
this.blocks = blocks;
|
||||
this.ruinLevel = ruinLevel;
|
||||
this.rand = rand;
|
||||
this.palette = palette;
|
||||
|
||||
int volume = this.blocks.length;
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.zSize = zSize;
|
||||
|
||||
this.xOffset = xOffset;
|
||||
this.yOffset = yOffset;
|
||||
this.zOffset = zOffset;
|
||||
|
||||
int volume = this.xSize * this.ySize * this.zSize;
|
||||
int breaks = (int) Math.ceil((volume/16.0) * ruinLevel);
|
||||
|
||||
for (int i=0; i<breaks; i++) {
|
||||
int x = rand.nextInt(blocks.xSize);
|
||||
int z = rand.nextInt(blocks.zSize);
|
||||
int x = rand.nextInt(this.xSize) - this.xOffset;
|
||||
int z = rand.nextInt(this.zSize) - this.zOffset;
|
||||
|
||||
double ylevel = 1 - (rand.nextDouble() * rand.nextDouble());
|
||||
|
||||
int y = (int) Math.round(ylevel * blocks.ySize);
|
||||
int y = (int) Math.round(ylevel * this.ySize) - this.yOffset;
|
||||
double rad = (6*rand.nextDouble() + 1)*ylevel*(0.1 + 0.9*ruinLevel) + 0.45 + (0.55*ruinLevel);
|
||||
|
||||
this.ruinArea(x, y, z, rad);
|
||||
|
||||
Reference in new issue
Block a user