This should have the same effect.

This commit is contained in:
GJ 2013-02-26 10:01:37 -05:00
parent f767edba93
commit d8904827ec

View File

@ -9,7 +9,6 @@ import com.gmail.nossr50.mcMMO;
public class TrackedEntity implements Runnable {
private LivingEntity livingEntity;
private int arrowCount;
private int previousTicksLived;
private int taskId;
private BukkitScheduler scheduler;
@ -19,19 +18,6 @@ public class TrackedEntity implements Runnable {
this.taskId = scheduler.scheduleSyncRepeatingTask(mcMMO.p, this, 12000, 12000);
}
//LivingEntity.isDead() isn't a reliable way to know if an entity is still active
//This method must not be called more than once per server tick
private boolean isActive() {
int currentTicksLived = livingEntity.getTicksLived();
if (currentTicksLived == previousTicksLived) {
return false;
}
previousTicksLived = currentTicksLived;
return true;
}
protected LivingEntity getLivingEntity() {
return livingEntity;
}
@ -46,7 +32,7 @@ public class TrackedEntity implements Runnable {
@Override
public void run() {
if (!isActive()) {
if (!livingEntity.isValid()) {
Archery.removeFromTracker(this);
scheduler.cancelTask(taskId);
}