From 4dadf0e2b5ecb7a2644e2feb71e3a7ab1194ec84 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Tue, 4 Dec 2012 18:33:44 -0600 Subject: Implement API for mob despawn when away from players. Adds BUKKIT-2986 As of 1.4 mobs have a flag to determine if they despawn when away from a player or not. Unfortunately animals still use their own system to prevent despawning instead of making use of this flag. This change modifies them to use the new system (defaults to true) and to add API for plugins to adjust this. --- src/main/java/net/minecraft/server/EntityLiving.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/net/minecraft/server') diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 362e3b39..fff17a2d 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -87,7 +87,7 @@ public abstract class EntityLiving extends Entity { public boolean bp = false; public int bq = 0; protected boolean canPickUpLoot = false; - private boolean persistent = false; + public boolean persistent = (this instanceof EntityAnimal); // CraftBukkit - private -> public, change value protected int bs; protected double bt; protected double bu; @@ -1394,11 +1394,11 @@ public abstract class EntityLiving extends Entity { double d2 = entityhuman.locZ - this.locZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; - if (this.bj() && d3 > 16384.0D) { + if (d3 > 16384.0D) { // CraftBukkit - remove this.bj() check this.die(); } - if (this.bA > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.bj()) { + if (this.bA > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove this.bj() check this.die(); } else if (d3 < 1024.0D) { this.bA = 0; -- cgit v1.2.3