Skip to content

Commit

Permalink
clean up town generation, remove even skippable blocks from town area
Browse files Browse the repository at this point in the history
(not border).  Should resolve issues of trees generating inside of the
towns (or rather town not clearing out the trees that were in the
bounds)
  • Loading branch information
shadowmage45 committed Dec 23, 2014
1 parent c788ae4 commit 9bc0288
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void generateBorders(World world, TownGenerator gen)
for(int pz = gen.maximalBounds.min.z; pz <= gen.maximalBounds.max.z; pz++)
{
step = WorldStructureGenerator.getStepNumber(px, pz, eminx, emaxx, eminz, emaxz);
handleBorderBlock(world, px, pz, fillBase-step, levelBase+step, getFillBlock(world, px, pz, false, Blocks.dirt), getFillBlock(world, px, pz, true, Blocks.grass));
handleBorderBlock(world, px, pz, fillBase-step, levelBase+step, getFillBlock(world, px, pz, false, Blocks.dirt), getFillBlock(world, px, pz, true, Blocks.grass), true);
}
}

Expand All @@ -42,7 +42,7 @@ public static void generateBorders(World world, TownGenerator gen)
for(int pz = gen.maximalBounds.min.z; pz <= gen.maximalBounds.max.z; pz++)
{
step = WorldStructureGenerator.getStepNumber(px, pz, eminx, emaxx, eminz, emaxz);
handleBorderBlock(world, px, pz, fillBase-step, levelBase+step, getFillBlock(world, px, pz, false, Blocks.dirt), getFillBlock(world, px, pz, true, Blocks.grass));
handleBorderBlock(world, px, pz, fillBase-step, levelBase+step, getFillBlock(world, px, pz, false, Blocks.dirt), getFillBlock(world, px, pz, true, Blocks.grass), true);
}
}

Expand All @@ -53,7 +53,7 @@ public static void generateBorders(World world, TownGenerator gen)
for(int px = gen.maximalBounds.min.x; px <= gen.maximalBounds.max.x; px++)
{
step = WorldStructureGenerator.getStepNumber(px, pz, eminx, emaxx, eminz, emaxz);
handleBorderBlock(world, px, pz, fillBase-step, levelBase+step, getFillBlock(world, px, pz, false, Blocks.dirt), getFillBlock(world, px, pz, true, Blocks.grass));
handleBorderBlock(world, px, pz, fillBase-step, levelBase+step, getFillBlock(world, px, pz, false, Blocks.dirt), getFillBlock(world, px, pz, true, Blocks.grass), true);
}
}

Expand All @@ -64,7 +64,7 @@ public static void generateBorders(World world, TownGenerator gen)
for(int px = gen.maximalBounds.min.x; px <= gen.maximalBounds.max.x; px++)
{
step = WorldStructureGenerator.getStepNumber(px, pz, eminx, emaxx, eminz, emaxz);
handleBorderBlock(world, px, pz, fillBase-step, levelBase+step, getFillBlock(world, px, pz, false, Blocks.dirt), getFillBlock(world, px, pz, true, Blocks.grass));
handleBorderBlock(world, px, pz, fillBase-step, levelBase+step, getFillBlock(world, px, pz, false, Blocks.dirt), getFillBlock(world, px, pz, true, Blocks.grass), true);
}
}
}
Expand All @@ -80,15 +80,15 @@ public static void levelTownArea(World world, TownGenerator gen)
{
for(int z = minZ; z<=maxZ; z++)
{
handleBorderBlock(world, x, z, desiredTopBlockHeight, desiredTopBlockHeight, getFillBlock(world, x, z, false, Blocks.grass), getFillBlock(world, x, z, true, Blocks.grass));
handleBorderBlock(world, x, z, desiredTopBlockHeight, desiredTopBlockHeight, getFillBlock(world, x, z, false, Blocks.grass), getFillBlock(world, x, z, true, Blocks.grass), false);
world.setBlock(x, desiredTopBlockHeight-5, z, Blocks.cobblestone);
}
}
}

private static void handleBorderBlock(World world, int x, int z, int fillLevel, int cutLevel, Block fillBlock, Block topBlock)
private static void handleBorderBlock(World world, int x, int z, int fillLevel, int cutLevel, Block fillBlock, Block topBlock, boolean skippables)
{
int y = getTopFilledHeight(world.getChunkFromBlockCoords(x, z), x&15, z&15, true);
int y = getTopFilledHeight(world.getChunkFromBlockCoords(x, z), x&15, z&15, skippables);
if(y >= cutLevel)
{
for(int py = world.provider.getActualHeight(); py > cutLevel; py--){world.setBlockToAir(x, py, z);}
Expand Down

0 comments on commit 9bc0288

Please sign in to comment.