mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
Updated Upstream (Paper, Tuinity, & Airplane)
Upstream has released updates that appear to apply and compile correctly Paper Changes: 8c74d3126 Updated Upstream (Bukkit) (#5359) fd3c66a91 bug #5362 - correctly pass "render type" when registering a new scoreboard objective 39c487b37 Add per-command perms for paper command cdbf2578c Add Item Rarity API (#5352) d80e43647 [CI-SKIP] Removal from the MIT list (#5345) Tuinity Changes: aea6b8347 Merge dev/playerchunkloading 722c7ca8a Use hash table for maintaing changed block set 98ae59d85 Custom table implementation for blockstate state lookups 8b8704fb6 Oprimise map impl for tracked players ea71d6ba4 Optimise snow & ice in chunk ticking 9871d4ce5 Remove chunk lookup & lambda allocation from counting mobs 5a4a35f3e Add patreon 7d93d9618 Refactor data management for region manager c3035219f Change license from MIT to LGPLv3 Airplane Changes: 580f380b6 Updated Upstream (Tuinity) 82253fd36 Early return optimization for target finding 9572643bb Cache entityhuman display name 5df98254f Remove iterators from inventory contains 18d2be193 Merge pull request #14 from violetwtf/patch-1 f716d4c33 Merge pull request #13 from violetwtf/master 128cbe519 Reduce entity chunk ticking checks from 3 to 1 03ac0933b Skip copying unloading tile entities 97dd027b5 Smaller pool size for tracking 9e9f57be4 Only set up Flare if token is available
This commit is contained in:
@@ -709,7 +709,7 @@ index c56e7fb18f9a56c8025eb70a524f028b5942da37..f39452535b2807a226ada095f5c21b19
|
||||
TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
|
||||
TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses", "settings.velocity-support.secret"));
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index 7063f1da3654b382e26b0093ad5d0ff04a2b38c2..dd2a1b1c72426c4172cfbd20f0c84ffd073df484 100644
|
||||
index 7063f1da3654b382e26b0093ad5d0ff04a2b38c2..b9c5479e5561f8fe68ea8f94fbf4e64de8a53bf9 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -28,8 +28,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
@@ -718,8 +718,8 @@ index 7063f1da3654b382e26b0093ad5d0ff04a2b38c2..dd2a1b1c72426c4172cfbd20f0c84ffd
|
||||
public Component getVersionMessage(@Nonnull String serverVersion) {
|
||||
- String[] parts = serverVersion.substring("git-Tuinity-".length()).split("[-\\s]"); // Tuinity
|
||||
- final Component updateMessage = getUpdateStatusMessage("Spottedleaf/Tuinity", GITHUB_BRANCH_NAME, parts[0]); // Tuinity
|
||||
+ String[] parts = serverVersion.substring("git-Airplane-".length()).split("[-\\s]"); // Airplane // Tuinity
|
||||
+ final Component updateMessage = getUpdateStatusMessage("TECHNOVE/Airplane", GITHUB_BRANCH_NAME, parts[0]); // Airplane // Tuinity
|
||||
+ String[] parts = serverVersion.substring("git-Airplane-".length()).split("[-\\s]"); // Tuinity
|
||||
+ final Component updateMessage = getUpdateStatusMessage("TECHNOVE/Airplane", GITHUB_BRANCH_NAME, parts[0]); // Tuinity
|
||||
final Component history = getHistory();
|
||||
|
||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||
@@ -800,10 +800,10 @@ index 0000000000000000000000000000000000000000..1fa9b40e2f89272fa8bc9d927a9a852b
|
||||
+}
|
||||
diff --git a/src/main/java/gg/airplane/AirplaneConfig.java b/src/main/java/gg/airplane/AirplaneConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e183b6cae23935823fa9e0f767e499a8102b0ad1
|
||||
index 0000000000000000000000000000000000000000..424325ada75b788ce390378d8df0116e5c50cf3d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/airplane/AirplaneConfig.java
|
||||
@@ -0,0 +1,104 @@
|
||||
@@ -0,0 +1,107 @@
|
||||
+package gg.airplane;
|
||||
+
|
||||
+import gg.airplane.manual.ManualParser;
|
||||
@@ -891,6 +891,9 @@ index 0000000000000000000000000000000000000000..e183b6cae23935823fa9e0f767e499a8
|
||||
+
|
||||
+ accessToken = manual.get("web-services.token", "");
|
||||
+ // todo lookup token (off-thread) and let users know if their token is valid
|
||||
+ if (accessToken.length() > 0) {
|
||||
+ gg.airplane.flare.FlareSetup.init(); // Airplane
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
@@ -1034,10 +1037,10 @@ index 0000000000000000000000000000000000000000..f4976428bc721319d2926e97cbe0f64c
|
||||
+}
|
||||
diff --git a/src/main/java/gg/airplane/flare/FlareCommand.java b/src/main/java/gg/airplane/flare/FlareCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..81f5267d287138f6b47aa0a1f1d59d2d91a7e34a
|
||||
index 0000000000000000000000000000000000000000..e3ef62ae97b8b92459e1c405525790ba2172df01
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/airplane/flare/FlareCommand.java
|
||||
@@ -0,0 +1,158 @@
|
||||
@@ -0,0 +1,159 @@
|
||||
+package gg.airplane.flare;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
@@ -1062,6 +1065,7 @@ index 0000000000000000000000000000000000000000..81f5267d287138f6b47aa0a1f1d59d2d
|
||||
+
|
||||
+public class FlareCommand extends Command {
|
||||
+
|
||||
+ private static final String BASE_URL = "https://blog.airplane.gg/flare-tutorial/#setting-the-access-token";
|
||||
+ private static final ChatColor HEX = ChatColor.of("#6a7eda");
|
||||
+ private static final BaseComponent[] PREFIX = new ComponentBuilder("Flare ✈ ")
|
||||
+ .color(HEX)
|
||||
@@ -1087,10 +1091,10 @@ index 0000000000000000000000000000000000000000..81f5267d287138f6b47aa0a1f1d59d2d
|
||||
+ public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
+ if (!testPermission(sender)) return true;
|
||||
+ if (AirplaneConfig.accessToken.length() == 0) {
|
||||
+ BaseComponent clickable = new TextComponent("https://blog.airplane.gg/flare");
|
||||
+ BaseComponent clickable = new TextComponent(BASE_URL);
|
||||
+ clickable.setUnderlined(true);
|
||||
+ clickable.setColor(HEX);
|
||||
+ clickable.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://blog.airplane.gg/flare"));
|
||||
+ clickable.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, BASE_URL));
|
||||
+
|
||||
+ sender.sendMessage(create(new ComponentBuilder("Flare currently requires an access token to use. To learn more, visit ")
|
||||
+ .color(HEX)
|
||||
@@ -1637,7 +1641,7 @@ index 0000000000000000000000000000000000000000..ace29adb0f140d99a8d85ac824654bed
|
||||
+}
|
||||
diff --git a/src/main/java/gg/airplane/structs/TrackQueue.java b/src/main/java/gg/airplane/structs/TrackQueue.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..601694aa6d36ce230d84cc6b55231d2fc3af30e9
|
||||
index 0000000000000000000000000000000000000000..e72229128285e1a48b9b461620620976ca0dc0a4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/airplane/structs/TrackQueue.java
|
||||
@@ -0,0 +1,84 @@
|
||||
@@ -1658,7 +1662,7 @@ index 0000000000000000000000000000000000000000..601694aa6d36ce230d84cc6b55231d2f
|
||||
+public class TrackQueue {
|
||||
+
|
||||
+ private final IteratorSafeOrderedReferenceSet<Chunk> chunks;
|
||||
+ private final ForkJoinPool pool = ForkJoinPool.commonPool();
|
||||
+ private final ForkJoinPool pool = new ForkJoinPool(Math.max(4, Runtime.getRuntime().availableProcessors() >> 2));
|
||||
+ private final AtomicInteger taskIndex = new AtomicInteger();
|
||||
+
|
||||
+ private final ConcurrentLinkedQueue<Runnable> mainThreadTasks;
|
||||
@@ -1762,10 +1766,10 @@ index 19f8cf4384ff7a1515ad33a5f573ea0061bab93d..e6507a9bef705e1496497ad6b58a5463
|
||||
|
||||
private static EntityVillager a(EntityVillager entityvillager, EntityVillager entityvillager1) {
|
||||
diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
|
||||
index 8d445e9c0875db6cf45e4d8bcfce7cd3d5094d94..0594b0bb12c553edbb6284b48328a3dcf5a64ba4 100644
|
||||
index 83702e07dff72b639af32c8ba9e831e58da92a10..a48f2f82517bc391d5d5b7961e3c7a75175abb65 100644
|
||||
--- a/src/main/java/net/minecraft/server/BehaviorFindPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
|
||||
@@ -278,6 +278,7 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
|
||||
@@ -57,6 +57,7 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
|
||||
|
||||
protected void a(WorldServer worldserver, EntityCreature entitycreature, long i) {
|
||||
this.f = i + 20L + (long) worldserver.getRandom().nextInt(20);
|
||||
@@ -1812,7 +1816,7 @@ index 2291135eaef64c403183724cb6e413cd7e472672..72ee5fe0ca25844cbcd8f1bbbbd6a7f8
|
||||
@Override
|
||||
public BlockPosition shift(EnumDirection enumdirection, int i) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 8fda4702764e80dae93ef9c0eb53abc198642ab1..1d65d884d1f31a73333e4cf6a9ce30d7863dab9f 100644
|
||||
index 8e59a794f6190930cb7bb81a2fe1a1d374dacce7..6cde93d62c4c324a6544401cabe045cbb80f465e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -53,6 +53,38 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -1863,10 +1867,10 @@ index 8fda4702764e80dae93ef9c0eb53abc198642ab1..1d65d884d1f31a73333e4cf6a9ce30d7
|
||||
|
||||
public org.bukkit.Chunk bukkitChunk;
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index e26389d8d9ee4fedb32767fce3aed071af412304..9cf3cd69661a140d34d17195c2cd6dc299c95ddf 100644
|
||||
index b55f7dece329dbb3ff27d57a39c32c69e5baea74..5897d462d350dfbd1464feb92ecf77725651c694 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -974,6 +974,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -975,6 +975,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
}
|
||||
// Paper end - optimize isOutisdeRange
|
||||
this.world.getMethodProfiler().enter("pollingChunks");
|
||||
@@ -1926,16 +1930,15 @@ index 73163b417af7e522a4509bf9c1ab56d6499be622..2855a2757c35afc5751a7ca6f3a12cc2
|
||||
for (int j = 0; j < 4096; ++j) {
|
||||
T t1 = this.a(j);
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index 2644b190813cc934914aeab78fbd6515d1a37c4a..2ee781604868a508d81585a68da811ea366a21b2 100644
|
||||
index 2644b190813cc934914aeab78fbd6515d1a37c4a..665d2d03676fde8d7e7d09fef3fd9cc13110d98d 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -176,6 +176,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
@@ -176,6 +176,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
// Paper end
|
||||
com.tuinity.tuinity.config.TuinityConfig.init((java.io.File) options.valueOf("tuinity-settings")); // Tuinity - Server Config
|
||||
+ gg.airplane.AirplaneConfig.load(); // Airplane - config
|
||||
+ gg.airplane.commands.AirplaneCommands.init(); // Airplane - command
|
||||
+ gg.airplane.flare.FlareSetup.init(); // Airplane
|
||||
|
||||
this.setPVP(dedicatedserverproperties.pvp);
|
||||
this.setAllowFlight(dedicatedserverproperties.allowFlight);
|
||||
@@ -2051,6 +2054,34 @@ index f6797925365836b6c2d3d2c48c746a4d58e28bf3..7bd22c81d75368697113915a97c7fbe5
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index f034977f4666385d6e7c7288e453d058c270be01..48a820e34d45623432a3dc3b01d0bba8824c6414 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -65,7 +65,8 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
protected int bG;
|
||||
protected final float bH = 0.02F;
|
||||
private int g;
|
||||
- private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; } // Paper - OBFHELPER
|
||||
+ private IChatBaseComponent displayName; // Airplane - cache displayName
|
||||
+ private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; this.displayName = null; } // Paper - OBFHELPER // Airplane - use to reset displayName
|
||||
private ItemStack bL;
|
||||
private final ItemCooldown bM;
|
||||
@Nullable
|
||||
@@ -1731,7 +1732,12 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
@Override
|
||||
public IChatBaseComponent getDisplayName() {
|
||||
- return new ChatComponentText(this.bJ.getName());
|
||||
+ // Airplane start - cache display name
|
||||
+ if (this.displayName == null) {
|
||||
+ this.displayName = new ChatComponentText(this.getProfile().getName());
|
||||
+ }
|
||||
+ return this.displayName;
|
||||
+ // Airplane end
|
||||
}
|
||||
|
||||
public InventoryEnderChest getEnderChest() {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index a47217c020d2c2a3caddafa0549dc827373798dd..81a91d63dd26a940c381b5a4f18eb60d42bbd61e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -2152,7 +2183,7 @@ index ca7f9dc54ed2e58f521613b5d8027494bd20edd2..682b241ae0e2859aa57faea8a4521c1c
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index f40c24b6e2f7bea21d1cb2b58ed3da45ffcfc866..9851b7cf8f60be12cfba9787eabe210661344414 100644
|
||||
index c086579073c785b3b7cd556bbb629b91560bd449..90d64eb2a7e318c8501b7efb2314d2049441bd6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -52,7 +52,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
@@ -2426,10 +2457,10 @@ index 2e7721a650c5a351b3584665bd236f92ef577761..b3c2b461b2a654a9e37a57f2f62b3ba8
|
||||
return d0 == 0.0D ? 0 : (d0 > 0.0D ? 1 : -1);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 7ac34a8959a797bf2af96f3f402fa65cffe3d666..965f186f4efd808cc92b4570e7426ffb25650e29 100644
|
||||
index afc22e545df03a38c801362d308d135df90361e2..ec6ef20e93af2298bdb3953b15e1ec24e8c72261 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1520,7 +1520,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@@ -1524,7 +1524,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
@@ -2439,7 +2470,7 @@ index 7ac34a8959a797bf2af96f3f402fa65cffe3d666..965f186f4efd808cc92b4570e7426ffb
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index b92ca4a6de01f3f86367fb8dfe3591b08a3e9218..87172af0b007f93bbb0474bc8f3789ed396258f8 100644
|
||||
index 6aec5098d346c1b7498fd8b800154cd31ce08a97..be243d411abf68686e75d46023c93fb8bb5c84e0 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -411,6 +411,7 @@ public abstract class NavigationAbstract {
|
||||
@@ -2472,11 +2503,35 @@ index 9cad895c7d008487ce885cbcc2c3966645df4c19..2ce5e07f4dcd0c76073840c35be66b7c
|
||||
}
|
||||
public boolean hasTasks() {
|
||||
for (PathfinderGoalWrapped task : getTasks()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
|
||||
index 3ebe3d0dc4c2c6aee6ea349006a74cbe5aa8e78f..7b80f6f08f274fd1adff114a81919bf41bf2cd53 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
|
||||
@@ -80,9 +80,17 @@ public class PathfinderTargetCondition {
|
||||
}
|
||||
|
||||
if (this.b > 0.0D) {
|
||||
+ // Airplane start - try to return early
|
||||
+ double range = (useFollowRange ? getFollowRange(entityliving) : this.b);
|
||||
+ double d2 = entityliving.h(entityliving1.locX(), entityliving1.locY(), entityliving1.locZ()); // move up here to use early
|
||||
+
|
||||
+ if (d2 > range * range) { // if they're further than the absolute furthest allowed, they don't match
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
double d0 = this.g ? entityliving1.A(entityliving) : 1.0D;
|
||||
- double d1 = Math.max((useFollowRange ? getFollowRange(entityliving) : this.b) * d0, 2.0D); // Paper
|
||||
- double d2 = entityliving.h(entityliving1.locX(), entityliving1.locY(), entityliving1.locZ());
|
||||
+ double d1 = Math.max(range * d0, 2.0D); // Paper // Airplane - reuse range calculated above
|
||||
+ // Airplane end
|
||||
|
||||
if (d2 > d1 * d1) {
|
||||
return false;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2ae53161e5 100644
|
||||
index 3e0bf6df7c4608a5b19024612db52558fd722f4b..e5e8d066661a0dee1c07ba0c855204cb81459da5 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -642,7 +642,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
@@ -651,7 +651,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
return d2 * d2 + d3 * d3;
|
||||
}
|
||||
|
||||
@@ -2487,7 +2542,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -656,12 +658,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
@@ -665,12 +667,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
j = MathHelper.floor(entityplayer.locZ() / 16.0D);
|
||||
}
|
||||
|
||||
@@ -2508,7 +2563,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
|
||||
return Math.max(Math.abs(k), Math.abs(l));
|
||||
}
|
||||
@@ -722,6 +728,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
@@ -731,6 +737,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
return (PlayerChunk) (this.hasPendingVisibleUpdate ? this.pendingVisibleChunks.get(i) : ((ProtectedVisibleChunksMap)this.visibleChunks).safeGet(i));
|
||||
// Paper end
|
||||
}
|
||||
@@ -2520,7 +2575,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
|
||||
protected final IntSupplier getPrioritySupplier(long i) { return c(i); } // Paper - OBFHELPER
|
||||
protected IntSupplier c(long i) {
|
||||
@@ -2124,10 +2135,30 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
@@ -2134,10 +2145,30 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
entity.tracker = null; // Paper - We're no longer tracked
|
||||
}
|
||||
|
||||
@@ -2551,7 +2606,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet.Iterator<Chunk> iterator = this.world.getChunkProvider().entityTickingChunks.iterator();
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
@@ -2389,7 +2420,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2403,7 +2434,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
public class EntityTracker {
|
||||
|
||||
final EntityTrackerEntry trackerEntry; // Paper - private -> package private
|
||||
@@ -2560,7 +2615,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
private final int trackingDistance;
|
||||
private SectionPosition e;
|
||||
// Paper start
|
||||
@@ -2408,7 +2439,9 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2422,7 +2453,9 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
// Paper start - use distance map to optimise tracker
|
||||
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> lastTrackerCandidates;
|
||||
|
||||
@@ -2571,7 +2626,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> oldTrackerCandidates = this.lastTrackerCandidates;
|
||||
this.lastTrackerCandidates = newTrackerCandidates;
|
||||
|
||||
@@ -2449,7 +2482,13 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2463,7 +2496,13 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
return this.tracker.getId();
|
||||
}
|
||||
|
||||
@@ -2586,7 +2641,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
Iterator iterator = this.trackedPlayers.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -2461,6 +2500,12 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2475,6 +2514,12 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
}
|
||||
|
||||
public void broadcastIncludingSelf(Packet<?> packet) {
|
||||
@@ -2599,7 +2654,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
this.broadcast(packet);
|
||||
if (this.tracker instanceof EntityPlayer) {
|
||||
((EntityPlayer) this.tracker).playerConnection.sendPacket(packet);
|
||||
@@ -2487,8 +2532,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2501,8 +2546,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
|
||||
}
|
||||
|
||||
@@ -2610,7 +2665,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
if (entityplayer != this.tracker) {
|
||||
// Paper start - remove allocation of Vec3D here
|
||||
//Vec3D vec3d = entityplayer.getPositionVector().d(this.tracker.getPositionVector()); // MC-155077, SPIGOT-5113
|
||||
@@ -2503,11 +2548,17 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2517,11 +2562,17 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
boolean flag1 = this.tracker.attachedToPlayer;
|
||||
|
||||
if (!flag1) {
|
||||
@@ -2623,14 +2678,14 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
+ long chunkcoordintpair = ChunkCoordIntPair.pair(x, z);
|
||||
+ PlayerChunk playerchunk = PlayerChunkMap.this.trackerGetVisibleChunk(chunkcoordintpair); // Airplane
|
||||
|
||||
if (playerchunk != null && playerchunk.getSendingChunk() != null) { // Paper - no-tick view distance
|
||||
if (playerchunk != null && playerchunk.getSendingChunk() != null && PlayerChunkMap.this.playerChunkManager.isChunkSent(entityplayer, MathHelper.floor(this.tracker.locX()) >> 4, MathHelper.floor(this.tracker.locZ()) >> 4)) { // Paper - no-tick view distance // Tuinity - don't broadcast in chunks the player hasn't received
|
||||
- flag1 = PlayerChunkMap.b(chunkcoordintpair, entityplayer, false) <= PlayerChunkMap.this.viewDistance;
|
||||
+ flag1 = PlayerChunkMap.someDistanceCalculation(x, z, entityplayer, false) <= PlayerChunkMap.this.viewDistance;
|
||||
+ // Airplane end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2537,8 +2588,10 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2551,8 +2602,10 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
}
|
||||
|
||||
private int b() {
|
||||
@@ -2642,7 +2697,7 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
Iterator iterator = collection.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -2550,6 +2603,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
@@ -2564,6 +2617,8 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
@@ -2651,6 +2706,40 @@ index 285e976d4a655fb61e70883ae89f974812be7152..d7a17689ce44ccb8281906fb6ac7ba2a
|
||||
|
||||
return this.a(i);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java
|
||||
index 3b65711b91c51ac7b4b5b2b0144ffd279fe60eeb..478f33dbbd0b5a9b81ee420f77c97fa8c40e27d6 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerInventory.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
|
||||
@@ -609,6 +609,8 @@ public class PlayerInventory implements IInventory, INamableTileEntity {
|
||||
}
|
||||
|
||||
public boolean h(ItemStack itemstack) {
|
||||
+ // Airplane start - skip using abstract iterators and stuff, they're generic and slow and allocating them sucks
|
||||
+ /*
|
||||
Iterator iterator = this.f.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -623,6 +625,20 @@ public class PlayerInventory implements IInventory, INamableTileEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ */
|
||||
+ List<NonNullList<ItemStack>> components = this.getComponents();
|
||||
+ for (int i = 0; i < components.size(); i++) {
|
||||
+ List<ItemStack> list = components.get(i);
|
||||
+
|
||||
+ for (int j = 0; j < list.size(); j++) {
|
||||
+ ItemStack itemstack1 = list.get(j);
|
||||
+
|
||||
+ if (!itemstack1.isEmpty() && itemstack1.doMaterialsMatch(itemstack)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Airplane end
|
||||
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
|
||||
index ecd63281912ae0ed93c5eb5ccb4249833cb23ab1..97825ec914709ca037159c46ecee218a6013ff58 100644
|
||||
--- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
|
||||
@@ -2702,10 +2791,10 @@ index ecd63281912ae0ed93c5eb5ccb4249833cb23ab1..97825ec914709ca037159c46ecee218a
|
||||
int i = 0;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
index a77b1d61b9dcb0a2a27d7e50357eaf44c99a661e..3406ffde3c56d9c35ec18a76af8fb258d4131417 100644
|
||||
index 53fd0549c965b2252ad80648d61ff1f7cd2b837a..c7573e1271288bd2b9dfe9801ea8f8804089f6ce 100644
|
||||
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
@@ -372,7 +372,10 @@ public final class SpawnerCreature {
|
||||
@@ -381,7 +381,10 @@ public final class SpawnerCreature {
|
||||
}
|
||||
|
||||
private static List<BiomeSettingsMobs.c> a(WorldServer worldserver, StructureManager structuremanager, ChunkGenerator chunkgenerator, EnumCreatureType enumcreaturetype, BlockPosition blockposition, @Nullable BiomeBase biomebase) {
|
||||
@@ -2784,9 +2873,18 @@ index 2598ae3710d46c2cfd2be5d6be2a56e59ceef6ea..fd1f1e2d7e4be227697f534bdc6d9c52
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 970c1be5477a01ab9c6d79e84c519e22775564ff..3c968c6133c42c3690fe554d5993d237de82c162 100644
|
||||
index bf06ef09cfd4d7618365249d1332d264d8ff1377..996fa5b4652f847f4e64d4cd191fe5a597471afe 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -44,7 +44,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
//public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
|
||||
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
|
||||
protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
|
||||
- protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
|
||||
+ protected final java.util.Set<TileEntity> tileEntityListUnload = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Airplane - use set with faster contains
|
||||
public final Thread serverThread;
|
||||
private final boolean debugWorld;
|
||||
private int d;
|
||||
@@ -318,6 +318,91 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
return null;
|
||||
}
|
||||
@@ -2879,7 +2977,25 @@ index 970c1be5477a01ab9c6d79e84c519e22775564ff..3c968c6133c42c3690fe554d5993d237
|
||||
public static boolean isValidLocation(BlockPosition blockposition) {
|
||||
return blockposition.isValidLocation(); // Paper - use better/optimized check
|
||||
}
|
||||
@@ -956,19 +1041,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
@@ -839,12 +924,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
gameprofilerfiller.enter("blockEntities");
|
||||
timings.tileEntityTick.startTiming(); // Spigot
|
||||
if (!this.tileEntityListUnload.isEmpty()) {
|
||||
+ // Airplane start - we just use the identitymap as the basis for the unload set now instead of copying
|
||||
+ /*
|
||||
// Paper start - Use alternate implementation with faster contains
|
||||
java.util.Set<TileEntity> toRemove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
|
||||
toRemove.addAll(tileEntityListUnload);
|
||||
this.tileEntityListTick.removeAll(toRemove);
|
||||
// Paper end
|
||||
//this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
|
||||
+ */
|
||||
+ this.tileEntityListTick.removeAll(this.tileEntityListUnload);
|
||||
+ // Airplane end
|
||||
this.tileEntityListUnload.clear();
|
||||
}
|
||||
|
||||
@@ -956,19 +1046,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
public void a(Consumer<Entity> consumer, Entity entity) {
|
||||
try {
|
||||
@@ -2903,10 +3019,24 @@ index 970c1be5477a01ab9c6d79e84c519e22775564ff..3c968c6133c42c3690fe554d5993d237
|
||||
// Paper start - Prevent armor stands from doing entity lookups
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 9c77be805eb71c409a5d41c2730338583527e447..0dc8399d419067403e786b604ca52d0752533419 100644
|
||||
index a77fceac7c9e79a6bac05becc21bcb6bf2a1a7c7..f4eb878f9a66fd3404ddde5a14924bb419a351db 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -992,7 +992,28 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
@@ -968,11 +968,12 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
// CraftBukkit end */
|
||||
|
||||
gameprofilerfiller.enter("checkDespawn");
|
||||
+ boolean entityTickingChunk = false; if (!entity.dead) entityTickingChunk = this.getChunkProvider().isInEntityTickingChunk(entity); // Airplane - check once, chunks won't unload ticking entities
|
||||
if (!entity.dead) {
|
||||
entity.checkDespawn();
|
||||
// Tuinity start - optimise notify()
|
||||
if (entity.inChunk && entity.valid) {
|
||||
- if (this.getChunkProvider().isInEntityTickingChunk(entity)) {
|
||||
+ if (entityTickingChunk) { // Airplane - reuse
|
||||
this.updateNavigatorsInRegion(entity);
|
||||
}
|
||||
} else {
|
||||
@@ -992,7 +993,28 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
gameprofilerfiller.enter("tick");
|
||||
if (!entity.dead && !(entity instanceof EntityComplexPart)) {
|
||||
@@ -2916,7 +3046,7 @@ index 9c77be805eb71c409a5d41c2730338583527e447..0dc8399d419067403e786b604ca52d07
|
||||
+ */
|
||||
+ boolean doMidTick = false; // usually there's a returns in the catch, so treat it like that
|
||||
+ try {
|
||||
+ this.entityJoinedWorld(entity);
|
||||
+ this.entityJoinedWorld(entity, entityTickingChunk); // Airplane - reuse
|
||||
+ doMidTick = true;
|
||||
+ } catch (Throwable throwable) {
|
||||
+ if (throwable instanceof ThreadDeath) throw throwable; // Paper
|
||||
@@ -2935,16 +3065,25 @@ index 9c77be805eb71c409a5d41c2730338583527e447..0dc8399d419067403e786b604ca52d07
|
||||
}
|
||||
|
||||
gameprofilerfiller.exit();
|
||||
@@ -1084,6 +1105,8 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
private final com.destroystokyo.paper.util.math.ThreadUnsafeRandom randomTickRandom = new com.destroystokyo.paper.util.math.ThreadUnsafeRandom();
|
||||
// Paper end
|
||||
@@ -1002,7 +1024,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
this.entitiesById.remove(entity.getId()); // Tuinity
|
||||
this.unregisterEntity(entity);
|
||||
} else if (entity.inChunk && entity.valid) { // Tuinity start - optimise notify()
|
||||
- if (this.getChunkProvider().isInEntityTickingChunk(entity)) {
|
||||
+ if (entityTickingChunk) { // Airplane - reuse
|
||||
this.updateNavigatorsInRegion(entity);
|
||||
}
|
||||
} else {
|
||||
@@ -1087,6 +1109,8 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
private final BiomeBase[] biomeBaseCache = new BiomeBase[1];
|
||||
// Tuinity end - optimise chunk ice snow ticking
|
||||
|
||||
+ private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.randomTickRandom.nextInt(16); } // Airplane
|
||||
+
|
||||
public void a(Chunk chunk, int i) { final int randomTickSpeed = i; // Paper
|
||||
ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
|
||||
boolean flag = this.isRaining();
|
||||
@@ -1094,7 +1117,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
@@ -1097,7 +1121,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
gameprofilerfiller.enter("thunder");
|
||||
final BlockPosition.MutableBlockPosition blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
|
||||
|
||||
@@ -2953,16 +3092,36 @@ index 9c77be805eb71c409a5d41c2730338583527e447..0dc8399d419067403e786b604ca52d07
|
||||
blockposition.setValues(this.a(this.a(j, 0, k, 15))); // Paper
|
||||
if (this.isRainingAt(blockposition)) {
|
||||
DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
|
||||
@@ -1118,7 +1141,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
@@ -1121,7 +1145,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
}
|
||||
|
||||
gameprofilerfiller.exitEnter("iceandsnow");
|
||||
- if (!this.paperConfig.disableIceAndSnow && this.randomTickRandom.nextInt(16) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking
|
||||
+ if (!this.paperConfig.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Airplane - optimize further random ticking
|
||||
// Paper start - optimise chunk ticking
|
||||
this.getRandomBlockPosition(j, 0, k, 15, blockposition);
|
||||
int normalY = chunk.getHighestBlockY(HeightMap.Type.MOTION_BLOCKING, blockposition.getX() & 15, blockposition.getZ() & 15);
|
||||
@@ -1328,9 +1351,14 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
// Tuinity start - optimise chunk ice snow ticking
|
||||
BiomeBase[] biomeCache = this.biomeBaseCache;
|
||||
@@ -1301,7 +1325,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
}
|
||||
// Tuinity end - log detailed entity tick information
|
||||
|
||||
- public void entityJoinedWorld(Entity entity) {
|
||||
+ // Airplane start - reuse check for in entity ticking chunk
|
||||
+ public void entityJoinedWorld(Entity entity) { entityJoinedWorld(entity, this.getChunkProvider().isInEntityTickingChunk(entity)); }
|
||||
+ public void entityJoinedWorld(Entity entity, boolean entityTickingChunk) { // Airplane end
|
||||
// Tuinity start - log detailed entity tick information
|
||||
com.tuinity.tuinity.util.TickThread.ensureTickThread("Cannot tick an entity off-main");
|
||||
try {
|
||||
@@ -1309,7 +1335,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
currentlyTickingEntity.lazySet(entity);
|
||||
}
|
||||
// Tuinity end - log detailed entity tick information
|
||||
- if (!(entity instanceof EntityHuman) && !this.getChunkProvider().a(entity)) {
|
||||
+ if (!(entity instanceof EntityHuman) && !entityTickingChunk) { // Airplane - reuse
|
||||
this.chunkCheck(entity);
|
||||
} else {
|
||||
++TimingHistory.entityTicks; // Paper - timings
|
||||
@@ -1335,9 +1361,14 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
++entity.ticksLived;
|
||||
GameProfilerFiller gameprofilerfiller = this.getMethodProfiler();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user