mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-19 15:09:27 +00:00
Rebuild patches
This commit is contained in:
2
Tuinity
2
Tuinity
Submodule Tuinity updated: 7d36676fc0...1222573d03
@@ -5,7 +5,7 @@ Subject: [PATCH] new fork who dis - Rebrand to SparklyPaper
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 6c200882954adc4831307f3d6dfa3202571fb30b..9299aa2b3f41ed09113e6e20b5fbc3f57e8a748b 100644
|
||||
index 4d826aa8ea1139e66514767da6ba17811f7ecc5c..e3f3acbc37030d3fdee8d829e7db1eb31994bf9d 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
@@ -68,10 +68,10 @@ index 7063f1da3654b382e26b0093ad5d0ff04a2b38c2..b6ee4e6e4c223f61874cc8c5817ed68d
|
||||
|
||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 02d8a8f13d81c47316f704fb700afd0214a5f546..49fe85225442783f35377961f8d3f9ddc6d71392 100644
|
||||
index 2767a9369ddc922f1d9c7cb6c7acc8270545535a..c1d50f7abf6f059123b8760c10ba0ff3633f0716 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1636,7 +1636,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@@ -1646,7 +1646,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
@@ -81,7 +81,7 @@ index 02d8a8f13d81c47316f704fb700afd0214a5f546..49fe85225442783f35377961f8d3f9dd
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index fd3333fef4112e6469ccd316ba2c82926c04e5db..79b684e3b1d572c3d294f92dffc2c64bb8ae4472 100644
|
||||
index ce2fb6288edb871414c44d003ac63ff4045a820a..4f31f172a8712263dd43a1f31d5f146960f748d8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -232,7 +232,7 @@ import javax.annotation.Nullable; // Paper
|
||||
|
||||
@@ -55,7 +55,7 @@ index cc566784c7dd21cc2c44e0f351347f657e57ddcf..e9e7fcf2b63febe2a7d055826fabb86b
|
||||
return d0 == 0.0D ? 0 : (d0 > 0.0D ? 1 : -1);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index d933323d57a2a7ff283408f12d4650699f8177e7..d1afe52dfd2da1d168a62aa339b48fb044e7ff50 100644
|
||||
index 96cc46a26eef701b0579f3407e67af9176e1743b..5c7ce20609a1c18687696581a76f21a1b182ea7c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -111,6 +111,7 @@ import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
@@ -23,7 +23,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index fcf9af44702f34d75185eee0b3259fe0e57001b1..c2711c2d5405a5ddcf99ce7a4fbc997b403bd2f2 100644
|
||||
index a42d3c6c227a74d691278a65a9c516f6507b6865..ef368c38fbbf26cc2f6cf4159707d3d581e85be4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -1212,7 +1212,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
@@ -46,7 +46,7 @@ index fe040615ff03478a20cdf8376f89a6b7d100ba61..207a9c3928aad7c6e89a120b54d87e00
|
||||
boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index c2711c2d5405a5ddcf99ce7a4fbc997b403bd2f2..78443d5bf8f1f297cf68a88d8caf8e8abc9cdba7 100644
|
||||
index ef368c38fbbf26cc2f6cf4159707d3d581e85be4..ce428fd701fe4a0505a629edb322f19d730f8132 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -1202,6 +1202,8 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index d1afe52dfd2da1d168a62aa339b48fb044e7ff50..5c983a441cd2a06eae6e79bc07ba5440d294574b 100644
|
||||
index 5c7ce20609a1c18687696581a76f21a1b182ea7c..74f80b6af18c0b91d9613384ca6bafd9c89f23a4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -910,11 +910,13 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
@@ -39,7 +39,7 @@ index 8edc279e7a3fdfb7e10718f1deee34b7e3fb2f28..73ec17dea5d5668e49c9a6ad679bd3a3
|
||||
@Override
|
||||
public BlockPosition shift(EnumDirection enumdirection, int i) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
index d7eede51f1c4ebbe8e00b16efd6331c87db53bb4..bc18b9c3aac4c5feeb1603554e0ac009af9b457e 100644
|
||||
index b28995ecfd7f45e6b6197be96c418aa0d05d3383..914c7a1b18151f29183cfe9474313ce18e7c4ae2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
@@ -705,7 +705,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
@@ -74,7 +74,7 @@ index d7eede51f1c4ebbe8e00b16efd6331c87db53bb4..bc18b9c3aac4c5feeb1603554e0ac009
|
||||
|
||||
return Math.max(Math.abs(k), Math.abs(l));
|
||||
}
|
||||
@@ -2571,11 +2577,17 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2541,11 +2547,17 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
boolean flag1 = this.tracker.attachedToPlayer;
|
||||
|
||||
if (!flag1) {
|
||||
@@ -94,7 +94,7 @@ index d7eede51f1c4ebbe8e00b16efd6331c87db53bb4..bc18b9c3aac4c5feeb1603554e0ac009
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2605,8 +2617,10 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2575,8 +2587,10 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
}
|
||||
|
||||
private int b() {
|
||||
@@ -106,7 +106,7 @@ index d7eede51f1c4ebbe8e00b16efd6331c87db53bb4..bc18b9c3aac4c5feeb1603554e0ac009
|
||||
Iterator iterator = collection.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -2618,6 +2632,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2588,6 +2602,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ index d7eede51f1c4ebbe8e00b16efd6331c87db53bb4..bc18b9c3aac4c5feeb1603554e0ac009
|
||||
return this.a(i);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index 78443d5bf8f1f297cf68a88d8caf8e8abc9cdba7..49c8fc7f33edc7e6c5eb76544141d12153b52312 100644
|
||||
index ce428fd701fe4a0505a629edb322f19d730f8132..136faf61770011a830cc58259d1dad11830ca808 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -1107,7 +1107,28 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Reduce entity chunk ticking checks from 3 to 1
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index 49c8fc7f33edc7e6c5eb76544141d12153b52312..d13c6f4c368ca6fe3326b66d4c3ef94cf166e7e3 100644
|
||||
index 136faf61770011a830cc58259d1dad11830ca808..26379b411d35818bfe59c1b39e2f90417a67c969 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -1083,11 +1083,12 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Cache entityhuman display name
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
index 44038dd278b988508047023107683e5370af54ad..ad85dda5c50b797904824a08513fbcec042128ea 100644
|
||||
index 5bce47fa8f191bc1d33c04c9865cb0efd492a9a2..5f9e64df007ebc40f7bcb50be495b10e51d5b87a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
@@ -162,7 +162,8 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
@@ -18,7 +18,7 @@ index 44038dd278b988508047023107683e5370af54ad..ad85dda5c50b797904824a08513fbcec
|
||||
private ItemStack bL;
|
||||
private final ItemCooldown bM;
|
||||
@Nullable
|
||||
@@ -1828,7 +1829,12 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
@@ -1840,7 +1841,12 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
@Override
|
||||
public IChatBaseComponent getDisplayName() {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] More debug for plugins not shutting down tasks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 79b684e3b1d572c3d294f92dffc2c64bb8ae4472..44842dd0809868238d0cc3a308a8d8348f804dcf 100644
|
||||
index 4f31f172a8712263dd43a1f31d5f146960f748d8..82049a1b683de1f57ea8896349aa97de46a31289 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -978,6 +978,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
22
patches/server/0024-Optimize-redundant-calls.patch
Normal file
22
patches/server/0024-Optimize-redundant-calls.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Fri, 23 Apr 2021 15:00:30 -0500
|
||||
Subject: [PATCH] Optimize redundant calls
|
||||
|
||||
Just pushing this because I want numbers on it, according to both CPU
|
||||
tracking and async sampling this is something that causes a discernable
|
||||
(1.5%) impact on performance.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java
|
||||
index 58e14c174cdf76cdea861fd3d4d1195fa27f888a..fedd0482bd4ff8cc5857a71f509700df4490b8fb 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java
|
||||
@@ -215,7 +215,7 @@ public abstract class ChunkMapDistance {
|
||||
public boolean a(PlayerChunkMap playerchunkmap) {
|
||||
com.tuinity.tuinity.util.TickThread.softEnsureTickThread("Cannot tick ChunkMapDistance off of the main-thread");// Tuinity
|
||||
//this.f.a(); // Paper - no longer used
|
||||
- AsyncCatcher.catchOp("DistanceManagerTick"); // Paper
|
||||
+ //AsyncCatcher.catchOp("DistanceManagerTick"); // Paper // Airplane - leave up to softEnsures
|
||||
//this.g.a(); // Tuinity - no longer used
|
||||
boolean flag = this.ticketLevelPropagator.propagateUpdates(); // Tuinity - replace ticket level propagator
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Fri, 23 Apr 2021 18:12:08 -0500
|
||||
Subject: [PATCH] Skip creating hashset for entity track range
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index feab0ae1930b5271fe0d06a40c180317dcbc9d1d..1d1721ee1bbf94214a175f42c1a26841b7bc1354 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -316,10 +316,39 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
this.isLegacyTrackingEntity = isLegacyTrackingEntity;
|
||||
}
|
||||
|
||||
+ // Airplane start - behavior of getAllPassengers + getting bigger range
|
||||
+ private org.spigotmc.TrackingRange.TrackingRangeType getBiggestRangeOfPassengers(net.minecraft.server.level.PlayerChunkMap chunkMap, int[] range, Entity entity) {
|
||||
+ org.spigotmc.TrackingRange.TrackingRangeType type = null;
|
||||
+
|
||||
+ for (int i = 0; i < entity.passengers.size(); i++) {
|
||||
+ Entity passenger = entity.passengers.get(i);
|
||||
+ org.spigotmc.TrackingRange.TrackingRangeType passengerType = passenger.trackingRangeType;
|
||||
+ int passengerRange = chunkMap.getEntityTrackerRange(passengerType.ordinal());
|
||||
+ if (passengerRange > range[0]) {
|
||||
+ type = passengerType;
|
||||
+ range[0] = passengerRange;
|
||||
+ }
|
||||
+
|
||||
+ org.spigotmc.TrackingRange.TrackingRangeType childType = this.getBiggestRangeOfPassengers(chunkMap, range, passenger);
|
||||
+ if (childType != null) {
|
||||
+ type = childType;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return type;
|
||||
+ }
|
||||
+ // Airplane end
|
||||
+
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> getPlayersInTrackRange() {
|
||||
+ // Airplane start - replicate behavior of getAllPassengers to skip creating hashset
|
||||
+ /*
|
||||
Collection<Entity> passengers = this.getAllPassengers();
|
||||
+ */
|
||||
net.minecraft.server.level.PlayerChunkMap chunkMap = ((WorldServer)this.world).getChunkProvider().playerChunkMap;
|
||||
org.spigotmc.TrackingRange.TrackingRangeType type = this.trackingRangeType;
|
||||
+ type = this.getBiggestRangeOfPassengers(chunkMap, new int[]{chunkMap.getEntityTrackerRange(type.ordinal())}, this);
|
||||
+ if (type == null) type = this.trackingRangeType;
|
||||
+ /*
|
||||
int range = chunkMap.getEntityTrackerRange(type.ordinal());
|
||||
|
||||
for (Entity passenger : passengers) {
|
||||
@@ -330,8 +359,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
range = passengerRange;
|
||||
}
|
||||
}
|
||||
+ */
|
||||
+ // Airplane end
|
||||
|
||||
- return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this));
|
||||
+ return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this.chunkX, this.chunkZ)); // Airplane - don't convert doubles to ints here
|
||||
}
|
||||
// Paper end - optimise entity tracking
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Mon, 26 Apr 2021 10:52:56 -0500
|
||||
Subject: [PATCH] Cache climbing check for activation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index 74f80b6af18c0b91d9613384ca6bafd9c89f23a4..003e1f6dc8efbabcb2e0f7a6b379196f02203903 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -1745,6 +1745,19 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Airplane start
|
||||
+ private boolean cachedIsClimbing = false;
|
||||
+ private BlockPosition lastClimbingPosition = null;
|
||||
+
|
||||
+ public boolean isClimbingCached() {
|
||||
+ if (!this.getChunkCoordinates().equals(this.lastClimbingPosition)) {
|
||||
+ this.cachedIsClimbing = this.isClimbing();
|
||||
+ this.lastClimbingPosition = this.getChunkCoordinates();
|
||||
+ }
|
||||
+ return this.cachedIsClimbing;
|
||||
+ }
|
||||
+ // Airplane end
|
||||
+
|
||||
public IBlockData ds() {
|
||||
return this.world.getType(this.getChunkCoordinates());
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 5c2eaca0bc63c7880ee928aba6a24761737aa649..eae6d46e1f894f6eca966ca3ad51aca61153fc3e 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -297,7 +297,7 @@ public class ActivationRange
|
||||
if ( entity instanceof EntityLiving )
|
||||
{
|
||||
EntityLiving living = (EntityLiving) entity;
|
||||
- if ( living.isClimbing() || living.jumping || living.hurtTicks > 0 || living.effects.size() > 0 ) // Paper
|
||||
+ if ( living.isClimbingCached() || living.jumping || living.hurtTicks > 0 || living.effects.size() > 0 ) // Paper // Airplane - use cached climbing
|
||||
{
|
||||
return 1; // Paper
|
||||
}
|
||||
36
patches/server/0027-Cache-coordinate-key-for-micro-opt.patch
Normal file
36
patches/server/0027-Cache-coordinate-key-for-micro-opt.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Mon, 26 Apr 2021 11:26:37 -0500
|
||||
Subject: [PATCH] Cache coordinate key for micro opt
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java
|
||||
index 86f156587a0939b28c5cf6f64907255c1c4f8b35..06157bb07cce3ba24087ceaca7138b5609b37b5b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java
|
||||
@@ -58,6 +58,7 @@ public class PlayerChunk {
|
||||
private int ticketLevel; public final void setTicketLevel(final int level) { this.ticketLevel = level; } // Tuinity - OBFHELPER
|
||||
volatile int n; public final int getCurrentPriority() { return n; } // Paper - OBFHELPER - make volatile since this is concurrently accessed
|
||||
public final ChunkCoordIntPair location; // Paper - private -> public
|
||||
+ private final long coordinateKey; // Airplane - cache key for location
|
||||
private boolean p;
|
||||
private final ShortSet[] dirtyBlocks;
|
||||
private int r;
|
||||
@@ -80,7 +81,7 @@ public class PlayerChunk {
|
||||
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> playersInChunkTickRange;
|
||||
|
||||
void updateRanges() {
|
||||
- long key = net.minecraft.server.MCUtil.getCoordinateKey(this.location);
|
||||
+ long key = this.coordinateKey; //net.minecraft.server.MCUtil.getCoordinateKey(this.location); // Airplane - use cached key
|
||||
this.playersInMobSpawnRange = this.chunkMap.playerMobSpawnMap.getObjectsInRange(key);
|
||||
this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key);
|
||||
// Tuinity start - optimise checkDespawn
|
||||
@@ -232,7 +233,7 @@ public class PlayerChunk {
|
||||
this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
this.chunkSave = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.dirtyBlocks = new ShortSet[16];
|
||||
- this.location = chunkcoordintpair;
|
||||
+ this.location = chunkcoordintpair; this.coordinateKey = net.minecraft.server.MCUtil.getCoordinateKey(this.location); // Airplane
|
||||
this.lightEngine = lightengine;
|
||||
this.u = playerchunk_c;
|
||||
this.players = playerchunk_d;
|
||||
64
patches/server/0028-Use-array-for-gamerule-storage.patch
Normal file
64
patches/server/0028-Use-array-for-gamerule-storage.patch
Normal file
@@ -0,0 +1,64 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Sun, 9 May 2021 16:49:49 -0500
|
||||
Subject: [PATCH] Use array for gamerule storage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
index 3783f3a83e3e70d77cf0fa1021f62a89c5950af5..d0c63be6ebfa2f95fb3d63eed2e11b1c5cd6384e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/GameRules.java
|
||||
@@ -86,6 +86,7 @@ public class GameRules {
|
||||
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> FORGIVE_DEAD_PLAYERS = a("forgiveDeadPlayers", GameRules.GameRuleCategory.MOBS, GameRules.GameRuleBoolean.b(true));
|
||||
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> UNIVERSAL_ANGER = a("universalAnger", GameRules.GameRuleCategory.MOBS, GameRules.GameRuleBoolean.b(false));
|
||||
private final Map<GameRules.GameRuleKey<?>, GameRules.GameRuleValue<?>> J;
|
||||
+ private final GameRules.GameRuleValue<?>[] gameruleArray;
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> GameRules.GameRuleKey<T> a(String s, GameRules.GameRuleCategory gamerules_gamerulecategory, GameRules.GameRuleDefinition<T> gamerules_gameruledefinition) {
|
||||
GameRules.GameRuleKey<T> gamerules_gamerulekey = new GameRules.GameRuleKey<>(s, gamerules_gamerulecategory);
|
||||
@@ -104,17 +105,31 @@ public class GameRules {
|
||||
}
|
||||
|
||||
public GameRules() {
|
||||
- this.J = (Map) GameRules.I.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry) -> {
|
||||
+ // Airplane start - use this()
|
||||
+ this((Map) GameRules.I.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry) -> {
|
||||
return ((GameRules.GameRuleDefinition) entry.getValue()).getValue();
|
||||
- }));
|
||||
+ })));
|
||||
+ // Airplane end
|
||||
}
|
||||
|
||||
private GameRules(Map<GameRules.GameRuleKey<?>, GameRules.GameRuleValue<?>> map) {
|
||||
this.J = map;
|
||||
+
|
||||
+ int arraySize = map.keySet().stream().mapToInt(key -> key.gameRuleIndex).max().orElse(-1) + 1;
|
||||
+ GameRules.GameRuleValue<?>[] values = new GameRules.GameRuleValue[arraySize];
|
||||
+
|
||||
+ for (Entry<GameRuleKey<?>, GameRuleValue<?>> entry : map.entrySet()) {
|
||||
+ values[entry.getKey().gameRuleIndex] = entry.getValue();
|
||||
+ }
|
||||
+
|
||||
+ this.gameruleArray = values;
|
||||
}
|
||||
|
||||
public <T extends GameRules.GameRuleValue<T>> T get(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- return (T) this.J.get(gamerules_gamerulekey); // CraftBukkit - decompile error
|
||||
+ // Airplane start
|
||||
+ return gamerules_gamerulekey == null ? null : (T) this.gameruleArray[gamerules_gamerulekey.gameRuleIndex];
|
||||
+ //return (T) this.J.get(gamerules_gamerulekey); // CraftBukkit - decompile error
|
||||
+ // Airplane end
|
||||
}
|
||||
|
||||
public NBTTagCompound a() {
|
||||
@@ -357,6 +372,10 @@ public class GameRules {
|
||||
}
|
||||
|
||||
public static final class GameRuleKey<T extends GameRules.GameRuleValue<T>> {
|
||||
+ // Airplane start
|
||||
+ private static int lastGameRuleIndex = 0;
|
||||
+ public final int gameRuleIndex = lastGameRuleIndex++;
|
||||
+ // Airplane end
|
||||
|
||||
private final String a;
|
||||
private final GameRules.GameRuleCategory b;
|
||||
@@ -0,0 +1,101 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Sauve <paul@technove.co>
|
||||
Date: Sun, 9 May 2021 19:32:29 -0500
|
||||
Subject: [PATCH] Use list for fast iteration over pathfinder goals
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/airplane/structs/LinkedHashSetArrayList.java b/src/main/java/gg/airplane/structs/LinkedHashSetArrayList.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..36eea0acd815e08e0be10bf55541ea0bb605b8f5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/airplane/structs/LinkedHashSetArrayList.java
|
||||
@@ -0,0 +1,35 @@
|
||||
+package gg.airplane.structs;
|
||||
+
|
||||
+import java.util.AbstractSet;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+
|
||||
+/*
|
||||
+ * Used when you want fast iteration more than fast contain/remove
|
||||
+ */
|
||||
+public class LinkedHashSetArrayList<E> extends AbstractSet<E> {
|
||||
+ private final List<E> internal = new ArrayList<>();
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean add(E e) {
|
||||
+ if (this.internal.contains(e)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return this.internal.add(e);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Iterator<E> iterator() {
|
||||
+ return this.internal.iterator();
|
||||
+ }
|
||||
+
|
||||
+ public E get(int index) {
|
||||
+ return this.internal.get(index);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int size() {
|
||||
+ return this.internal.size();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java
|
||||
index 637928664f8c7b1c694a234e507c20724294e450..47a5a1bdf8f662877bb4556e30e5665805fe21b5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java
|
||||
@@ -28,7 +28,7 @@ public class PathfinderGoalSelector {
|
||||
}
|
||||
};
|
||||
private final Map<PathfinderGoal.Type, PathfinderGoalWrapped> c = new EnumMap(PathfinderGoal.Type.class);
|
||||
- private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet(); public final Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public
|
||||
+ private final gg.airplane.structs.LinkedHashSetArrayList<PathfinderGoalWrapped> d = new gg.airplane.structs.LinkedHashSetArrayList<>(); public final Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public // Airplane - it's a set, but it's an arraylist
|
||||
private final Supplier<GameProfilerFiller> e;
|
||||
private final EnumSet<PathfinderGoal.Type> f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
|
||||
private final OptimizedSmallEnumSet<PathfinderGoal.Type> goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector
|
||||
@@ -80,8 +80,11 @@ public class PathfinderGoalSelector {
|
||||
|
||||
gameprofilerfiller.enter("goalCleanup");
|
||||
// Paper start - remove streams from pathfindergoalselector
|
||||
- for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
- PathfinderGoalWrapped wrappedGoal = iterator.next();
|
||||
+ // Airplane start - remove iterators from pathfindergoalselector
|
||||
+ //for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
+ // PathfinderGoalWrapped wrappedGoal = iterator.next();
|
||||
+ for (int goalIndex = 0; goalIndex < this.d.size(); goalIndex++) {
|
||||
+ PathfinderGoalWrapped wrappedGoal = this.d.get(goalIndex);
|
||||
if (!wrappedGoal.g()) {
|
||||
continue;
|
||||
}
|
||||
@@ -100,8 +103,10 @@ public class PathfinderGoalSelector {
|
||||
gameprofilerfiller.exit();
|
||||
gameprofilerfiller.enter("goalUpdate");
|
||||
// Paper start - remove streams from pathfindergoalselector
|
||||
- goal_update_loop: for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
- PathfinderGoalWrapped wrappedGoal = iterator.next();
|
||||
+ // Airplane start - remove iterators from pathfindergoalselector
|
||||
+ goal_update_loop: for (int goalIndex = 0; goalIndex < this.d.size(); goalIndex++) { //for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
+ PathfinderGoalWrapped wrappedGoal = this.d.get(goalIndex);
|
||||
+ // Airplane end
|
||||
if (wrappedGoal.g()) {
|
||||
continue;
|
||||
}
|
||||
@@ -144,8 +149,11 @@ public class PathfinderGoalSelector {
|
||||
gameprofilerfiller.exit();
|
||||
gameprofilerfiller.enter("goalTick");
|
||||
// Paper start - remove streams from pathfindergoalselector
|
||||
- for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
- PathfinderGoalWrapped wrappedGoal = iterator.next();
|
||||
+ // Airplane start - remove iterators from pathfindergoalselector
|
||||
+ //for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
|
||||
+ // PathfinderGoalWrapped wrappedGoal = iterator.next();
|
||||
+ for (int goalIndex = 0; goalIndex < this.d.size(); goalIndex++) { PathfinderGoalWrapped wrappedGoal = this.d.get(goalIndex);
|
||||
+ // Airplane end
|
||||
if (wrappedGoal.g()) {
|
||||
wrappedGoal.e();
|
||||
}
|
||||
Reference in New Issue
Block a user