Skip to content

Commit

Permalink
Fix heightmap being broken in slimeisland chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Oct 4, 2015
1 parent 9587a5f commit cc29ab0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/tconstruct/world/gen/SlimeIslandGen.java
@@ -1,12 +1,16 @@
package tconstruct.world.gen;

import com.google.common.collect.Sets;
import cpw.mods.fml.common.IWorldGenerator;
import java.awt.geom.Ellipse2D;
import java.util.Random;
import java.util.Set;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.*;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderFlat;
import net.minecraft.world.gen.feature.WorldGenerator;
Expand Down Expand Up @@ -57,6 +61,8 @@ public void generateIsland (World world, Random rand, int xChunk, int zChunk)
int initialHeight = height;
Ellipse2D.Double ellipse = new Ellipse2D.Double(0, 0, xRange, zRange);

Set<Chunk> chunks = Sets.newHashSet();

// Basic shape
for (int x = 0; x <= xRange; x++)
{
Expand All @@ -65,7 +71,10 @@ public void generateIsland (World world, Random rand, int xChunk, int zChunk)
for (int y = 0; y <= height; y++)
{
if (ellipse.contains(x, z))
{
world.setBlock(x + xChunk, y + yCenter, z + zChunk, base, 5, 0);
chunks.add(world.getChunkFromBlockCoords(x + xChunk, z + zChunk));
}
}
}
}
Expand Down Expand Up @@ -148,6 +157,11 @@ public void generateIsland (World world, Random rand, int xChunk, int zChunk)
{
trees.generate(world, random, xChunk + random.nextInt(xRange), yCenter + initialHeight + 3, zChunk + random.nextInt(zRange));
}

// fix heightmap
for(Chunk chunk : chunks) {
chunk.generateSkylightMap();
}
}

public void generateSlimePool (World world, Random rand, int x, int y, int z)
Expand Down

0 comments on commit cc29ab0

Please sign in to comment.