mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
Avoid unnecessary iteration
This commit is contained in:
parent
68bf93d1ac
commit
032472dcb3
@ -24,16 +24,6 @@ public class Archery {
|
||||
public static final int DAZE_MAX_BONUS_LEVEL = 1000;
|
||||
public static final int DAZE_MODIFIER = 4;
|
||||
|
||||
protected static boolean arrowTrackerContains(LivingEntity livingEntity) {
|
||||
for (TrackedEntity trackedEntity : trackedEntities) {
|
||||
if (trackedEntity.getLivingEntity() == livingEntity) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
||||
for (TrackedEntity trackedEntity : trackedEntities) {
|
||||
if (trackedEntity.getLivingEntity() == livingEntity) {
|
||||
@ -41,6 +31,9 @@ public class Archery {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//If the entity isn't tracked yet
|
||||
addToTracker(livingEntity);
|
||||
}
|
||||
|
||||
protected static void addToTracker(LivingEntity livingEntity) {
|
||||
|
@ -22,11 +22,6 @@ public class ArrowTrackingEventHandler {
|
||||
}
|
||||
|
||||
protected void addToTracker() {
|
||||
if (Archery.arrowTrackerContains(entity)) {
|
||||
Archery.incrementTrackerValue(entity);
|
||||
}
|
||||
else {
|
||||
Archery.addToTracker(entity);
|
||||
}
|
||||
Archery.incrementTrackerValue(entity);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user