summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-02-13 01:21:50 +0100
committerErik Broes <erikbroes@grum.nl>2011-02-13 01:21:50 +0100
commit40f7986a110c31d857d2cc7a7f7a802e619faf99 (patch)
treedf9393254aed85d2f9c24635cec04a7681a0c036 /src/main/java/net
parentf789c9e744ca0fdb6f8cbb1afb71bd94f03406ec (diff)
downloadcraftbukkit-40f7986a110c31d857d2cc7a7f7a802e619faf99.tar
craftbukkit-40f7986a110c31d857d2cc7a7f7a802e619faf99.tar.gz
craftbukkit-40f7986a110c31d857d2cc7a7f7a802e619faf99.tar.lz
craftbukkit-40f7986a110c31d857d2cc7a7f7a802e619faf99.tar.xz
craftbukkit-40f7986a110c31d857d2cc7a7f7a802e619faf99.zip
Make the spawning listen to the server spawn-settings
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/EntityEgg.java8
-rw-r--r--src/main/java/net/minecraft/server/TileEntityMobSpawner.java7
-rw-r--r--src/main/java/net/minecraft/server/World.java10
-rw-r--r--src/main/java/net/minecraft/server/WorldServer.java8
4 files changed, 25 insertions, 8 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java
index e7f542af..adb823e1 100644
--- a/src/main/java/net/minecraft/server/EntityEgg.java
+++ b/src/main/java/net/minecraft/server/EntityEgg.java
@@ -245,8 +245,12 @@ public class EntityEgg extends Entity {
break;
}
- entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
- this.world.a(entity);
+ // The world we're spawning in accepts this creature
+ boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal;
+ if ((isAnimal && this.world.L) || (!isAnimal && this.world.K)) {
+ entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
+ this.world.a(entity);
+ }
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
index 52f8a302..a52e8aa3 100644
--- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
+++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
@@ -49,6 +49,13 @@ public class TileEntityMobSpawner extends TileEntity {
return;
}
+ // CraftBukkit start - The world we're spawning in accepts this creature
+ boolean isAnimal = entityliving instanceof EntityAnimal || entityliving instanceof EntityWaterAnimal;
+ if ((isAnimal && !this.a.L) || (!isAnimal && !this.a.K)) {
+ return;
+ }
+ // CraftBukkit end
+
int j = this.a.a(entityliving.getClass(), AxisAlignedBB.b((double) this.b, (double) this.c, (double) this.d, (double) (this.b + 1), (double) (this.c + 1), (double) (this.d + 1)).b(8.0D, 4.0D, 8.0D)).size();
if (j >= 6) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9a1c5a28..02c5be83 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -61,8 +61,8 @@ public class World implements IBlockAccess {
public boolean x;
private ArrayList I = new ArrayList();
private int J = 0;
- private boolean K = true;
- private boolean L = true;
+ public boolean K = true; // CraftBukkit private->public
+ public boolean L = true; // CraftBukkit private->public
static int y = 0;
private Set M = new HashSet();
private int N;
@@ -1439,7 +1439,11 @@ public class World implements IBlockAccess {
}
public void f() {
- SpawnerCreature.a(this, this.K, this.L);
+ // CraftBukkit start -- Only call spawner if we have players online and the world allows for mobs or animals
+ if ((this.K || this.L) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().b.size() > 0))
+ SpawnerCreature.a(this, this.K, this.L);
+ // CraftBukkit end
+
this.G.a();
int i = this.a(1.0F);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index f20b51f1..7a29714f 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -47,9 +47,11 @@ public class WorldServer extends World implements BlockChangeDelegate {
}
public void a(Entity entity, boolean flag) {
- if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
- entity.q();
- }
+ // CraftBukkit start -- We prevent spawning in general, so this butching is not needed
+ //if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
+ // entity.q();
+ //}
+ // CraftBukkit end
if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
super.a(entity, flag);