mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-25 12:05:14 +01:00
Asnyc Nav fix
This commit is contained in:
parent
064cade2a9
commit
bd89338c8e
@ -1 +1 @@
|
||||
Add-Rainforest-config&Apply-advancements-async&Optimize-Pathfinder-Remove-Streams-Optimized-collect&Optimize-redstone-algorithm&Async-navigation
|
||||
Add-Rainforest-config&Apply-advancements-async&Optimize-Pathfinder-Remove-Streams-Optimized-collect&Optimize-redstone-algorithm
|
@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
Date: Wed, 5 Aug 2020 14:21:05 -0500
|
||||
Subject: [PATCH] Yatopia Server Fixes
|
||||
Date: Thu, 6 Aug 2020 19:47:50 -0500
|
||||
Subject: [PATCH] Yatopia-Server-Fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
@ -233,42 +233,6 @@ index 4c2d5b3e080c925d687733ec40d4fb4b22552c96..00000000000000000000000000000000
|
||||
-
|
||||
- this.setPVP(dedicatedserverproperties.pvp);
|
||||
- this.setAllowFlight(dedicatedserverproperties.allowFlight);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index 83e232deaeb78f0c97bce42d67fc220e8fb88368..bbcded1e80a4b0e4618affd77bcaa6e41589b9fe 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -758,7 +758,11 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
this.goalSelector.doTick();
|
||||
//this.world.getMethodProfiler().exit(); // Akarin - remove caller
|
||||
//this.world.getMethodProfiler().enter("navigation"); // Akarin - remove caller
|
||||
- this.navigation.c();
|
||||
+ // Paper start - async navigation
|
||||
+ if (this.navigation instanceof AsyncNavigationAbstract)
|
||||
+ ((AsyncNavigationAbstract) this.navigation).asyncTick();
|
||||
+ else
|
||||
+ // Paper end
|
||||
//this.world.getMethodProfiler().exit(); // Akarin - remove caller
|
||||
//this.world.getMethodProfiler().enter("mob tick"); // Akarin - remove caller
|
||||
this.mobTick();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java.rej b/src/main/java/net/minecraft/server/EntityInsentient.java.rej
|
||||
deleted file mode 100644
|
||||
index de5ec59cb607030703e7b0361b1fa615b95e289e..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java.rej
|
||||
+++ /dev/null
|
||||
@@ -1,13 +0,0 @@
|
||||
-diff a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java (rejected hunks)
|
||||
-@@ -757,6 +758,11 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
- this.goalSelector.doTick();
|
||||
- this.world.getMethodProfiler().exit();
|
||||
- this.world.getMethodProfiler().enter("navigation");
|
||||
-+ // Paper start - async navigation
|
||||
-+ if (this.navigation instanceof AsyncNavigationAbstract)
|
||||
-+ ((AsyncNavigationAbstract) this.navigation).asyncTick();
|
||||
-+ else
|
||||
-+ // Paper end
|
||||
- this.navigation.c();
|
||||
- this.world.getMethodProfiler().exit();
|
||||
- this.world.getMethodProfiler().enter("mob tick");
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index 70ae2923e21d7a0312e629a903ca9e380d6c6114..d906c5e530c2e7f779df079223aee619a73b5d51 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@ -388,101 +352,6 @@ index b005dd817e9ecffcf2172b4a807b0ecc632570b0..00000000000000000000000000000000
|
||||
- this.sleepForTick();
|
||||
- this.methodProfiler.exit();
|
||||
- this.methodProfiler.b();
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index 2f2f8d74acef3cdaeda0faab67ace0d28e2d4627..d155d843c03ee1e16180657886a87844e6b34aa6 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -8,25 +8,25 @@ import javax.annotation.Nullable;
|
||||
|
||||
public abstract class NavigationAbstract {
|
||||
|
||||
- protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
|
||||
- protected final World b;
|
||||
+ protected final EntityInsentient a; public EntityInsentient getEntity() { return a; } // Paper - OBFHELPER
|
||||
+ protected final World b; protected final World getWorld() { return this.b; } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
- protected PathEntity c; protected final PathEntity getCurrentPath() { return this.c; } // Paper - OBFHELPER
|
||||
- protected double d;
|
||||
- protected int e;
|
||||
- protected int f;
|
||||
- protected Vec3D g;
|
||||
- protected BaseBlockPosition h;
|
||||
- protected long i;
|
||||
- protected long j;
|
||||
- protected double k;
|
||||
- protected float l;
|
||||
+ protected PathEntity c; protected final PathEntity getCurrentPath() { return this.c; } protected final void setCurrentPath(PathEntity path) { this.c = path; } // Paper - OBFHELPER
|
||||
+ protected double d; protected final double getSpeed() { return this.d; } // Paper - OBFHELPER
|
||||
+ protected int e; protected final int getCurrentTick() { return this.e; } protected final void incrementTick() { ++this.e; } // Paper - OBFHELPER
|
||||
+ protected int f; protected final int getCurrentPathStartTime() { return this.f; } protected final void setCurrentPathStartTime(int time) { this.f = time; } // Paper - OBFHELPER
|
||||
+ protected Vec3D g; protected final Vec3D getCurrentPathStartPosition() { return this.g; } protected final void setCurrentPathStartPosition(Vec3D position) { this.g = position; } // Paper - OBFHELPER
|
||||
+ protected BaseBlockPosition h; protected final BaseBlockPosition getLastNodePosition() { return this.h; } protected final void setLastNodePosition(BaseBlockPosition position) { this.h = position; } // Paper - OBFHELPER
|
||||
+ protected long i; protected final long getCurrentNodeStartTickMs() { return this.i; } protected final void addToCurrentNodeStartTickMs(long amount) { this.i += amount; } // Paper - OBFHELPER
|
||||
+ protected long j; protected final long getLastActiveTickMs() { return this.j; } protected final void setLastActiveTickMs(long ms) { this.j = ms; } // Paper - OBFHELPER
|
||||
+ protected double k; protected final double getCurrentNodeTimeout() { return this.k; } protected final void setCurrentNodeTimeout(double timeout) { this.k = timeout; } // Paper - OBFHELPER
|
||||
+ protected float l; protected final float getChebyshevMinimumReachProximity() { return this.l; } protected final void setChebyshevMinimumReachProximity(float proximity) { this.l = proximity; } // Paper - OBFHELPER
|
||||
protected boolean m; protected final boolean needsPathRecalculation() { return this.m; } // Tuinity - OBFHELPER
|
||||
protected long n;
|
||||
- protected PathfinderAbstract o;
|
||||
- private BlockPosition p;
|
||||
- private int q;
|
||||
- private float r;
|
||||
+ protected PathfinderAbstract o; protected final PathfinderAbstract getNodeCreator() { return this.o; } // Paper - OBFHELPER
|
||||
+ private BlockPosition p; protected final BlockPosition getCurrentTarget() { return this.p; } protected final void setCurrentTarget(BlockPosition target) { this.p = target; } // Paper - OBFHELPER
|
||||
+ private int q; protected final int getCurrentDistance() { return this.q; } // Paper - OBFHELPER
|
||||
+ private float r; protected final float getRangeMultiplier() { return this.r; } // Paper - OBFHELPER
|
||||
private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
|
||||
|
||||
// Tuinity start
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java.rej b/src/main/java/net/minecraft/server/NavigationAbstract.java.rej
|
||||
deleted file mode 100644
|
||||
index 3b706d3951c187dfdd158b7c4c73014d271855ca..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java.rej
|
||||
+++ /dev/null
|
||||
@@ -1,43 +0,0 @@
|
||||
-diff a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java (rejected hunks)
|
||||
-@@ -8,25 +8,25 @@ import javax.annotation.Nullable;
|
||||
-
|
||||
- public abstract class NavigationAbstract {
|
||||
-
|
||||
-- protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
|
||||
-- protected final World b;
|
||||
-+ protected final EntityInsentient a; public EntityInsentient getEntity() { return a; } // Paper - OBFHELPER
|
||||
-+ protected final World b; protected final World getWorld() { return this.b; } // Paper - OBFHELPER
|
||||
- @Nullable
|
||||
-- protected PathEntity c; protected final PathEntity getCurrentPath() { return this.c; } // Paper - OBFHELPER
|
||||
-- protected double d;
|
||||
-- protected int e;
|
||||
-- protected int f;
|
||||
-- protected Vec3D g;
|
||||
-- protected BaseBlockPosition h;
|
||||
-- protected long i;
|
||||
-- protected long j;
|
||||
-- protected double k;
|
||||
-- protected float l;
|
||||
-+ protected PathEntity c; protected final PathEntity getCurrentPath() { return this.c; } protected final void setCurrentPath(PathEntity path) { this.c = path; } // Paper - OBFHELPER
|
||||
-+ protected double d; protected final double getSpeed() { return this.d; } // Paper - OBFHELPER
|
||||
-+ protected int e; protected final int getCurrentTick() { return this.e; } protected final void incrementTick() { ++this.e; } // Paper - OBFHELPER
|
||||
-+ protected int f; protected final int getCurrentPathStartTime() { return this.f; } protected final void setCurrentPathStartTime(int time) { this.f = time; } // Paper - OBFHELPER
|
||||
-+ protected Vec3D g; protected final Vec3D getCurrentPathStartPosition() { return this.g; } protected final void setCurrentPathStartPosition(Vec3D position) { this.g = position; } // Paper - OBFHELPER
|
||||
-+ protected BaseBlockPosition h; protected final BaseBlockPosition getLastNodePosition() { return this.h; } protected final void setLastNodePosition(BaseBlockPosition position) { this.h = position; } // Paper - OBFHELPER
|
||||
-+ protected long i; protected final long getCurrentNodeStartTickMs() { return this.i; } protected final void addToCurrentNodeStartTickMs(long amount) { this.i += amount; } // Paper - OBFHELPER
|
||||
-+ protected long j; protected final long getLastActiveTickMs() { return this.j; } protected final void setLastActiveTickMs(long ms) { this.j = ms; } // Paper - OBFHELPER
|
||||
-+ protected double k; protected final double getCurrentNodeTimeout() { return this.k; } protected final void setCurrentNodeTimeout(double timeout) { this.k = timeout; } // Paper - OBFHELPER
|
||||
-+ protected float l; protected final float getChebyshevMinimumReachProximity() { return this.l; } protected final void setChebyshevMinimumReachProximity(float proximity) { this.l = proximity; } // Paper - OBFHELPER
|
||||
- protected boolean m;
|
||||
- protected long n;
|
||||
-- protected PathfinderAbstract o;
|
||||
-- private BlockPosition p;
|
||||
-- private int q;
|
||||
-- private float r;
|
||||
-+ protected PathfinderAbstract o; protected final PathfinderAbstract getNodeCreator() { return this.o; } // Paper - OBFHELPER
|
||||
-+ private BlockPosition p; protected final BlockPosition getCurrentTarget() { return this.p; } protected final void setCurrentTarget(BlockPosition target) { this.p = target; } // Paper - OBFHELPER
|
||||
-+ private int q; protected final int getCurrentDistance() { return this.q; } // Paper - OBFHELPER
|
||||
-+ private float r; protected final float getRangeMultiplier() { return this.r; } // Paper - OBFHELPER
|
||||
- private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
|
||||
-
|
||||
- public NavigationAbstract(EntityInsentient entityinsentient, World world) {
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index fe43603ecdc52f26fdaf4c94f14ea27e76b5a71b..a794e4523decded103b88433a5f63213fc243683 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@ -730,6 +599,34 @@ index 7fe085e48b6ad625a510edf33b112bef24f7d7ad..9459efde54d507231b4aacb7cba14e99
|
||||
private NonNullList<ItemStack> contents;
|
||||
public int c; // PAIL private -> public, rename viewerCount
|
||||
private TileEntityShulkerBox.AnimationPhase i;
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej
|
||||
deleted file mode 100644
|
||||
index bada470cba41cce9beb9eb04227b42c1d489d731..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej
|
||||
+++ /dev/null
|
||||
@@ -1,22 +0,0 @@
|
||||
-diff a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java (rejected hunks)
|
||||
-@@ -10,7 +11,19 @@ import org.bukkit.entity.HumanEntity;
|
||||
-
|
||||
- public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable {
|
||||
-
|
||||
-- private static final int[] a = IntStream.range(0, 27).toArray();
|
||||
-+ private static final int[] a;
|
||||
-+
|
||||
-+ static {
|
||||
-+ int[] arr = new int[10];
|
||||
-+ int count = 0;
|
||||
-+ for (int i1 = 0; i1 < 27; i1++) {
|
||||
-+ if (arr.length == count) arr = Arrays.copyOf(arr, count * 2);
|
||||
-+ arr[count++] = i1;
|
||||
-+ }
|
||||
-+ arr = Arrays.copyOfRange(arr, 0, count);
|
||||
-+ a = arr;
|
||||
-+ }
|
||||
-+
|
||||
- private NonNullList<ItemStack> contents;
|
||||
- private int c;
|
||||
- private TileEntityShulkerBox.AnimationPhase i;
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0890bca50858ec8d544be2e1ff4ac2da73c7d830..44af511da96b265a8441052cc87e356e630699a6 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
|
@ -1,5 +1,5 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Wed, 5 Aug 2020 14:25:50 -0500
|
||||
Subject: [PATCH] Add GameProfileLookupEvent
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Wed, 5 Aug 2020 08:05:10 -0500
|
||||
Subject: [PATCH] Add config Yatopia command and basic settings
|
||||
|
||||
@ -411,7 +411,7 @@ index dd093e3e624158ff87bad59785ed2496f161f64c..ec84bc4dceff76fd2f823a6a9548fdf1
|
||||
});
|
||||
StreamAccumulator<VoxelShape> streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream));
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 0c862b4604540545206ebe6e08d5d79484414279..da08249ee1c61b7c77b79f491cb8482865ecba3c 100644
|
||||
index 732a7747fd0360deec8237c80bc93fb9f06b5320..c30fee13723cef0f03eb5a87851158cf347fae3c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -266,6 +266,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -19,10 +19,10 @@ index 19bea6ee83d8b25da022662253328fb6384f40d9..2cee6e02a7dcbacb5f002f9c5917a2e2
|
||||
}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index da08249ee1c61b7c77b79f491cb8482865ecba3c..2edebae8a1127c9214c7c2974700db9f207fa05f 100644
|
||||
index c30fee13723cef0f03eb5a87851158cf347fae3c..7ebd715dd2675e0f4fc73344f7068c6b908b59a9 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2844,40 +2844,46 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -2843,40 +2843,46 @@ public abstract class EntityLiving extends Entity {
|
||||
if (i <= 0 && world.paperConfig.maxCollisionsPerEntity <= 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -37,10 +37,10 @@ index 4f10ca5ada741b4f5ef941bb9d92a2fa6a7c44ff..3d6f8d948d293ca57bf158bcd1f58e28
|
||||
if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) {
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 2edebae8a1127c9214c7c2974700db9f207fa05f..ce96eea39425792eda9aacd656d2bffda8bc3803 100644
|
||||
index 7ebd715dd2675e0f4fc73344f7068c6b908b59a9..ef77e7864e7e49684a9bd2a7c9f07717800e3e89 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2567,11 +2567,14 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -2566,11 +2566,14 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3
|
||||
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
index 29c978aaa2b9f50f5dba70943653af7658d98fc7..595fb84f280bb10997992cc41ebc512ceaf2d696 100644
|
||||
index ec55785af2b432b692d3a3bf4298ffb32489bf3b..279ca87d8826ea2696ffc08d4b52c55a5e7bd392 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
@@ -4,12 +4,23 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||
@ -34,7 +34,7 @@ index 29c978aaa2b9f50f5dba70943653af7658d98fc7..595fb84f280bb10997992cc41ebc512c
|
||||
protected float j;
|
||||
private final Long2ObjectMap<PathType> k = new Long2ObjectOpenHashMap();
|
||||
private final Object2BooleanMap<AxisAlignedBB> l = new Object2BooleanOpenHashMap();
|
||||
@@ -509,13 +520,44 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
@@ -508,13 +519,44 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
|
||||
if (iblockdata == null) return PathType.BLOCKED; // Paper
|
||||
@ -84,7 +84,7 @@ index 29c978aaa2b9f50f5dba70943653af7658d98fc7..595fb84f280bb10997992cc41ebc512c
|
||||
return PathType.DAMAGE_CACTUS;
|
||||
} else if (iblockdata.a(Blocks.SWEET_BERRY_BUSH)) {
|
||||
return PathType.DAMAGE_OTHER;
|
||||
@@ -541,7 +583,10 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
@@ -540,7 +582,10 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
} else {
|
||||
Fluid fluid = iblockdata.getFluid(); // Tuinity - remove another getType call
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Wed, 5 Aug 2020 08:08:44 -0500
|
||||
Subject: [PATCH] Optimize TileEntity loading
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Wed, 5 Aug 2020 08:17:46 -0500
|
||||
Subject: [PATCH] Redirect Configs
|
||||
|
||||
|
358
patches/server/0029-Akarin-updated-Async-Path-Finding.patch
Normal file
358
patches/server/0029-Akarin-updated-Async-Path-Finding.patch
Normal file
@ -0,0 +1,358 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: tsao chi <tsao-chi@the-lingo.org>
|
||||
Date: Sun, 2 Aug 2020 12:25:52 -0500
|
||||
Subject: [PATCH] Akarin updated Async Path Finding
|
||||
|
||||
Co-authored-by: Bud Gidiere <sgidiere@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java
|
||||
index e6868e2b65e3c2bde7696272b242a47e7394e27f..c4c3ef500b9b8465644a0b7712f43ba35ad3acc1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityBee.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityBee.java
|
||||
@@ -445,9 +445,9 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void c() {
|
||||
+ public void tickAsync() {
|
||||
if (!EntityBee.this.bJ.k()) {
|
||||
- super.c();
|
||||
+ super.tickAsync();
|
||||
}
|
||||
}
|
||||
};
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index 691a4ebc3f267bab375fb2bc83deac9ea825a232..7c9bb358c9967e6c7c02b96e17764f2418df7979 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -757,7 +757,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
this.goalSelector.doTick();
|
||||
//this.world.getMethodProfiler().exit(); // Akarin - remove caller
|
||||
//this.world.getMethodProfiler().enter("navigation"); // Akarin - remove caller
|
||||
- this.navigation.c();
|
||||
+ this.navigation.tickAsync(); // Akarin - Async pathfinder
|
||||
//this.world.getMethodProfiler().exit(); // Akarin - remove caller
|
||||
//this.world.getMethodProfiler().enter("mob tick"); // Akarin - remove caller
|
||||
this.mobTick();
|
||||
diff --git a/src/main/java/net/minecraft/server/Navigation.java b/src/main/java/net/minecraft/server/Navigation.java
|
||||
index 681465d8a74831461dce4615d2d19c7ed46bc299..f04411a2a295d2a982dca5851ae76a80a6a83585 100644
|
||||
--- a/src/main/java/net/minecraft/server/Navigation.java
|
||||
+++ b/src/main/java/net/minecraft/server/Navigation.java
|
||||
@@ -183,7 +183,7 @@ public class Navigation extends NavigationAbstract {
|
||||
double d3 = (double) j2 + 0.5D - vec3d.z;
|
||||
|
||||
if (d2 * d0 + d3 * d1 >= 0.0D) {
|
||||
- PathType pathtype = this.o.a(this.b, i2, j - 1, j2, this.a, l, i1, j1, true, true);
|
||||
+ PathType pathtype = this.o.a(this.o.a, i2, j - 1, j2, this.a, l, i1, j1, true, true); // Akarin - use chunk cache
|
||||
|
||||
if (!this.a(pathtype)) {
|
||||
return false;
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de04c1467d 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -28,6 +28,15 @@ public abstract class NavigationAbstract {
|
||||
private int q;
|
||||
private float r;
|
||||
private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
|
||||
+ // Akarin start - Async pathfinder
|
||||
+ private long lastPathfindAsync;
|
||||
+ private static final java.util.concurrent.ExecutorService pathfindExecutor =
|
||||
+ java.util.concurrent.Executors.newSingleThreadExecutor(
|
||||
+ new com.google.common.util.concurrent.ThreadFactoryBuilder()
|
||||
+ .setDaemon(true)
|
||||
+ .setNameFormat("StarLink Pathfinder - %d")
|
||||
+ .build());
|
||||
+ // Akarin end
|
||||
|
||||
// Tuinity start
|
||||
public boolean isViableForPathRecalculationChecking() {
|
||||
@@ -83,7 +92,40 @@ public abstract class NavigationAbstract {
|
||||
}
|
||||
|
||||
}
|
||||
+ // Akarin start - Async pathfinder, copied from above with modification
|
||||
+ public void doPathfindAsync() {
|
||||
+ if (this.b.getTime() - this.lastPathfindAsync > 20L) {
|
||||
+ if (this.p != null) {
|
||||
+ this.lastPathfindAsync = this.b.getTime();
|
||||
+
|
||||
+ // Bake chunk cache
|
||||
+ float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);;
|
||||
+ BlockPosition blockposition = this.a.getChunkCoordinates();
|
||||
+ int k = (int) (f + (float) 8);
|
||||
+ ChunkCache cache = new ChunkCache(this.b, blockposition.b(-k, -k, -k), blockposition.b(k, k, k));
|
||||
+
|
||||
+ // Execute directly if we already have a path entity, or compute one
|
||||
+ if (this.c != null && !this.c.b()) {
|
||||
+ doTickAsync(this.c);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
+ pathfindExecutor.execute(() -> {
|
||||
+ PathEntity result = findPathAsync(cache, java.util.Collections.singleton(this.p), this.q);
|
||||
+ NavigationAbstract.this.b.getMinecraftServer().processQueue.add(() -> {
|
||||
+ if (result != null && result.m() != null)
|
||||
+ this.p = result.m();
|
||||
+
|
||||
+ NavigationAbstract.this.c = result;
|
||||
+ });
|
||||
+ });
|
||||
+ }
|
||||
+ } else {
|
||||
+ // Execute directly, keep behaviour with vanilla, see the original doTick method
|
||||
+ doTickAsync(this.c);
|
||||
+ }
|
||||
+ }
|
||||
+ // Akarin end
|
||||
@Nullable
|
||||
public final PathEntity calculateDestination(double d0, double d1, double d2) { return a(d0, d1, d2, 0); } public final PathEntity a(double d0, double d1, double d2, int i) { // Paper - OBFHELPER
|
||||
return this.a(new BlockPosition(d0, d1, d2), i);
|
||||
@@ -164,7 +206,17 @@ public abstract class NavigationAbstract {
|
||||
return pathentity;
|
||||
}
|
||||
}
|
||||
-
|
||||
+ // Akarin start - Async pathfinder, copied and edited from above with only pathfinding
|
||||
+ protected PathEntity findPathAsync(ChunkCache cache, Set<BlockPosition> set, int j) {
|
||||
+ if (this.a.locY() < 0.0D) {
|
||||
+ return null;
|
||||
+ } else if (!this.a()) {
|
||||
+ return null;
|
||||
+ } else {
|
||||
+ return this.s.a(cache, this.a, set, f, j, this.r);
|
||||
+ }
|
||||
+ }
|
||||
+ // Akarin end
|
||||
public boolean a(double d0, double d1, double d2, double d3) {
|
||||
return this.a(this.a(d0, d1, d2, 1), d3);
|
||||
}
|
||||
@@ -228,7 +280,7 @@ public abstract class NavigationAbstract {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
- public void c() {
|
||||
+/* public void c() {
|
||||
++this.e;
|
||||
if (this.m) {
|
||||
this.j();
|
||||
@@ -238,7 +290,7 @@ public abstract class NavigationAbstract {
|
||||
Vec3D vec3d;
|
||||
|
||||
if (this.a()) {
|
||||
- this.l();
|
||||
+ //this.l();
|
||||
} else if (this.c != null && this.c.f() < this.c.e()) {
|
||||
vec3d = this.b();
|
||||
Vec3D vec3d1 = this.c.a(this.a, this.c.f());
|
||||
@@ -256,9 +308,44 @@ public abstract class NavigationAbstract {
|
||||
this.a.getControllerMove().a(vec3d.x, this.b.getType(blockposition.down()).isAir() ? vec3d.y : PathfinderNormal.a((IBlockAccess) this.b, blockposition), vec3d.z, this.d);
|
||||
}
|
||||
}
|
||||
+ }*/
|
||||
+ //Yatopia Start
|
||||
+ public void c() {
|
||||
+ this.tickAsync();
|
||||
+ }
|
||||
+ //Yatopia End
|
||||
+ // Akarin start - Async pathfinder, copied from above
|
||||
+ public void tickAsync() {
|
||||
+ ++this.e;
|
||||
+ this.doPathfindAsync();
|
||||
}
|
||||
|
||||
- protected void l() {
|
||||
+ // This was copied from above partly with param
|
||||
+ public void doTickAsync(PathEntity pathEntity) {
|
||||
+ if (shouldContinuePathfind(pathEntity))
|
||||
+ return;
|
||||
+
|
||||
+ Vec3D vec3d;
|
||||
+ if (this.a()) {
|
||||
+ this.applyPath(pathEntity);
|
||||
+ } else if (pathEntity.f() < pathEntity.e()) {
|
||||
+ vec3d = this.b();
|
||||
+ Vec3D vec3d1 = pathEntity.a(this.a, pathEntity.f());
|
||||
+
|
||||
+ if (vec3d.y > vec3d1.y && !this.a.isOnGround() && MathHelper.floor(vec3d.x) == MathHelper.floor(vec3d1.x) && MathHelper.floor(vec3d.z) == MathHelper.floor(vec3d1.z)) {
|
||||
+ pathEntity.c(pathEntity.f() + 1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (shouldContinuePathfind(pathEntity))
|
||||
+ return;
|
||||
+ //PacketDebug.a(this.b, this.a, pathEntity, this.l);
|
||||
+ vec3d = pathEntity.a((Entity) this.a);
|
||||
+ BlockPosition blockposition = new BlockPosition(vec3d);
|
||||
+
|
||||
+ this.a.getControllerMove().a(vec3d.x, this.b.getType(blockposition.down()).isAir() ? vec3d.y : PathfinderNormal.a((IBlockAccess) this.b, blockposition), vec3d.z, this.d);
|
||||
+ }
|
||||
+/* protected void l() {
|
||||
Vec3D vec3d = this.b();
|
||||
|
||||
this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F;
|
||||
@@ -273,8 +360,26 @@ public abstract class NavigationAbstract {
|
||||
}
|
||||
|
||||
this.a(vec3d);
|
||||
- }
|
||||
+ }*/
|
||||
+
|
||||
+ // Akarin start - Async pathfinder, copied from above with param
|
||||
+ protected void applyPath(PathEntity pathEntity) {
|
||||
+ Vec3D vec3d = this.b();
|
||||
+
|
||||
+ this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F;
|
||||
+ BaseBlockPosition baseblockposition = pathEntity.g();
|
||||
+ double d0 = Math.abs(this.a.locX() - ((double) baseblockposition.getX() + 0.5D));
|
||||
+ double d1 = Math.abs(this.a.locY() - (double) baseblockposition.getY());
|
||||
+ double d2 = Math.abs(this.a.locZ() - ((double) baseblockposition.getZ() + 0.5D));
|
||||
+ boolean flag = d0 < (double) this.l && d2 < (double) this.l && d1 < 1.0D;
|
||||
|
||||
+ if (flag || this.a.b(pathEntity.h().l) && this.b(vec3d)) {
|
||||
+ pathEntity.c(pathEntity.f() + 1);
|
||||
+ }
|
||||
+
|
||||
+ this.applyPath0(pathEntity, vec3d);
|
||||
+ }
|
||||
+ // Akarin end
|
||||
private boolean b(Vec3D vec3d) {
|
||||
if (this.c.e() <= this.c.f() + 1) {
|
||||
return false;
|
||||
@@ -324,7 +429,39 @@ public abstract class NavigationAbstract {
|
||||
}
|
||||
|
||||
}
|
||||
+ // Akarin start - Async pathfinder, copied from above with param
|
||||
+ protected void applyPath0(PathEntity pathEntity, Vec3D vec3d) {
|
||||
+ if (this.e - this.f > 100) {
|
||||
+ if (vec3d.distanceSquared(this.g) < 2.25D) {
|
||||
+ this.o();
|
||||
+ }
|
||||
+
|
||||
+ this.f = this.e;
|
||||
+ this.g = vec3d;
|
||||
+ }
|
||||
+
|
||||
+ if (!pathEntity.b()) {
|
||||
+ BaseBlockPosition baseblockposition = pathEntity.g();
|
||||
+
|
||||
+ if (baseblockposition.equals(this.h)) {
|
||||
+ this.i += SystemUtils.getMonotonicMillis() - this.j;
|
||||
+ } else {
|
||||
+ this.h = baseblockposition;
|
||||
+ double d0 = vec3d.f(Vec3D.c(this.h));
|
||||
+
|
||||
+ this.k = this.a.dM() > 0.0F ? d0 / (double) this.a.dM() * 1000.0D : 0.0D;
|
||||
+ }
|
||||
+
|
||||
+ if (this.k > 0.0D && (double) this.i > this.k * 3.0D) {
|
||||
+ this.e();
|
||||
+ this.o();
|
||||
+ }
|
||||
+
|
||||
+ this.j = SystemUtils.getMonotonicMillis();
|
||||
+ }
|
||||
|
||||
+ }
|
||||
+ // Akarin end
|
||||
private void e() {
|
||||
this.h = BaseBlockPosition.ZERO;
|
||||
this.i = 0L;
|
||||
@@ -389,7 +526,11 @@ public abstract class NavigationAbstract {
|
||||
public boolean r() {
|
||||
return this.o.e();
|
||||
}
|
||||
-
|
||||
+ // Akarin start - Async pathfinder, copied from above with param
|
||||
+ public static boolean shouldContinuePathfind(PathEntity pathEntity) {
|
||||
+ return pathEntity == null || pathEntity.b();
|
||||
+ }
|
||||
+ // Akarin end
|
||||
public void b(BlockPosition blockposition) {
|
||||
if (this.c != null && !this.c.b() && this.c.e() != 0) { // Tuinity - diff on change - needed for isViableForPathRecalculationChecking()
|
||||
PathPoint pathpoint = this.c.c();
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
index 0c33a0c9d59d79a39826b5ee14144604717ffebe..cf3f4c1a2a89cce0345566a62faa34ef7e93c603 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
@@ -28,7 +28,7 @@ public class NavigationFlying extends NavigationAbstract {
|
||||
return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
|
||||
}
|
||||
|
||||
- @Override
|
||||
+/* @Override
|
||||
public void c() {
|
||||
++this.e;
|
||||
if (this.m) {
|
||||
@@ -53,6 +53,31 @@ public class NavigationFlying extends NavigationAbstract {
|
||||
this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d);
|
||||
}
|
||||
}
|
||||
+ }*/
|
||||
+
|
||||
+ // This was copied from above partly with param
|
||||
+ @Override
|
||||
+ public void doTickAsync(PathEntity pathEntity) {
|
||||
+ if (shouldContinuePathfind(pathEntity))
|
||||
+ return;
|
||||
+
|
||||
+ Vec3D vec3d;
|
||||
+ if (this.a()) {
|
||||
+ this.applyPath(pathEntity);
|
||||
+ } else if (pathEntity != null && pathEntity.f() < pathEntity.e()) {
|
||||
+ vec3d = pathEntity.a(this.a, pathEntity.f());
|
||||
+ if (MathHelper.floor(this.a.locX()) == MathHelper.floor(vec3d.x) && MathHelper.floor(this.a.locY()) == MathHelper.floor(vec3d.y) && MathHelper.floor(this.a.locZ()) == MathHelper.floor(vec3d.z)) {
|
||||
+ pathEntity.c(pathEntity.f() + 1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (shouldContinuePathfind(pathEntity))
|
||||
+ return;
|
||||
+ //PacketDebug.a(this.b, this.a, pathEntity, this.l);
|
||||
+ vec3d = pathEntity.a((Entity) this.a);
|
||||
+ BlockPosition blockposition = new BlockPosition(vec3d);
|
||||
+
|
||||
+ this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d);
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java
|
||||
index 22424e7e97015aae2ce3dc6c42eecef257e354e0..3365adb364fc9450dba773f4fe626b81c596f49c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Pathfinder.java
|
||||
+++ b/src/main/java/net/minecraft/server/Pathfinder.java
|
||||
@@ -23,7 +23,7 @@ public class Pathfinder {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public PathEntity a(ChunkCache chunkcache, EntityInsentient entityinsentient, Set<BlockPosition> set, float f, int i, float f1) {
|
||||
+ public synchronized PathEntity a(ChunkCache chunkcache, EntityInsentient entityinsentient, Set<BlockPosition> set, float f, int i, float f1) { // Akarin - synchronized
|
||||
this.d.a();
|
||||
this.c.a(chunkcache, entityinsentient);
|
||||
PathPoint pathpoint = this.c.b();
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderTurtle.java b/src/main/java/net/minecraft/server/PathfinderTurtle.java
|
||||
index cea160885783e8666b616375eac44ba6d1880e1f..9598563b4f97500fd3fba0165813d564d9c96c4f 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderTurtle.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderTurtle.java
|
||||
@@ -148,7 +148,7 @@ public class PathfinderTurtle extends PathfinderNormal {
|
||||
if (pathtype == PathType.OPEN) {
|
||||
AxisAlignedBB axisalignedbb = new AxisAlignedBB((double) i - d2 + 0.5D, (double) j + 0.001D, (double) k - d2 + 0.5D, (double) i + d2 + 0.5D, (double) ((float) j + this.b.getHeight()), (double) k + d2 + 0.5D);
|
||||
|
||||
- if (!this.b.world.getCubes(this.b, axisalignedbb)) {
|
||||
+ if (!this.a.getCubes(this.b, axisalignedbb)) { // Akarin - use chunk cache
|
||||
return null;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderWater.java b/src/main/java/net/minecraft/server/PathfinderWater.java
|
||||
index fba6692a1e537b90e20aa448567c0ad6db653332..d576edc8c30288e98aeda8f1cb561b22c6b37536 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderWater.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderWater.java
|
||||
@@ -63,7 +63,7 @@ public class PathfinderWater extends PathfinderAbstract {
|
||||
@Override
|
||||
protected PathPoint a(int i, int j, int k) {
|
||||
PathPoint pathpoint = null;
|
||||
- PathType pathtype = this.a(this.b.world, i, j, k);
|
||||
+ PathType pathtype = this.a(this.a, i, j, k); // Akarin - use chunk cache
|
||||
float f = this.b.a(pathtype);
|
||||
|
||||
if (f >= 0.0F) {
|
30
scripts/fixPatch.sh
Normal file
30
scripts/fixPatch.sh
Normal file
@ -0,0 +1,30 @@
|
||||
cd Yatopia-$2
|
||||
for filename in $1/patches/$2/*.patch; do
|
||||
# Abort previous applying operation
|
||||
git am --abort >/dev/null 2>&1
|
||||
# Apply our patches on top Paper in our dirs
|
||||
git am --reject --whitespace=fix --no-utf8 --3way --ignore-whitespace $filename || (
|
||||
#files=`$gitcmd diff --name-only | grep -E '.rej$' `
|
||||
#if [[ files != null ]]; then
|
||||
# for filerej in files; do
|
||||
# echo "Error found .rej file! Deleting. This might have unforseen consqunces!"
|
||||
# rm -f filerej
|
||||
# done
|
||||
#fi
|
||||
filenamend="${filename##*/}"
|
||||
filenamens=${filenamend%/*}
|
||||
filenameedited=${filenamens%.*} # retain the part before the period
|
||||
filenameedited=${filenameedited:5} # retain the part after the frist slash
|
||||
git add .
|
||||
git commit -m $filenameedited
|
||||
)
|
||||
echo "Press any key to continue"
|
||||
while [ true ] ; do
|
||||
read -t 3 -n 1
|
||||
if [ $? = 0 ] ; then
|
||||
exit ;
|
||||
else
|
||||
echo "waiting for the keypress"
|
||||
fi
|
||||
done
|
||||
done
|
Loading…
Reference in New Issue
Block a user