From a4f9ea5573acf02bc7ae2b907ecc9110a3eadd09 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:51:54 +0800 Subject: [PATCH] And more protocol --- ...006-Leaves-Server-Config-And-Command.patch | 16 +++++++------- patches/server/0055-Syncmatica-Protocol.patch | 14 ++++++++++-- .../server/0075-Bladeren-Protocol.patch | 15 ++++++++----- ...Skip-secondary-POI-sensor-if-absent.patch} | 0 .../0077-Bladeren-mspt-sync-protocol.patch} | 22 +++++++++++-------- ...> 0078-Store-mob-counts-in-an-array.patch} | 0 ...> 0079-Cache-BlockStatePairKey-hash.patch} | 0 ...h => 0080-Optimize-noise-generation.patch} | 0 ....patch => 0081-Disable-packet-limit.patch} | 0 ...ch => 0082-Reduce-array-allocations.patch} | 0 ...atch => 0083-Optimize-sun-burn-tick.patch} | 0 ...-Optional-allocation-in-EntityBased.patch} | 0 ...ignableFrom-call-in-ClassInstanceMu.patch} | 0 ...ch => 0086-Optimized-CubePointRange.patch} | 0 ...k-frozen-ticks-before-landing-block.patch} | 0 ...kip-entity-move-if-movement-is-zero.patch} | 0 ...9-Skip-cloning-advancement-criteria.patch} | 0 ...ible-planar-movement-multiplication.patch} | 0 ...1-Fix-villagers-dont-release-memory.patch} | 0 ...h => 0092-Avoid-anvil-too-expensive.patch} | 0 ...-fix.patch => 0093-Bow-infinity-fix.patch} | 0 ...ants.patch => 0094-Zero-tick-plants.patch} | 0 ...pdater.patch => 0095-Leaves-Updater.patch} | 0 ... => 0096-Force-peaceful-mode-switch.patch} | 0 ...od-API.patch => 0097-Replay-Mod-API.patch} | 0 ...aves-I18n.patch => 0098-Leaves-I18n.patch} | 0 ...raft-hopper-not-work-without-player.patch} | 0 ...G-Fishing.patch => 0100-RNG-Fishing.patch} | 0 ...r.patch => 0101-Wool-Hopper-Counter.patch} | 0 ...patch => 0102-Leaves-Reload-Command.patch} | 0 ...=> 0103-Spider-jockeys-drop-gapples.patch} | 0 ...rade.patch => 0104-Force-Void-Trade.patch} | 0 ...=> 0105-Villager-infinite-discounts.patch} | 0 ...atch => 0106-CCE-update-suppression.patch} | 0 ...7-Disable-offline-warn-if-use-proxy.patch} | 0 ...108-Disable-moved-wrongly-threshold.patch} | 0 ...r-stand-cant-kill-by-mob-projectile.patch} | 0 ...atch => 0110-Make-Item-tick-vanilla.patch} | 0 ...atch => 0111-Copper-Bulb-1-gt-delay.patch} | 0 ...ay.patch => 0112-Crafter-1-gt-delay.patch} | 0 ...h => 0113-Linear-region-file-format.patch} | 0 ...e.patch => 0114-No-TNT-place-update.patch} | 0 ...tocol.patch => 0115-Servux-Protocol.patch} | 0 ...ed-hopper-no-longer-send-NC-updates.patch} | 0 ...e.patch => 0117-Renewable-deepslate.patch} | 0 ...ges.patch => 0118-Renewable-sponges.patch} | 0 ...coral.patch => 0119-Renewable-coral.patch} | 0 ...st-resume.patch => 0120-Fast-resume.patch} | 0 ...hopper.patch => 0121-Vanilla-hopper.patch} | 0 ...tch => 0122-Force-minecraft-command.patch} | 0 ...-Fix-falling-block-s-block-location.patch} | 0 ...4-Fix-NPE-during-creating-GUI-graph.patch} | 0 ...tebuf-API.patch => 0125-Bytebuf-API.patch} | 0 ... 0126-Allow-grindstone-overstacking.patch} | 0 ...67.patch => 0127-Configurable-MC-67.patch} | 0 ...imize-random-calls-in-chunk-ticking.patch} | 0 56 files changed, 43 insertions(+), 24 deletions(-) rename patches/{unapplied => }/server/0075-Bladeren-Protocol.patch (91%) rename patches/server/{0075-Skip-secondary-POI-sensor-if-absent.patch => 0076-Skip-secondary-POI-sensor-if-absent.patch} (100%) rename patches/{unapplied/server/0076-Bladeren-mspt-sync-protocol.patch => server/0077-Bladeren-mspt-sync-protocol.patch} (79%) rename patches/server/{0076-Store-mob-counts-in-an-array.patch => 0078-Store-mob-counts-in-an-array.patch} (100%) rename patches/server/{0077-Cache-BlockStatePairKey-hash.patch => 0079-Cache-BlockStatePairKey-hash.patch} (100%) rename patches/server/{0078-Optimize-noise-generation.patch => 0080-Optimize-noise-generation.patch} (100%) rename patches/server/{0079-Disable-packet-limit.patch => 0081-Disable-packet-limit.patch} (100%) rename patches/server/{0080-Reduce-array-allocations.patch => 0082-Reduce-array-allocations.patch} (100%) rename patches/server/{0081-Optimize-sun-burn-tick.patch => 0083-Optimize-sun-burn-tick.patch} (100%) rename patches/server/{0082-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch => 0084-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch} (100%) rename patches/server/{0083-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch => 0085-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch} (100%) rename patches/server/{0084-Optimized-CubePointRange.patch => 0086-Optimized-CubePointRange.patch} (100%) rename patches/server/{0085-Check-frozen-ticks-before-landing-block.patch => 0087-Check-frozen-ticks-before-landing-block.patch} (100%) rename patches/server/{0086-Skip-entity-move-if-movement-is-zero.patch => 0088-Skip-entity-move-if-movement-is-zero.patch} (100%) rename patches/server/{0087-Skip-cloning-advancement-criteria.patch => 0089-Skip-cloning-advancement-criteria.patch} (100%) rename patches/server/{0088-Skip-negligible-planar-movement-multiplication.patch => 0090-Skip-negligible-planar-movement-multiplication.patch} (100%) rename patches/server/{0089-Fix-villagers-dont-release-memory.patch => 0091-Fix-villagers-dont-release-memory.patch} (100%) rename patches/server/{0090-Avoid-anvil-too-expensive.patch => 0092-Avoid-anvil-too-expensive.patch} (100%) rename patches/server/{0091-Bow-infinity-fix.patch => 0093-Bow-infinity-fix.patch} (100%) rename patches/server/{0092-Zero-tick-plants.patch => 0094-Zero-tick-plants.patch} (100%) rename patches/server/{0093-Leaves-Updater.patch => 0095-Leaves-Updater.patch} (100%) rename patches/server/{0094-Force-peaceful-mode-switch.patch => 0096-Force-peaceful-mode-switch.patch} (100%) rename patches/server/{0095-Replay-Mod-API.patch => 0097-Replay-Mod-API.patch} (100%) rename patches/server/{0096-Leaves-I18n.patch => 0098-Leaves-I18n.patch} (100%) rename patches/server/{0097-Fix-minecraft-hopper-not-work-without-player.patch => 0099-Fix-minecraft-hopper-not-work-without-player.patch} (100%) rename patches/server/{0098-RNG-Fishing.patch => 0100-RNG-Fishing.patch} (100%) rename patches/server/{0099-Wool-Hopper-Counter.patch => 0101-Wool-Hopper-Counter.patch} (100%) rename patches/server/{0100-Leaves-Reload-Command.patch => 0102-Leaves-Reload-Command.patch} (100%) rename patches/server/{0101-Spider-jockeys-drop-gapples.patch => 0103-Spider-jockeys-drop-gapples.patch} (100%) rename patches/server/{0102-Force-Void-Trade.patch => 0104-Force-Void-Trade.patch} (100%) rename patches/server/{0103-Villager-infinite-discounts.patch => 0105-Villager-infinite-discounts.patch} (100%) rename patches/server/{0104-CCE-update-suppression.patch => 0106-CCE-update-suppression.patch} (100%) rename patches/server/{0105-Disable-offline-warn-if-use-proxy.patch => 0107-Disable-offline-warn-if-use-proxy.patch} (100%) rename patches/server/{0106-Disable-moved-wrongly-threshold.patch => 0108-Disable-moved-wrongly-threshold.patch} (100%) rename patches/server/{0107-Armor-stand-cant-kill-by-mob-projectile.patch => 0109-Armor-stand-cant-kill-by-mob-projectile.patch} (100%) rename patches/server/{0108-Make-Item-tick-vanilla.patch => 0110-Make-Item-tick-vanilla.patch} (100%) rename patches/server/{0109-Copper-Bulb-1-gt-delay.patch => 0111-Copper-Bulb-1-gt-delay.patch} (100%) rename patches/server/{0110-Crafter-1-gt-delay.patch => 0112-Crafter-1-gt-delay.patch} (100%) rename patches/server/{0111-Linear-region-file-format.patch => 0113-Linear-region-file-format.patch} (100%) rename patches/server/{0112-No-TNT-place-update.patch => 0114-No-TNT-place-update.patch} (100%) rename patches/server/{0113-Servux-Protocol.patch => 0115-Servux-Protocol.patch} (100%) rename patches/server/{0114-Placing-locked-hopper-no-longer-send-NC-updates.patch => 0116-Placing-locked-hopper-no-longer-send-NC-updates.patch} (100%) rename patches/server/{0115-Renewable-deepslate.patch => 0117-Renewable-deepslate.patch} (100%) rename patches/server/{0116-Renewable-sponges.patch => 0118-Renewable-sponges.patch} (100%) rename patches/server/{0117-Renewable-coral.patch => 0119-Renewable-coral.patch} (100%) rename patches/server/{0118-Fast-resume.patch => 0120-Fast-resume.patch} (100%) rename patches/server/{0119-Vanilla-hopper.patch => 0121-Vanilla-hopper.patch} (100%) rename patches/server/{0120-Force-minecraft-command.patch => 0122-Force-minecraft-command.patch} (100%) rename patches/server/{0121-Fix-falling-block-s-block-location.patch => 0123-Fix-falling-block-s-block-location.patch} (100%) rename patches/server/{0122-Fix-NPE-during-creating-GUI-graph.patch => 0124-Fix-NPE-during-creating-GUI-graph.patch} (100%) rename patches/server/{0123-Bytebuf-API.patch => 0125-Bytebuf-API.patch} (100%) rename patches/server/{0124-Allow-grindstone-overstacking.patch => 0126-Allow-grindstone-overstacking.patch} (100%) rename patches/server/{0125-Configurable-MC-67.patch => 0127-Configurable-MC-67.patch} (100%) rename patches/server/{0126-Optimize-random-calls-in-chunk-ticking.patch => 0128-Optimize-random-calls-in-chunk-ticking.patch} (100%) diff --git a/patches/server/0006-Leaves-Server-Config-And-Command.patch b/patches/server/0006-Leaves-Server-Config-And-Command.patch index 595c8c7..ac4a41c 100644 --- a/patches/server/0006-Leaves-Server-Config-And-Command.patch +++ b/patches/server/0006-Leaves-Server-Config-And-Command.patch @@ -85,7 +85,7 @@ index 459f47244bdfeab63b5f16d780b0291d36310de8..a872421bc3e67fdcc929f104f4b085fb .withRequiredArg() diff --git a/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/src/main/java/org/leavesmc/leaves/LeavesConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..9405d8ff041434a1fce98f744c51b22032889078 +index 0000000000000000000000000000000000000000..afe13ae207eaa294e3299f15874d28df3a55e32d --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java @@ -0,0 +1,888 @@ @@ -116,8 +116,8 @@ index 0000000000000000000000000000000000000000..9405d8ff041434a1fce98f744c51b220 +import org.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRule; +import org.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules; + -+//import org.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeatureSet; // Leaves - remove protocol temporarily -+//import org.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeature; // Leaves - remove protocol temporarily ++import org.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeatureSet; ++import org.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeature; + +public final class LeavesConfig { + @@ -295,7 +295,7 @@ index 0000000000000000000000000000000000000000..9405d8ff041434a1fce98f744c51b220 + private static class RNGFishingVerify extends ConfigVerify.BooleanConfigVerify { + @Override + public String check(Boolean old, Boolean value) { -+// LeavesFeatureSet.register(LeavesFeature.of("rng_fishing", value)); // Leaves - remove protocol temporarily ++ LeavesFeatureSet.register(LeavesFeature.of("rng_fishing", value)); + return null; + } + } @@ -407,7 +407,7 @@ index 0000000000000000000000000000000000000000..9405d8ff041434a1fce98f744c51b220 + private static class UseVanillaRandomVerify extends ConfigVerify.BooleanConfigVerify { + @Override + public String check(Boolean old, Boolean value) { -+// LeavesFeatureSet.register(LeavesFeature.of("use_vanilla_random", value)); // Leaves - remove protocol temporarily ++ LeavesFeatureSet.register(LeavesFeature.of("use_vanilla_random", value)); + return null; + } + } @@ -459,7 +459,7 @@ index 0000000000000000000000000000000000000000..9405d8ff041434a1fce98f744c51b220 + private static class LavaRiptideVerify extends ConfigVerify.BooleanConfigVerify { + @Override + public String check(Boolean old, Boolean value) { -+// LeavesFeatureSet.register(LeavesFeature.of("lava_riptide", value)); // Leaves - remove protocol temporarily ++ LeavesFeatureSet.register(LeavesFeature.of("lava_riptide", value)); + return null; + } + } @@ -733,7 +733,7 @@ index 0000000000000000000000000000000000000000..9405d8ff041434a1fce98f744c51b220 + private static class MSPTSyncVerify extends ConfigVerify.BooleanConfigVerify { + @Override + public String check(Boolean old, Boolean value) { -+// LeavesFeatureSet.register(LeavesFeature.of("mspt_sync", value)); // Leaves - remove protocol temporarily ++ LeavesFeatureSet.register(LeavesFeature.of("mspt_sync", value)); + return null; + } + } @@ -765,7 +765,7 @@ index 0000000000000000000000000000000000000000..9405d8ff041434a1fce98f744c51b220 + @Override + public String check(Boolean old, Boolean value) { + if (value) { -+// org.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol.init(); // Leaves - remove protocol temporarily ++ org.leavesmc.leaves.protocol.syncmatica.SyncmaticaProtocol.init(); + } + return null; + } diff --git a/patches/server/0055-Syncmatica-Protocol.patch b/patches/server/0055-Syncmatica-Protocol.patch index 2ad8531..f8583ff 100644 --- a/patches/server/0055-Syncmatica-Protocol.patch +++ b/patches/server/0055-Syncmatica-Protocol.patch @@ -28,10 +28,10 @@ index bef88d547aefa9c5b701aa91ffc58114309a7db7..51a1be78de7a794d13b64db6958977e2 if (this.ackBlockChangesUpTo > -1) { diff --git a/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java new file mode 100644 -index 0000000000000000000000000000000000000000..a0c385dcd1b040521512e1125e7ff7aefcbd9d64 +index 0000000000000000000000000000000000000000..8c0fd40a89681ef71d9dd2ad63d858e1aad82ceb --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java -@@ -0,0 +1,387 @@ +@@ -0,0 +1,397 @@ +package org.leavesmc.leaves.protocol.syncmatica; + +import com.mojang.authlib.GameProfile; @@ -44,6 +44,7 @@ index 0000000000000000000000000000000000000000..a0c385dcd1b040521512e1125e7ff7ae +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import org.jetbrains.annotations.NotNull; ++import org.leavesmc.leaves.LeavesConfig; +import org.leavesmc.leaves.protocol.core.LeavesProtocol; +import org.leavesmc.leaves.protocol.core.LeavesProtocolManager; +import org.leavesmc.leaves.protocol.core.ProtocolHandler; @@ -100,6 +101,9 @@ index 0000000000000000000000000000000000000000..a0c385dcd1b040521512e1125e7ff7ae + + @ProtocolHandler.PlayerJoin + public static void onPlayerJoin(ServerPlayer player) { ++ if (!LeavesConfig.syncmaticaProtocol) { ++ return; ++ } + final ExchangeTarget newPlayer = player.connection.exchangeTarget; + final VersionHandshakeServer hi = new VersionHandshakeServer(newPlayer); + playerMap.put(newPlayer, player); @@ -110,6 +114,9 @@ index 0000000000000000000000000000000000000000..a0c385dcd1b040521512e1125e7ff7ae + + @ProtocolHandler.PlayerLeave + public static void onPlayerLeave(ServerPlayer player) { ++ if (!LeavesConfig.syncmaticaProtocol) { ++ return; ++ } + final ExchangeTarget oldPlayer = player.connection.exchangeTarget; + final Collection potentialMessageTarget = oldPlayer.getExchanges(); + if (potentialMessageTarget != null) { @@ -124,6 +131,9 @@ index 0000000000000000000000000000000000000000..a0c385dcd1b040521512e1125e7ff7ae + + @ProtocolHandler.PayloadReceiver(payload = LeavesProtocolManager.LeavesPayload.class, ignoreId = true) + public static void onPacketGet(ServerPlayer player, LeavesProtocolManager.LeavesPayload payload) { ++ if (!LeavesConfig.syncmaticaProtocol) { ++ return; ++ } + onPacket(player.connection.exchangeTarget, payload.id(), payload.data()); + } + diff --git a/patches/unapplied/server/0075-Bladeren-Protocol.patch b/patches/server/0075-Bladeren-Protocol.patch similarity index 91% rename from patches/unapplied/server/0075-Bladeren-Protocol.patch rename to patches/server/0075-Bladeren-Protocol.patch index c4f810b..fd8af84 100644 --- a/patches/unapplied/server/0075-Bladeren-Protocol.patch +++ b/patches/server/0075-Bladeren-Protocol.patch @@ -6,20 +6,21 @@ Subject: [PATCH] Bladeren Protocol diff --git a/src/main/java/org/leavesmc/leaves/protocol/bladeren/BladerenProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/bladeren/BladerenProtocol.java new file mode 100644 -index 0000000000000000000000000000000000000000..a91011c7a2c56646053bb9d158ff0c265c658c00 +index 0000000000000000000000000000000000000000..4d9285d69724e8600fd7a3f9a6c31ecd579de6ad --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/protocol/bladeren/BladerenProtocol.java -@@ -0,0 +1,145 @@ +@@ -0,0 +1,150 @@ +package org.leavesmc.leaves.protocol.bladeren; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; -+import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import org.leavesmc.leaves.LeavesConfig; ++import org.leavesmc.leaves.LeavesLogger; ++import org.leavesmc.leaves.protocol.core.LeavesCustomPayload; +import org.leavesmc.leaves.protocol.core.LeavesProtocol; +import org.leavesmc.leaves.protocol.core.ProtocolHandler; +import org.leavesmc.leaves.protocol.core.ProtocolUtils; @@ -50,6 +51,8 @@ index 0000000000000000000000000000000000000000..a91011c7a2c56646053bb9d158ff0c26 + String clientVersion = payload.version; + CompoundTag tag = payload.nbt; + ++ LeavesLogger.LOGGER.info("Player " + player.getScoreboardName() + " joined with bladeren " + clientVersion); ++ + if (tag != null) { + CompoundTag featureNbt = tag.getCompound("Features"); + for (String name : featureNbt.getAllKeys()) { @@ -117,8 +120,9 @@ index 0000000000000000000000000000000000000000..a91011c7a2c56646053bb9d158ff0c26 + } + } + -+ public record BladerenFeatureModifyPayload(String name, CompoundTag nbt) implements CustomPacketPayload { ++ public record BladerenFeatureModifyPayload(String name, CompoundTag nbt) implements LeavesCustomPayload { + ++ @New + public BladerenFeatureModifyPayload(ResourceLocation location, FriendlyByteBuf buf) { + this(buf.readUtf(), buf.readNbt()); + } @@ -136,8 +140,9 @@ index 0000000000000000000000000000000000000000..a91011c7a2c56646053bb9d158ff0c26 + } + } + -+ public record BladerenHelloPayload(String version, CompoundTag nbt) implements CustomPacketPayload { ++ public record BladerenHelloPayload(String version, CompoundTag nbt) implements LeavesCustomPayload { + ++ @New + public BladerenHelloPayload(ResourceLocation location, @NotNull FriendlyByteBuf buf) { + this(buf.readUtf(64), buf.readNbt()); + } diff --git a/patches/server/0075-Skip-secondary-POI-sensor-if-absent.patch b/patches/server/0076-Skip-secondary-POI-sensor-if-absent.patch similarity index 100% rename from patches/server/0075-Skip-secondary-POI-sensor-if-absent.patch rename to patches/server/0076-Skip-secondary-POI-sensor-if-absent.patch diff --git a/patches/unapplied/server/0076-Bladeren-mspt-sync-protocol.patch b/patches/server/0077-Bladeren-mspt-sync-protocol.patch similarity index 79% rename from patches/unapplied/server/0076-Bladeren-mspt-sync-protocol.patch rename to patches/server/0077-Bladeren-mspt-sync-protocol.patch index a2765c8..8e8342d 100644 --- a/patches/unapplied/server/0076-Bladeren-mspt-sync-protocol.patch +++ b/patches/server/0077-Bladeren-mspt-sync-protocol.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Bladeren mspt sync protocol diff --git a/src/main/java/org/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java new file mode 100644 -index 0000000000000000000000000000000000000000..cf909f22f0860e6f56a86510dfcbd949a4c1fc32 +index 0000000000000000000000000000000000000000..8bbcb87cf327ac3b85b8134231a23cb6092c5afb --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/protocol/bladeren/MsptSyncProtocol.java -@@ -0,0 +1,73 @@ +@@ -0,0 +1,77 @@ +package org.leavesmc.leaves.protocol.bladeren; + +import net.minecraft.resources.ResourceLocation; @@ -25,6 +25,7 @@ index 0000000000000000000000000000000000000000..cf909f22f0860e6f56a86510dfcbd949 +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; ++import java.util.OptionalDouble; + +@LeavesProtocol(namespace = "bladeren") +public class MsptSyncProtocol { @@ -43,7 +44,7 @@ index 0000000000000000000000000000000000000000..cf909f22f0860e6f56a86510dfcbd949 + @ProtocolHandler.Init + public static void init() { + BladerenProtocol.registerFeature("mspt_sync", (player, compoundTag) -> { -+ if (compoundTag.getString("Value").equals("true")) { ++ if (compoundTag.getString("Value").equals("true")) { + onPlayerSubmit(player); + } else { + onPlayerLoggedOut(player); @@ -67,12 +68,15 @@ index 0000000000000000000000000000000000000000..cf909f22f0860e6f56a86510dfcbd949 + + MinecraftServer server = MinecraftServer.getServer(); + if (server.getTickCount() % LeavesConfig.msptSyncTickInterval == 0) { -+ double mspt = Arrays.stream(server.getTickTimesNanos()).average().getAsDouble() * 1.0E-6D; -+ double tps = 1000.0D / Math.max(mspt, 50); -+ players.forEach(player -> ProtocolUtils.sendPayloadPacket(player, MSPT_SYNC, buf -> { -+ buf.writeDouble(mspt); -+ buf.writeDouble(tps); -+ })); ++ OptionalDouble msptArr = Arrays.stream(server.getTickTimesNanos()).average(); ++ if (msptArr.isPresent()) { ++ double mspt = msptArr.getAsDouble() * 1.0E-6D; ++ double tps = 1000.0D / Math.max(mspt, 50); ++ players.forEach(player -> ProtocolUtils.sendPayloadPacket(player, MSPT_SYNC, buf -> { ++ buf.writeDouble(mspt); ++ buf.writeDouble(tps); ++ })); ++ } + } + } + } diff --git a/patches/server/0076-Store-mob-counts-in-an-array.patch b/patches/server/0078-Store-mob-counts-in-an-array.patch similarity index 100% rename from patches/server/0076-Store-mob-counts-in-an-array.patch rename to patches/server/0078-Store-mob-counts-in-an-array.patch diff --git a/patches/server/0077-Cache-BlockStatePairKey-hash.patch b/patches/server/0079-Cache-BlockStatePairKey-hash.patch similarity index 100% rename from patches/server/0077-Cache-BlockStatePairKey-hash.patch rename to patches/server/0079-Cache-BlockStatePairKey-hash.patch diff --git a/patches/server/0078-Optimize-noise-generation.patch b/patches/server/0080-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0078-Optimize-noise-generation.patch rename to patches/server/0080-Optimize-noise-generation.patch diff --git a/patches/server/0079-Disable-packet-limit.patch b/patches/server/0081-Disable-packet-limit.patch similarity index 100% rename from patches/server/0079-Disable-packet-limit.patch rename to patches/server/0081-Disable-packet-limit.patch diff --git a/patches/server/0080-Reduce-array-allocations.patch b/patches/server/0082-Reduce-array-allocations.patch similarity index 100% rename from patches/server/0080-Reduce-array-allocations.patch rename to patches/server/0082-Reduce-array-allocations.patch diff --git a/patches/server/0081-Optimize-sun-burn-tick.patch b/patches/server/0083-Optimize-sun-burn-tick.patch similarity index 100% rename from patches/server/0081-Optimize-sun-burn-tick.patch rename to patches/server/0083-Optimize-sun-burn-tick.patch diff --git a/patches/server/0082-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch b/patches/server/0084-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch similarity index 100% rename from patches/server/0082-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch rename to patches/server/0084-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch diff --git a/patches/server/0083-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch b/patches/server/0085-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch similarity index 100% rename from patches/server/0083-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch rename to patches/server/0085-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch diff --git a/patches/server/0084-Optimized-CubePointRange.patch b/patches/server/0086-Optimized-CubePointRange.patch similarity index 100% rename from patches/server/0084-Optimized-CubePointRange.patch rename to patches/server/0086-Optimized-CubePointRange.patch diff --git a/patches/server/0085-Check-frozen-ticks-before-landing-block.patch b/patches/server/0087-Check-frozen-ticks-before-landing-block.patch similarity index 100% rename from patches/server/0085-Check-frozen-ticks-before-landing-block.patch rename to patches/server/0087-Check-frozen-ticks-before-landing-block.patch diff --git a/patches/server/0086-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0088-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0086-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0088-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0087-Skip-cloning-advancement-criteria.patch b/patches/server/0089-Skip-cloning-advancement-criteria.patch similarity index 100% rename from patches/server/0087-Skip-cloning-advancement-criteria.patch rename to patches/server/0089-Skip-cloning-advancement-criteria.patch diff --git a/patches/server/0088-Skip-negligible-planar-movement-multiplication.patch b/patches/server/0090-Skip-negligible-planar-movement-multiplication.patch similarity index 100% rename from patches/server/0088-Skip-negligible-planar-movement-multiplication.patch rename to patches/server/0090-Skip-negligible-planar-movement-multiplication.patch diff --git a/patches/server/0089-Fix-villagers-dont-release-memory.patch b/patches/server/0091-Fix-villagers-dont-release-memory.patch similarity index 100% rename from patches/server/0089-Fix-villagers-dont-release-memory.patch rename to patches/server/0091-Fix-villagers-dont-release-memory.patch diff --git a/patches/server/0090-Avoid-anvil-too-expensive.patch b/patches/server/0092-Avoid-anvil-too-expensive.patch similarity index 100% rename from patches/server/0090-Avoid-anvil-too-expensive.patch rename to patches/server/0092-Avoid-anvil-too-expensive.patch diff --git a/patches/server/0091-Bow-infinity-fix.patch b/patches/server/0093-Bow-infinity-fix.patch similarity index 100% rename from patches/server/0091-Bow-infinity-fix.patch rename to patches/server/0093-Bow-infinity-fix.patch diff --git a/patches/server/0092-Zero-tick-plants.patch b/patches/server/0094-Zero-tick-plants.patch similarity index 100% rename from patches/server/0092-Zero-tick-plants.patch rename to patches/server/0094-Zero-tick-plants.patch diff --git a/patches/server/0093-Leaves-Updater.patch b/patches/server/0095-Leaves-Updater.patch similarity index 100% rename from patches/server/0093-Leaves-Updater.patch rename to patches/server/0095-Leaves-Updater.patch diff --git a/patches/server/0094-Force-peaceful-mode-switch.patch b/patches/server/0096-Force-peaceful-mode-switch.patch similarity index 100% rename from patches/server/0094-Force-peaceful-mode-switch.patch rename to patches/server/0096-Force-peaceful-mode-switch.patch diff --git a/patches/server/0095-Replay-Mod-API.patch b/patches/server/0097-Replay-Mod-API.patch similarity index 100% rename from patches/server/0095-Replay-Mod-API.patch rename to patches/server/0097-Replay-Mod-API.patch diff --git a/patches/server/0096-Leaves-I18n.patch b/patches/server/0098-Leaves-I18n.patch similarity index 100% rename from patches/server/0096-Leaves-I18n.patch rename to patches/server/0098-Leaves-I18n.patch diff --git a/patches/server/0097-Fix-minecraft-hopper-not-work-without-player.patch b/patches/server/0099-Fix-minecraft-hopper-not-work-without-player.patch similarity index 100% rename from patches/server/0097-Fix-minecraft-hopper-not-work-without-player.patch rename to patches/server/0099-Fix-minecraft-hopper-not-work-without-player.patch diff --git a/patches/server/0098-RNG-Fishing.patch b/patches/server/0100-RNG-Fishing.patch similarity index 100% rename from patches/server/0098-RNG-Fishing.patch rename to patches/server/0100-RNG-Fishing.patch diff --git a/patches/server/0099-Wool-Hopper-Counter.patch b/patches/server/0101-Wool-Hopper-Counter.patch similarity index 100% rename from patches/server/0099-Wool-Hopper-Counter.patch rename to patches/server/0101-Wool-Hopper-Counter.patch diff --git a/patches/server/0100-Leaves-Reload-Command.patch b/patches/server/0102-Leaves-Reload-Command.patch similarity index 100% rename from patches/server/0100-Leaves-Reload-Command.patch rename to patches/server/0102-Leaves-Reload-Command.patch diff --git a/patches/server/0101-Spider-jockeys-drop-gapples.patch b/patches/server/0103-Spider-jockeys-drop-gapples.patch similarity index 100% rename from patches/server/0101-Spider-jockeys-drop-gapples.patch rename to patches/server/0103-Spider-jockeys-drop-gapples.patch diff --git a/patches/server/0102-Force-Void-Trade.patch b/patches/server/0104-Force-Void-Trade.patch similarity index 100% rename from patches/server/0102-Force-Void-Trade.patch rename to patches/server/0104-Force-Void-Trade.patch diff --git a/patches/server/0103-Villager-infinite-discounts.patch b/patches/server/0105-Villager-infinite-discounts.patch similarity index 100% rename from patches/server/0103-Villager-infinite-discounts.patch rename to patches/server/0105-Villager-infinite-discounts.patch diff --git a/patches/server/0104-CCE-update-suppression.patch b/patches/server/0106-CCE-update-suppression.patch similarity index 100% rename from patches/server/0104-CCE-update-suppression.patch rename to patches/server/0106-CCE-update-suppression.patch diff --git a/patches/server/0105-Disable-offline-warn-if-use-proxy.patch b/patches/server/0107-Disable-offline-warn-if-use-proxy.patch similarity index 100% rename from patches/server/0105-Disable-offline-warn-if-use-proxy.patch rename to patches/server/0107-Disable-offline-warn-if-use-proxy.patch diff --git a/patches/server/0106-Disable-moved-wrongly-threshold.patch b/patches/server/0108-Disable-moved-wrongly-threshold.patch similarity index 100% rename from patches/server/0106-Disable-moved-wrongly-threshold.patch rename to patches/server/0108-Disable-moved-wrongly-threshold.patch diff --git a/patches/server/0107-Armor-stand-cant-kill-by-mob-projectile.patch b/patches/server/0109-Armor-stand-cant-kill-by-mob-projectile.patch similarity index 100% rename from patches/server/0107-Armor-stand-cant-kill-by-mob-projectile.patch rename to patches/server/0109-Armor-stand-cant-kill-by-mob-projectile.patch diff --git a/patches/server/0108-Make-Item-tick-vanilla.patch b/patches/server/0110-Make-Item-tick-vanilla.patch similarity index 100% rename from patches/server/0108-Make-Item-tick-vanilla.patch rename to patches/server/0110-Make-Item-tick-vanilla.patch diff --git a/patches/server/0109-Copper-Bulb-1-gt-delay.patch b/patches/server/0111-Copper-Bulb-1-gt-delay.patch similarity index 100% rename from patches/server/0109-Copper-Bulb-1-gt-delay.patch rename to patches/server/0111-Copper-Bulb-1-gt-delay.patch diff --git a/patches/server/0110-Crafter-1-gt-delay.patch b/patches/server/0112-Crafter-1-gt-delay.patch similarity index 100% rename from patches/server/0110-Crafter-1-gt-delay.patch rename to patches/server/0112-Crafter-1-gt-delay.patch diff --git a/patches/server/0111-Linear-region-file-format.patch b/patches/server/0113-Linear-region-file-format.patch similarity index 100% rename from patches/server/0111-Linear-region-file-format.patch rename to patches/server/0113-Linear-region-file-format.patch diff --git a/patches/server/0112-No-TNT-place-update.patch b/patches/server/0114-No-TNT-place-update.patch similarity index 100% rename from patches/server/0112-No-TNT-place-update.patch rename to patches/server/0114-No-TNT-place-update.patch diff --git a/patches/server/0113-Servux-Protocol.patch b/patches/server/0115-Servux-Protocol.patch similarity index 100% rename from patches/server/0113-Servux-Protocol.patch rename to patches/server/0115-Servux-Protocol.patch diff --git a/patches/server/0114-Placing-locked-hopper-no-longer-send-NC-updates.patch b/patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch similarity index 100% rename from patches/server/0114-Placing-locked-hopper-no-longer-send-NC-updates.patch rename to patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch diff --git a/patches/server/0115-Renewable-deepslate.patch b/patches/server/0117-Renewable-deepslate.patch similarity index 100% rename from patches/server/0115-Renewable-deepslate.patch rename to patches/server/0117-Renewable-deepslate.patch diff --git a/patches/server/0116-Renewable-sponges.patch b/patches/server/0118-Renewable-sponges.patch similarity index 100% rename from patches/server/0116-Renewable-sponges.patch rename to patches/server/0118-Renewable-sponges.patch diff --git a/patches/server/0117-Renewable-coral.patch b/patches/server/0119-Renewable-coral.patch similarity index 100% rename from patches/server/0117-Renewable-coral.patch rename to patches/server/0119-Renewable-coral.patch diff --git a/patches/server/0118-Fast-resume.patch b/patches/server/0120-Fast-resume.patch similarity index 100% rename from patches/server/0118-Fast-resume.patch rename to patches/server/0120-Fast-resume.patch diff --git a/patches/server/0119-Vanilla-hopper.patch b/patches/server/0121-Vanilla-hopper.patch similarity index 100% rename from patches/server/0119-Vanilla-hopper.patch rename to patches/server/0121-Vanilla-hopper.patch diff --git a/patches/server/0120-Force-minecraft-command.patch b/patches/server/0122-Force-minecraft-command.patch similarity index 100% rename from patches/server/0120-Force-minecraft-command.patch rename to patches/server/0122-Force-minecraft-command.patch diff --git a/patches/server/0121-Fix-falling-block-s-block-location.patch b/patches/server/0123-Fix-falling-block-s-block-location.patch similarity index 100% rename from patches/server/0121-Fix-falling-block-s-block-location.patch rename to patches/server/0123-Fix-falling-block-s-block-location.patch diff --git a/patches/server/0122-Fix-NPE-during-creating-GUI-graph.patch b/patches/server/0124-Fix-NPE-during-creating-GUI-graph.patch similarity index 100% rename from patches/server/0122-Fix-NPE-during-creating-GUI-graph.patch rename to patches/server/0124-Fix-NPE-during-creating-GUI-graph.patch diff --git a/patches/server/0123-Bytebuf-API.patch b/patches/server/0125-Bytebuf-API.patch similarity index 100% rename from patches/server/0123-Bytebuf-API.patch rename to patches/server/0125-Bytebuf-API.patch diff --git a/patches/server/0124-Allow-grindstone-overstacking.patch b/patches/server/0126-Allow-grindstone-overstacking.patch similarity index 100% rename from patches/server/0124-Allow-grindstone-overstacking.patch rename to patches/server/0126-Allow-grindstone-overstacking.patch diff --git a/patches/server/0125-Configurable-MC-67.patch b/patches/server/0127-Configurable-MC-67.patch similarity index 100% rename from patches/server/0125-Configurable-MC-67.patch rename to patches/server/0127-Configurable-MC-67.patch diff --git a/patches/server/0126-Optimize-random-calls-in-chunk-ticking.patch b/patches/server/0128-Optimize-random-calls-in-chunk-ticking.patch similarity index 100% rename from patches/server/0126-Optimize-random-calls-in-chunk-ticking.patch rename to patches/server/0128-Optimize-random-calls-in-chunk-ticking.patch