Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit 6abd51e

Browse files
committed
Citizens navigation fix
1 parent be6baec commit 6abd51e

File tree

2 files changed

+9
-41
lines changed

2 files changed

+9
-41
lines changed

WindSpigot-Server/src/main/java/net/minecraft/server/NavigationAbstract.java

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,14 @@ public PathEntity doPathSearch(ChunkCache chunkcache, BlockPosition blockpositio
5858
public PathEntity doPathSearch(ChunkCache chunkcache, int x, int y, int z) {
5959
if (this.b()) {
6060
float f = this.i();
61-
return this.j.a((IBlockAccess) chunkcache, (Entity) this.b, x, y, z, f);
61+
return this.j.a((IBlockAccess) chunkcache, (Entity) this.b, new BlockPosition(x, y, z), f);
6262
}
6363
return null;
6464
}
6565

6666
public PathEntity doPathSearch(ChunkCache chunkcache, Entity entity) {
67-
//return this.doPathSearch(chunkcache, (new BlockPosition(entity)).up());
68-
return this.doPathSearch(chunkcache, MathHelper.floor(entity.locX), MathHelper.floor(entity.locY) + 1,
69-
MathHelper.floor(entity.locZ));
67+
return this.doPathSearch(chunkcache, (new BlockPosition(entity)).up());
68+
7069
}
7170
// WindSpigot end
7271

@@ -88,27 +87,7 @@ public PathEntity a(double d0, double d1, double d2) {
8887
}
8988

9089
public PathEntity a(int d0, int d1, int d2) { // remove final modifier
91-
//return this.a(new BlockPosition(MathHelper.floor(d0), (int) d1, MathHelper.floor(d2)));
92-
// debug msgs
93-
WindSpigot.debug("Executing sync path search...");
94-
if (!this.b()) {
95-
return null;
96-
} else {
97-
float f = this.i();
98-
99-
this.c.methodProfiler.a("pathfind");
100-
101-
int i = (int) (f + 8.0F);
102-
103-
ChunkCache chunkcache = new ChunkCache(this.c, MathHelper.floor(b.locX) - i, MathHelper.floor(b.locY) - i,
104-
MathHelper.floor(b.locZ) - i, MathHelper.floor(b.locX) + i, MathHelper.floor(b.locY) + i,
105-
MathHelper.floor(b.locZ) + i, 0);
106-
107-
PathEntity pathentity = this.j.a(chunkcache, this.b, d0, d1, d2, f);
108-
109-
this.c.methodProfiler.b();
110-
return pathentity;
111-
}
90+
return this.a(new BlockPosition(MathHelper.floor(d0), (int) d1, MathHelper.floor(d2)));
11291
}
11392
// WindSpigot end
11493

@@ -119,15 +98,10 @@ public PathEntity a(BlockPosition blockposition) {
11998
float f = this.i();
12099

121100
this.c.methodProfiler.a("pathfind");
122-
// WindSpigot start - reduce usage of blockposition
123-
//BlockPosition blockposition1 = new BlockPosition(this.b);
101+
BlockPosition blockposition1 = new BlockPosition(this.b);
124102
int i = (int) (f + 8.0F);
125-
//ChunkCache chunkcache = new ChunkCache(this.c, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0);
126-
127-
ChunkCache chunkcache = new ChunkCache(this.c, MathHelper.floor(b.locX - i), MathHelper.floor(b.locY - i),
128-
MathHelper.floor(b.locZ - i), MathHelper.floor(b.locX + i), MathHelper.floor(b.locY + i),
129-
MathHelper.floor(b.locZ + i), 0);
130-
// WindSpigot end
103+
ChunkCache chunkcache = new ChunkCache(this.c, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0);
104+
131105

132106
PathEntity pathentity = this.j.a(chunkcache, this.b, blockposition, f);
133107

WindSpigot-Server/src/main/java/net/minecraft/server/Pathfinder.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,11 @@ public PathEntity a(IBlockAccess var1, Entity var2, Entity var3, float var4) {
1313
return this.a(var1, var2, var3.locX, var3.getBoundingBox().b, var3.locZ, var4);
1414
}
1515

16-
// WindSpigot start - reduce blockposition usage
1716
public PathEntity a(IBlockAccess var1, Entity var2, BlockPosition var3, float var4) {
18-
return this.a(var1, var2, var3.getX(), var3.getY(), var3.getZ(), var4);
17+
return this.a(var1, var2, (double) ((float) var3.getX() + 0.5F), (double) ((float) var3.getY() + 0.5F),
18+
(double) ((float) var3.getZ() + 0.5F), var4);
1919
}
2020

21-
public PathEntity a(IBlockAccess var1, Entity var2, int x, int y, int z, float var4) {
22-
return this.a(var1, var2, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F),
23-
(double) ((float) z + 0.5F), var4);
24-
}
25-
// WindSpigot end
26-
2721

2822
private PathEntity a(IBlockAccess var1, Entity var2, double var3, double var5, double var7, float var9) {
2923
// WindSpigot - synchronize

0 commit comments

Comments
 (0)