summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-04-21 13:49:17 -0500
committerEvilSeph <evilseph@gmail.com>2012-04-21 23:52:38 -0400
commit343f39b2b3750036f3749a16cf06ae39d65e87db (patch)
tree30d5acc6353ca26166ed6ba29ee590958176f037 /src/main/java/net
parent8f6fe0a643fa6b8d86bcbb84771c2ad2398b8771 (diff)
downloadcraftbukkit-343f39b2b3750036f3749a16cf06ae39d65e87db.tar
craftbukkit-343f39b2b3750036f3749a16cf06ae39d65e87db.tar.gz
craftbukkit-343f39b2b3750036f3749a16cf06ae39d65e87db.tar.lz
craftbukkit-343f39b2b3750036f3749a16cf06ae39d65e87db.tar.xz
craftbukkit-343f39b2b3750036f3749a16cf06ae39d65e87db.zip
Add PathfinderGoalSelector for diff visibility
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalSelector.java91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
new file mode 100644
index 00000000..43dc1b9f
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -0,0 +1,91 @@
+package net.minecraft.server;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class PathfinderGoalSelector {
+
+ private ArrayList a = new ArrayList();
+ private ArrayList b = new ArrayList();
+
+ public PathfinderGoalSelector() {}
+
+ public void a(int i, PathfinderGoal pathfindergoal) {
+ this.a.add(new PathfinderGoalSelectorItem(this, i, pathfindergoal));
+ }
+
+ public void a() {
+ ArrayList arraylist = new ArrayList();
+ Iterator iterator = this.a.iterator();
+
+ while (iterator.hasNext()) {
+ PathfinderGoalSelectorItem pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
+ boolean flag = this.b.contains(pathfindergoalselectoritem);
+
+ if (flag) {
+ if (this.a(pathfindergoalselectoritem) && pathfindergoalselectoritem.a.b()) {
+ continue;
+ }
+
+ pathfindergoalselectoritem.a.d();
+ this.b.remove(pathfindergoalselectoritem);
+ }
+
+ if (this.a(pathfindergoalselectoritem) && pathfindergoalselectoritem.a.a()) {
+ arraylist.add(pathfindergoalselectoritem);
+ this.b.add(pathfindergoalselectoritem);
+ }
+ }
+
+ boolean flag1 = false;
+
+ if (flag1 && arraylist.size() > 0) {
+ System.out.println("Starting: ");
+ }
+
+ Iterator iterator1;
+ PathfinderGoalSelectorItem pathfindergoalselectoritem1;
+
+ for (iterator1 = arraylist.iterator(); iterator1.hasNext(); pathfindergoalselectoritem1.a.c()) {
+ pathfindergoalselectoritem1 = (PathfinderGoalSelectorItem) iterator1.next();
+ if (flag1) {
+ System.out.println(pathfindergoalselectoritem1.a.toString() + ", ");
+ }
+ }
+
+ if (flag1 && this.b.size() > 0) {
+ System.out.println("Running: ");
+ }
+
+ for (iterator1 = this.b.iterator(); iterator1.hasNext(); pathfindergoalselectoritem1.a.e()) {
+ pathfindergoalselectoritem1 = (PathfinderGoalSelectorItem) iterator1.next();
+ if (flag1) {
+ System.out.println(pathfindergoalselectoritem1.a.toString());
+ }
+ }
+ }
+
+ private boolean a(PathfinderGoalSelectorItem pathfindergoalselectoritem) {
+ Iterator iterator = this.a.iterator();
+
+ while (iterator.hasNext()) {
+ PathfinderGoalSelectorItem pathfindergoalselectoritem1 = (PathfinderGoalSelectorItem) iterator.next();
+
+ if (pathfindergoalselectoritem1 != pathfindergoalselectoritem) {
+ if (pathfindergoalselectoritem.b >= pathfindergoalselectoritem1.b) {
+ if (this.b.contains(pathfindergoalselectoritem1) && !this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1)) {
+ return false;
+ }
+ } else if (this.b.contains(pathfindergoalselectoritem1) && !pathfindergoalselectoritem1.a.g()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private boolean a(PathfinderGoalSelectorItem pathfindergoalselectoritem, PathfinderGoalSelectorItem pathfindergoalselectoritem1) {
+ return (pathfindergoalselectoritem.a.h() & pathfindergoalselectoritem1.a.h()) == 0;
+ }
+}