diff options
Diffstat (limited to 'src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index 573710fd..1f47e189 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java @@ -2,10 +2,16 @@ package org.bukkit.craftbukkit.generator; import java.util.List; import java.util.Random; +import net.minecraft.server.BiomeBase; import net.minecraft.server.Chunk; +import net.minecraft.server.ChunkCoordIntPair; +import net.minecraft.server.ChunkPosition; +import net.minecraft.server.EnumCreatureType; import net.minecraft.server.IChunkProvider; import net.minecraft.server.IProgressUpdate; import net.minecraft.server.World; +import net.minecraft.server.WorldChunkManager; +import net.minecraft.server.WorldGenStronghold; import net.minecraft.server.WorldServer; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; @@ -14,6 +20,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { private final ChunkGenerator generator; private final WorldServer world; private final Random random; + private final WorldGenStronghold strongholdGen = new WorldGenStronghold(); public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) { this.world = (WorldServer) world; @@ -61,11 +68,29 @@ public class CustomChunkGenerator extends InternalChunkGenerator { return getOrCreateChunk(x, z); } + @Override public boolean canSpawn(org.bukkit.World world, int x, int z) { return generator.canSpawn(world, x, z); } + @Override public List<BlockPopulator> getDefaultPopulators(org.bukkit.World world) { return generator.getDefaultPopulators(world); } + + public List a(EnumCreatureType type, int x, int y, int z) { + WorldChunkManager worldchunkmanager = world.getWorldChunkManager(); + + if (worldchunkmanager == null) { + return null; + } else { + BiomeBase biomebase = worldchunkmanager.a(new ChunkCoordIntPair(x >> 4, z >> 4)); + + return biomebase == null ? null : biomebase.a(type); + } + } + + public ChunkPosition a(World world, String type, int x, int y, int z) { + return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.a(world, x, y, z) : null; + } } |