diff options
author | Mike Primm <mike@primmhome.com> | 2012-03-20 15:02:02 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-22 02:34:41 -0400 |
commit | 6cd2a708031efd147ad6abf435f08ac49399ebf0 (patch) | |
tree | 9517cac04e77906c4a98fff0c8324234f915efd4 /src/main/java/net/minecraft/server/ChunkProviderFlat.java | |
parent | 0a925ff067c6230554c4336627f621decfcd1e79 (diff) | |
download | craftbukkit-6cd2a708031efd147ad6abf435f08ac49399ebf0.tar craftbukkit-6cd2a708031efd147ad6abf435f08ac49399ebf0.tar.gz craftbukkit-6cd2a708031efd147ad6abf435f08ac49399ebf0.tar.lz craftbukkit-6cd2a708031efd147ad6abf435f08ac49399ebf0.tar.xz craftbukkit-6cd2a708031efd147ad6abf435f08ac49399ebf0.zip |
Added for diff visibility:
- ChunkProviderGenerate
- ChunkProviderFlat
- ChunkProviderHell
- ChunkProviderTheEnd
Diffstat (limited to 'src/main/java/net/minecraft/server/ChunkProviderFlat.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ChunkProviderFlat.java | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java new file mode 100644 index 00000000..7b51bf03 --- /dev/null +++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java @@ -0,0 +1,95 @@ +package net.minecraft.server; + +import java.util.List; +import java.util.Random; + +public class ChunkProviderFlat implements IChunkProvider { + + private World a; + private Random b; + private final boolean c; + private WorldGenVillage d = new WorldGenVillage(1); + + public ChunkProviderFlat(World world, long i, boolean flag) { + this.a = world; + this.c = flag; + this.b = new Random(i); + } + + private void a(byte[] abyte) { + int i = abyte.length / 256; + + for (int j = 0; j < 16; ++j) { + for (int k = 0; k < 16; ++k) { + for (int l = 0; l < i; ++l) { + int i1 = 0; + + if (l == 0) { + i1 = Block.BEDROCK.id; + } else if (l <= 2) { + i1 = Block.DIRT.id; + } else if (l == 3) { + i1 = Block.GRASS.id; + } + + abyte[j << 11 | k << 7 | l] = (byte) i1; + } + } + } + } + + public Chunk getChunkAt(int i, int j) { + return this.getOrCreateChunk(i, j); + } + + public Chunk getOrCreateChunk(int i, int j) { + byte[] abyte = new byte['\u8000']; + + this.a(abyte); + Chunk chunk = new Chunk(this.a, abyte, i, j); + + if (this.c) { + this.d.a(this, this.a, i, j, abyte); + } + + chunk.initLighting(); + return chunk; + } + + public boolean isChunkLoaded(int i, int j) { + return true; + } + + public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) { + this.b.setSeed(this.a.getSeed()); + long k = this.b.nextLong() / 2L * 2L + 1L; + long l = this.b.nextLong() / 2L * 2L + 1L; + + this.b.setSeed((long) i * k + (long) j * l ^ this.a.getSeed()); + if (this.c) { + this.d.a(this.a, this.b, i, j); + } + } + + public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { + return true; + } + + public boolean unloadChunks() { + return false; + } + + public boolean canSave() { + return true; + } + + public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) { + BiomeBase biomebase = this.a.getBiome(i, k); + + return biomebase == null ? null : biomebase.getMobs(enumcreaturetype); + } + + public ChunkPosition findNearestMapFeature(World world, String s, int i, int j, int k) { + return null; + } +} |