1.18 misc performance dev branch (#7368)

- Port player chunk loader patch
Makes the chunk system act as it did in 1.17, no additional tickets (and thus logic) to make a chunk ticking.
Adds simulation distance API, deprecates old no-tick method.
- More collision optimisations
Ancient patch from tuinity that never could be pushed to master.
- Fix Optimise ArraySetSorted#removeIf patch
- Execute chunk tasks fairly for worlds while waiting for next tick
- Port Replace ticket level propagator
This commit is contained in:
Spottedleaf 2022-02-18 09:44:46 -08:00
commit 722983fbc7
14 changed files with 3258 additions and 97 deletions

View file

@ -23,13 +23,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ void setViewDistance(int viewDistance);
+
+ /**
+ * Sets the simulation distance for this world.
+ * @param simulationDistance simulation distance in [2, 32]
+ */
+ void setSimulationDistance(int simulationDistance);
+
+ /**
+ * Returns the no-tick view distance for this world.
+ * <p>
+ * No-tick view distance is the view distance where chunks will load, however the chunks and their entities will not
+ * be set to tick.
+ * </p>
+ * @return The no-tick view distance for this world.
+ * @deprecated Use {@link #getViewDistance()}
+ */
+ @Deprecated
+ int getNoTickViewDistance();
+
+ /**
@ -39,7 +47,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * be set to tick.
+ * </p>
+ * @param viewDistance view distance in [2, 32]
+ * @deprecated Use {@link #setViewDistance(int)}
+ */
+ @Deprecated
+ void setNoTickViewDistance(int viewDistance);
+
+ /**
@ -49,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * </p>
+ * @return The sending view distance for this world.
+ */
+ public int getSendViewDistance();
+ int getSendViewDistance();
+
+ /**
+ * Sets the sending view distance for this world.
@ -58,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * </p>
+ * @param viewDistance view distance in [2, 32] or -1
+ */
+ public void setSendViewDistance(int viewDistance);
+ void setSendViewDistance(int viewDistance);
+ // Paper end - view distance api
+
// Spigot start
@ -78,7 +88,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @return the player's view distance
+ * @see org.bukkit.World#getViewDistance()
+ * @see org.bukkit.World#getNoTickViewDistance()
+ */
+ public int getViewDistance();
+
@ -87,9 +96,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param viewDistance the player's view distance
+ * @see org.bukkit.World#setViewDistance(int)
+ * @see org.bukkit.World#setNoTickViewDistance(int)
+ */
+ public void setViewDistance(int viewDistance);
+
+ /**
+ * Gets the simulation distance for this player
+ *
+ * @return the player's simulation distance
+ */
+ public int getSimulationDistance();
+
+ /**
+ * Sets the simulation distance for this player
+ *
+ * @param simulationDistance the player's new simulation distance
+ */
+ public void setSimulationDistance(int simulationDistance);
+
+ /**
+ * Gets the no-ticking view distance for this player.
@ -98,7 +120,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * be set to tick.
+ * </p>
+ * @return The no-tick view distance for this player.
+ * @deprecated Use {@link #getViewDistance()}
+ */
+ @Deprecated
+ public int getNoTickViewDistance();
+
+ /**
@ -108,7 +132,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * be set to tick.
+ * </p>
+ * @param viewDistance view distance in [2, 32] or -1
+ * @deprecated Use {@link #setViewDistance(int)}
+ */
+ @Deprecated
+ public void setNoTickViewDistance(int viewDistance);
+
+ /**