summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/World.java
diff options
context:
space:
mode:
authorDinnerbone <dinnerbone@dinnerbone.com>2011-06-06 14:52:02 +0100
committerDinnerbone <dinnerbone@dinnerbone.com>2011-06-06 18:38:47 +0100
commitfedcbdf256e29df3300639e4a9fa97fd04cd4108 (patch)
treeb4de9c3979cc0dae2487e427d38a9c776e9d3073 /src/main/java/net/minecraft/server/World.java
parent891dfbcef8c98faec837fc7f3fa31eac5505b6f9 (diff)
downloadcraftbukkit-fedcbdf256e29df3300639e4a9fa97fd04cd4108.tar
craftbukkit-fedcbdf256e29df3300639e4a9fa97fd04cd4108.tar.gz
craftbukkit-fedcbdf256e29df3300639e4a9fa97fd04cd4108.tar.lz
craftbukkit-fedcbdf256e29df3300639e4a9fa97fd04cd4108.tar.xz
craftbukkit-fedcbdf256e29df3300639e4a9fa97fd04cd4108.zip
Implemented custom chunk generators and block populators
Diffstat (limited to 'src/main/java/net/minecraft/server/World.java')
-rw-r--r--src/main/java/net/minecraft/server/World.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a5f954b2..259ccdcf 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -9,6 +9,7 @@ import java.util.Set;
import java.util.TreeSet;
// CraftBukkit start
+import org.bukkit.generator.ChunkGenerator;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -65,12 +66,17 @@ public class World implements IBlockAccess {
private int O;
private List P;
public boolean isStatic;
+ public ChunkGenerator generator; // Craftbukkit
public WorldChunkManager getWorldChunkManager() {
return this.worldProvider.b;
}
- public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider) {
+ // Craftbukkit start - changed signature
+ public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider, ChunkGenerator gen) {
+ this.generator = gen;
+ // Craftbukkit end
+
this.O = this.random.nextInt(12000);
this.P = new ArrayList();
this.isStatic = false;
@@ -118,7 +124,8 @@ public class World implements IBlockAccess {
int j;
- for (j = 0; !this.worldProvider.a(i, j); j += this.random.nextInt(64) - this.random.nextInt(64)) {
+ // Craftbukkit
+ for (j = 0; !canSpawn(i, j); j += this.random.nextInt(64) - this.random.nextInt(64)) {
i += this.random.nextInt(64) - this.random.nextInt(64);
}
@@ -126,6 +133,16 @@ public class World implements IBlockAccess {
this.isLoading = false;
}
+ // Craftbukkit start
+ private boolean canSpawn(int x, int z) {
+ if (generator != null) {
+ return this.generator.canSpawn(((WorldServer)this).getWorld(), x, z);
+ } else {
+ return this.worldProvider.a(x, z);
+ }
+ }
+ // Craftbukkit end
+
public int a(int i, int j) {
int k;