From a4a1ab611c9fd1a97f7ce41e50b39193a7e8c036 Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Mon, 30 Jan 2023 03:51:48 -0500 Subject: [PATCH] Slice: Add Smooth Teleports --- patches/api/0011-Slice-Smooth-Teleports.patch | 32 ++++++++++ ...Fix-threading-issue-in-event-system.patch} | 0 .../server/0041-Slice-Smooth-Teleports.patch | 59 +++++++++++++++++++ ...2-MikuServer-Async-entity-traveling.patch} | 0 ... => 0043-MikuServer-Async-entity-ai.patch} | 0 ...ikuServer-Concurrent-problems-fixes.patch} | 0 ...h => 0045-MikuServer-Code-error-fix.patch} | 0 ...er-Bug-fixes-in-CPS-and-Pathfinding.patch} | 0 ...me-issue-in-Entity-sensing-and-aiSt.patch} | 0 ...er-Refactor-and-fix-a-CME-in-Gossip.patch} | 0 ...utdown-hook-to-async-executor-and-r.patch} | 0 ...Fix-threading-issue-in-event-system.patch} | 0 12 files changed, 91 insertions(+) create mode 100644 patches/api/0011-Slice-Smooth-Teleports.patch rename patches/api/{0011-MikuServer-Fix-threading-issue-in-event-system.patch => 0012-MikuServer-Fix-threading-issue-in-event-system.patch} (100%) create mode 100644 patches/server/0041-Slice-Smooth-Teleports.patch rename patches/server/{0041-MikuServer-Async-entity-traveling.patch => 0042-MikuServer-Async-entity-traveling.patch} (100%) rename patches/server/{0042-MikuServer-Async-entity-ai.patch => 0043-MikuServer-Async-entity-ai.patch} (100%) rename patches/server/{0043-MikuServer-Concurrent-problems-fixes.patch => 0044-MikuServer-Concurrent-problems-fixes.patch} (100%) rename patches/server/{0044-MikuServer-Code-error-fix.patch => 0045-MikuServer-Code-error-fix.patch} (100%) rename patches/server/{0045-MikuServer-Bug-fixes-in-CPS-and-Pathfinding.patch => 0046-MikuServer-Bug-fixes-in-CPS-and-Pathfinding.patch} (100%) rename patches/server/{0046-MikuServer-Fix-some-issue-in-Entity-sensing-and-aiSt.patch => 0047-MikuServer-Fix-some-issue-in-Entity-sensing-and-aiSt.patch} (100%) rename patches/server/{0047-MikuServer-Refactor-and-fix-a-CME-in-Gossip.patch => 0048-MikuServer-Refactor-and-fix-a-CME-in-Gossip.patch} (100%) rename patches/server/{0048-MikuServer-Add-shutdown-hook-to-async-executor-and-r.patch => 0049-MikuServer-Add-shutdown-hook-to-async-executor-and-r.patch} (100%) rename patches/server/{0049-MikuServer-Fix-threading-issue-in-event-system.patch => 0050-MikuServer-Fix-threading-issue-in-event-system.patch} (100%) diff --git a/patches/api/0011-Slice-Smooth-Teleports.patch b/patches/api/0011-Slice-Smooth-Teleports.patch new file mode 100644 index 00000000..68595d2d --- /dev/null +++ b/patches/api/0011-Slice-Smooth-Teleports.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Sat, 13 Aug 2022 08:58:21 -0500 +Subject: [PATCH] Slice: Smooth Teleports + +Original license: MIT +Original project: https://github.com/Cryptite/Slice + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 17683d888d6aa55dcedaca59951aad011af006ed..119b97dab3c3477741191a8afdc3b72a0d9bd085 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -2809,6 +2809,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + String getClientBrandName(); + // Paper end + ++ /** ++ * This abuses some of how Minecraft works and allows teleporting a player to another world without ++ * triggering typical respawn packets. All of natural state of chunk resends, entity adds/removes, etc still ++ * happen but the visual "refresh" of a world change is hidden. Depending on the destination location/world, ++ * this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one. ++ * ++ * @param location New location to teleport this Player to ++ */ ++ // Slice start ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ void teleportWithoutRespawn(Location location); ++ // Slice end ++ + // Paper start - Teleport API + /** + * Sets the player's rotation. diff --git a/patches/api/0011-MikuServer-Fix-threading-issue-in-event-system.patch b/patches/api/0012-MikuServer-Fix-threading-issue-in-event-system.patch similarity index 100% rename from patches/api/0011-MikuServer-Fix-threading-issue-in-event-system.patch rename to patches/api/0012-MikuServer-Fix-threading-issue-in-event-system.patch diff --git a/patches/server/0041-Slice-Smooth-Teleports.patch b/patches/server/0041-Slice-Smooth-Teleports.patch new file mode 100644 index 00000000..9a9a7beb --- /dev/null +++ b/patches/server/0041-Slice-Smooth-Teleports.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Sat, 13 Aug 2022 08:58:14 -0500 +Subject: [PATCH] Slice: Smooth Teleports + +Original license: MIT +Original project: https://github.com/Cryptite/Slice + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index b5aaddaf2ef9e7639cbdc682d06330945be3c432..b157f887092b4ca9642548eadd9a633bb74ec14d 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -268,6 +268,7 @@ public class ServerPlayer extends Player { + public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper + public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper + public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event ++ public boolean smoothWorldTeleport; // Slice + private boolean tpsBar = false; // Purpur + private boolean compassBar = false; // Purpur + private boolean ramBar = false; // Purpur +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index c0278a87a77d14c7598e6d431b63bbd5c7d863af..54d9b2c1dcab93b37c02aeda146aef088f20dff0 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -901,12 +901,12 @@ public abstract class PlayerList { + int i = flag ? 1 : 0; + // CraftBukkit start + LevelData worlddata = worldserver1.getLevelData(); +- entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation())); ++ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation())); + entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance())); // Spigot // Paper - replace old player chunk management + entityplayer1.connection.send(new ClientboundSetSimulationDistancePacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance())); // Spigot // Paper - replace old player chunk management + entityplayer1.spawnIn(worldserver1); + entityplayer1.unsetRemoved(); +- entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot())); ++ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot())); + entityplayer1.setShiftKeyDown(false); + + // entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 472d9281199cb9cd8edafc6d2309e5e296a014cd..3ef7fec22de7727b8627802e305aa68340798e70 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -1192,6 +1192,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + // Paper end + } + ++ // Slice start ++ public void teleportWithoutRespawn(Location location) { ++ ServerPlayer serverPlayer = getHandle(); ++ serverPlayer.smoothWorldTeleport = true; ++ teleport(location); ++ serverPlayer.smoothWorldTeleport = false; ++ } ++ // Slice end ++ + @Override + public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) { + // Paper start - Teleport API diff --git a/patches/server/0041-MikuServer-Async-entity-traveling.patch b/patches/server/0042-MikuServer-Async-entity-traveling.patch similarity index 100% rename from patches/server/0041-MikuServer-Async-entity-traveling.patch rename to patches/server/0042-MikuServer-Async-entity-traveling.patch diff --git a/patches/server/0042-MikuServer-Async-entity-ai.patch b/patches/server/0043-MikuServer-Async-entity-ai.patch similarity index 100% rename from patches/server/0042-MikuServer-Async-entity-ai.patch rename to patches/server/0043-MikuServer-Async-entity-ai.patch diff --git a/patches/server/0043-MikuServer-Concurrent-problems-fixes.patch b/patches/server/0044-MikuServer-Concurrent-problems-fixes.patch similarity index 100% rename from patches/server/0043-MikuServer-Concurrent-problems-fixes.patch rename to patches/server/0044-MikuServer-Concurrent-problems-fixes.patch diff --git a/patches/server/0044-MikuServer-Code-error-fix.patch b/patches/server/0045-MikuServer-Code-error-fix.patch similarity index 100% rename from patches/server/0044-MikuServer-Code-error-fix.patch rename to patches/server/0045-MikuServer-Code-error-fix.patch diff --git a/patches/server/0045-MikuServer-Bug-fixes-in-CPS-and-Pathfinding.patch b/patches/server/0046-MikuServer-Bug-fixes-in-CPS-and-Pathfinding.patch similarity index 100% rename from patches/server/0045-MikuServer-Bug-fixes-in-CPS-and-Pathfinding.patch rename to patches/server/0046-MikuServer-Bug-fixes-in-CPS-and-Pathfinding.patch diff --git a/patches/server/0046-MikuServer-Fix-some-issue-in-Entity-sensing-and-aiSt.patch b/patches/server/0047-MikuServer-Fix-some-issue-in-Entity-sensing-and-aiSt.patch similarity index 100% rename from patches/server/0046-MikuServer-Fix-some-issue-in-Entity-sensing-and-aiSt.patch rename to patches/server/0047-MikuServer-Fix-some-issue-in-Entity-sensing-and-aiSt.patch diff --git a/patches/server/0047-MikuServer-Refactor-and-fix-a-CME-in-Gossip.patch b/patches/server/0048-MikuServer-Refactor-and-fix-a-CME-in-Gossip.patch similarity index 100% rename from patches/server/0047-MikuServer-Refactor-and-fix-a-CME-in-Gossip.patch rename to patches/server/0048-MikuServer-Refactor-and-fix-a-CME-in-Gossip.patch diff --git a/patches/server/0048-MikuServer-Add-shutdown-hook-to-async-executor-and-r.patch b/patches/server/0049-MikuServer-Add-shutdown-hook-to-async-executor-and-r.patch similarity index 100% rename from patches/server/0048-MikuServer-Add-shutdown-hook-to-async-executor-and-r.patch rename to patches/server/0049-MikuServer-Add-shutdown-hook-to-async-executor-and-r.patch diff --git a/patches/server/0049-MikuServer-Fix-threading-issue-in-event-system.patch b/patches/server/0050-MikuServer-Fix-threading-issue-in-event-system.patch similarity index 100% rename from patches/server/0049-MikuServer-Fix-threading-issue-in-event-system.patch rename to patches/server/0050-MikuServer-Fix-threading-issue-in-event-system.patch