Browse Source

This should have the same effect.

GJ 12 years ago
parent
commit
d8904827ec
1 changed files with 1 additions and 15 deletions
  1. 1 15
      src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java

+ 1 - 15
src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java

@@ -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);
         }