diff options
author | Wesley Wolfe <weswolf@aol.com> | 2012-08-04 21:06:17 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-08-04 21:06:17 -0500 |
commit | 14a470985df8bc3e507a9d6a6f6a64b734873ec9 (patch) | |
tree | 7584241499ffe1572a513bd1199e642b5966bd24 /src/main/java/net/minecraft/server/AABBPool.java | |
parent | e5acb6cf3a05e7e1d7e0256096ac5033c0e11e09 (diff) | |
download | craftbukkit-14a470985df8bc3e507a9d6a6f6a64b734873ec9.tar craftbukkit-14a470985df8bc3e507a9d6a6f6a64b734873ec9.tar.gz craftbukkit-14a470985df8bc3e507a9d6a6f6a64b734873ec9.tar.lz craftbukkit-14a470985df8bc3e507a9d6a6f6a64b734873ec9.tar.xz craftbukkit-14a470985df8bc3e507a9d6a6f6a64b734873ec9.zip |
Add AABBPool for diff visibility
Diffstat (limited to 'src/main/java/net/minecraft/server/AABBPool.java')
-rw-r--r-- | src/main/java/net/minecraft/server/AABBPool.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/AABBPool.java b/src/main/java/net/minecraft/server/AABBPool.java new file mode 100644 index 00000000..a5eeb2fb --- /dev/null +++ b/src/main/java/net/minecraft/server/AABBPool.java @@ -0,0 +1,53 @@ +package net.minecraft.server; + +import java.util.ArrayList; +import java.util.List; + +public class AABBPool { + + private final int a; + private final int b; + private final List c = new ArrayList(); + private int d = 0; + private int e = 0; + private int f = 0; + + public AABBPool(int i, int j) { + this.a = i; + this.b = j; + } + + public AxisAlignedBB a(double d0, double d1, double d2, double d3, double d4, double d5) { + AxisAlignedBB axisalignedbb; + + if (this.d >= this.c.size()) { + axisalignedbb = new AxisAlignedBB(d0, d1, d2, d3, d4, d5); + this.c.add(axisalignedbb); + } else { + axisalignedbb = (AxisAlignedBB) this.c.get(this.d); + axisalignedbb.b(d0, d1, d2, d3, d4, d5); + } + + ++this.d; + return axisalignedbb; + } + + public void a() { + if (this.d > this.e) { + this.e = this.d; + } + + if (this.f++ == this.a) { + int i = Math.max(this.e, this.c.size() - this.b); + + while (this.c.size() > i) { + this.c.remove(i); + } + + this.e = 0; + this.f = 0; + } + + this.d = 0; + } +} |