summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-02-01 21:40:52 +0100
committerErik Broes <erikbroes@grum.nl>2011-02-01 21:40:52 +0100
commit5c467e941bc2f08a615288c378e756f00f4321ef (patch)
tree8939aca3ec4819fe33ed769505c53db2e27d1433 /src/main/java/net/minecraft
parenta3fbada1e8150a350ff7f9bf38841cd7b0acc01d (diff)
downloadcraftbukkit-5c467e941bc2f08a615288c378e756f00f4321ef.tar
craftbukkit-5c467e941bc2f08a615288c378e756f00f4321ef.tar.gz
craftbukkit-5c467e941bc2f08a615288c378e756f00f4321ef.tar.lz
craftbukkit-5c467e941bc2f08a615288c378e756f00f4321ef.tar.xz
craftbukkit-5c467e941bc2f08a615288c378e756f00f4321ef.zip
Actually implement the spiral stuff now, oops
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r--src/main/java/net/minecraft/server/PlayerManager.java40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java
index 7fac33b3..f2ace21e 100644
--- a/src/main/java/net/minecraft/server/PlayerManager.java
+++ b/src/main/java/net/minecraft/server/PlayerManager.java
@@ -44,6 +44,15 @@ public class PlayerManager {
}
}
+ // CraftBukkit start
+ private final int[][] direction = new int[][] {
+ { 1, 0 },
+ { 0, 1 },
+ { -1, 0 },
+ { 0, -1 },
+ };
+ // CraftBukkit end
+
public void a(EntityPlayer entityplayer) {
int i = (int) entityplayer.locX >> 4;
int j = (int) entityplayer.locZ >> 4;
@@ -51,12 +60,37 @@ public class PlayerManager {
entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ;
- for (int k = i - 10; k <= i + 10; ++k) {
- for (int l = j - 10; l <= j + 10; ++l) {
- this.a(k, l, true).a(entityplayer);
+ // CraftBukkit start
+ int facing = 0;
+ int size = 10;
+ int dx = 0;
+ int dz = 0;
+
+ // Origin
+ this.a(i, j, true).a(entityplayer);
+
+ // All but the last leg
+ for (int legSize = 1; legSize <= size * 2; legSize++) {
+ for (int leg = 0; leg < 2; leg++) {
+ int[] dir = direction[ facing++ % 4 ];
+
+ for (int k = 0; k < legSize; k++ ) {
+ dx += dir[0];
+ dz += dir[1];
+ this.a(i + dx, j + dz, true).a(entityplayer);
+ }
}
}
+ // Final leg
+ facing %= 4;
+ for (int k = 0; k < size * 2; k++) {
+ dx += direction[facing][0];
+ dz += direction[facing][1];
+ this.a(i + dx, j + dz, true).a(entityplayer);
+ }
+ // CraftBukkit end
+
this.a.add(entityplayer);
}