Update CraftBukkit to Minecraft 1.7.2
This commit is contained in:
@@ -4,37 +4,41 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import org.bukkit.craftbukkit.util.UnsafeList; // CraftBukkit
|
||||
|
||||
public class PathfinderGoalSelector {
|
||||
|
||||
private static final Logger a = LogManager.getLogger();
|
||||
// CraftBukkit start - ArrayList -> UnsafeList
|
||||
private List a = new UnsafeList();
|
||||
private List b = new UnsafeList();
|
||||
private List c = new UnsafeList();
|
||||
// CraftBukkit end
|
||||
private final MethodProfiler c;
|
||||
private int d;
|
||||
private int e = 3;
|
||||
private final MethodProfiler d;
|
||||
private int e;
|
||||
private int f = 3;
|
||||
|
||||
public PathfinderGoalSelector(MethodProfiler methodprofiler) {
|
||||
this.c = methodprofiler;
|
||||
this.d = methodprofiler;
|
||||
}
|
||||
|
||||
public void a(int i, PathfinderGoal pathfindergoal) {
|
||||
this.a.add(new PathfinderGoalSelectorItem(this, i, pathfindergoal));
|
||||
this.b.add(new PathfinderGoalSelectorItem(this, i, pathfindergoal));
|
||||
}
|
||||
|
||||
public void a(PathfinderGoal pathfindergoal) {
|
||||
Iterator iterator = this.a.iterator();
|
||||
Iterator iterator = this.b.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
PathfinderGoalSelectorItem pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
|
||||
PathfinderGoal pathfindergoal1 = pathfindergoalselectoritem.a;
|
||||
|
||||
if (pathfindergoal1 == pathfindergoal) {
|
||||
if (this.b.contains(pathfindergoalselectoritem)) {
|
||||
if (this.c.contains(pathfindergoalselectoritem)) {
|
||||
pathfindergoal1.d();
|
||||
this.b.remove(pathfindergoalselectoritem);
|
||||
this.c.remove(pathfindergoalselectoritem);
|
||||
}
|
||||
|
||||
iterator.remove();
|
||||
@@ -47,12 +51,12 @@ public class PathfinderGoalSelector {
|
||||
Iterator iterator;
|
||||
PathfinderGoalSelectorItem pathfindergoalselectoritem;
|
||||
|
||||
if (this.d++ % this.e == 0) {
|
||||
iterator = this.a.iterator();
|
||||
if (this.e++ % this.f == 0) {
|
||||
iterator = this.b.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
|
||||
boolean flag = this.b.contains(pathfindergoalselectoritem);
|
||||
boolean flag = this.c.contains(pathfindergoalselectoritem);
|
||||
|
||||
if (flag) {
|
||||
if (this.b(pathfindergoalselectoritem) && this.a(pathfindergoalselectoritem)) {
|
||||
@@ -60,7 +64,7 @@ public class PathfinderGoalSelector {
|
||||
}
|
||||
|
||||
pathfindergoalselectoritem.a.d();
|
||||
this.b.remove(pathfindergoalselectoritem);
|
||||
this.c.remove(pathfindergoalselectoritem);
|
||||
}
|
||||
|
||||
if (this.b(pathfindergoalselectoritem) && pathfindergoalselectoritem.a.a()) {
|
||||
@@ -68,11 +72,11 @@ public class PathfinderGoalSelector {
|
||||
// arraylist.add(pathfindergoalselectoritem);
|
||||
pathfindergoalselectoritem.a.c();
|
||||
// CraftBukkit end
|
||||
this.b.add(pathfindergoalselectoritem);
|
||||
this.c.add(pathfindergoalselectoritem);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iterator = this.b.iterator();
|
||||
iterator = this.c.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
|
||||
@@ -83,41 +87,41 @@ public class PathfinderGoalSelector {
|
||||
}
|
||||
}
|
||||
|
||||
this.c.a("goalStart");
|
||||
this.d.a("goalStart");
|
||||
// CraftBukkit start - removed usage of arraylist
|
||||
/*iterator = arraylist.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
|
||||
this.c.a(pathfindergoalselectoritem.a.getClass().getSimpleName());
|
||||
this.d.a(pathfindergoalselectoritem.a.getClass().getSimpleName());
|
||||
pathfindergoalselectoritem.a.c();
|
||||
this.c.b();
|
||||
this.d.b();
|
||||
}*/
|
||||
// CraftBukkit end
|
||||
|
||||
this.c.b();
|
||||
this.c.a("goalTick");
|
||||
iterator = this.b.iterator();
|
||||
this.d.b();
|
||||
this.d.a("goalTick");
|
||||
iterator = this.c.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
|
||||
pathfindergoalselectoritem.a.e();
|
||||
}
|
||||
|
||||
this.c.b();
|
||||
this.d.b();
|
||||
}
|
||||
|
||||
private boolean a(PathfinderGoalSelectorItem pathfindergoalselectoritem) {
|
||||
this.c.a("canContinue");
|
||||
this.d.a("canContinue");
|
||||
boolean flag = pathfindergoalselectoritem.a.b();
|
||||
|
||||
this.c.b();
|
||||
this.d.b();
|
||||
return flag;
|
||||
}
|
||||
|
||||
private boolean b(PathfinderGoalSelectorItem pathfindergoalselectoritem) {
|
||||
this.c.a("canUse");
|
||||
Iterator iterator = this.a.iterator();
|
||||
this.d.a("canUse");
|
||||
Iterator iterator = this.b.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
PathfinderGoalSelectorItem pathfindergoalselectoritem1 = (PathfinderGoalSelectorItem) iterator.next();
|
||||
@@ -125,21 +129,21 @@ public class PathfinderGoalSelector {
|
||||
if (pathfindergoalselectoritem1 != pathfindergoalselectoritem) {
|
||||
if (pathfindergoalselectoritem.b >= pathfindergoalselectoritem1.b) {
|
||||
// CraftBukkit - switch order
|
||||
if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.b.contains(pathfindergoalselectoritem1)) {
|
||||
this.c.b();
|
||||
if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.c.contains(pathfindergoalselectoritem1)) {
|
||||
this.d.b();
|
||||
((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit - switch order
|
||||
} else if (!pathfindergoalselectoritem1.a.i() && this.b.contains(pathfindergoalselectoritem1)) {
|
||||
this.c.b();
|
||||
} else if (!pathfindergoalselectoritem1.a.i() && this.c.contains(pathfindergoalselectoritem1)) {
|
||||
this.d.b();
|
||||
((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.c.b();
|
||||
this.d.b();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user