I've been dealing with a world generation bug for several days and could not figure out why blocks were not being set in my custom BaseTerrainGenerator:
import nl.rutgerkok.worldgeneratorapi.BaseTerrainGenerator;
import nl.rutgerkok.worldgeneratorapi.BiomeGenerator;
import org.bukkit.Material;
public class TestGenerator implements BaseTerrainGenerator {
public TestGenerator(long unused) {
}
@Override
public void setBlocksInChunk(GeneratingChunk generatingChunk) {
for (int y = 0; y < 64; y++) {
for (int x = 0; x < CHUNK_SIZE; x++) {
for (int z = 0; z < CHUNK_SIZE; z++) {
// generatingChunk.getBlocksForChunk().getBlockData(x, y, z);
generatingChunk.getBlocksForChunk().setBlock(x, y, z, Material.TNT);
}
}
}
}
@Override
public int getHeight(BiomeGenerator biomeGenerator, int x, int z, HeightType type) {
return 64;
}
}
This is the result of the world generation on the current 1.2.2-SNAPSHOT:
After careful evaluation, i noticed that if I uncomment the getBlockData line, it works correctly.
I've been dealing with a world generation bug for several days and could not figure out why blocks were not being set in my custom BaseTerrainGenerator:
This is the result of the world generation on the current 1.2.2-SNAPSHOT:
After careful evaluation, i noticed that if I uncomment the
getBlockData
line, it works correctly.The respective line where
getBlockData
is called: https://github.com/rutgerkok/WorldGeneratorApi/blob/master/worldgeneratorapi-impl/src/main/java/nl/rutgerkok/worldgeneratorapi/internal/bukkitoverrides/ChunkDataImpl.java#L28setBlock
function call: https://github.com/rutgerkok/WorldGeneratorApi/blob/master/worldgeneratorapi-impl/src/main/java/nl/rutgerkok/worldgeneratorapi/internal/bukkitoverrides/ChunkDataImpl.java#L69By updating the function call in
setBlock
to match the above, the world generates correctly: