diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 777179bc56..ae87d4707e 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -5538,7 +5538,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void removeTicketsOnClosing() { - ImmutableSet> immutableset = ImmutableSet.of(TicketType.UNKNOWN); -+ ImmutableSet> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.FUTURE_AWAIT); // Paper - add additional tickets to preserve ++ ImmutableSet> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.FUTURE_AWAIT); // Paper - add additional tickets to preserve ObjectIterator>>> objectiterator = this.tickets.long2ObjectEntrySet().fastIterator(); while (objectiterator.hasNext()) { @@ -5756,6 +5756,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final String name; private final Comparator comparator; +@@ -0,0 +0,0 @@ public class TicketType { + public static final TicketType UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1); + public static final TicketType PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit + public static final TicketType PLUGIN_TICKET = TicketType.create("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit ++ public static final TicketType POST_TELEPORT = TicketType.create("post_teleport", Integer::compare, 5); // Paper - post teleport ticket type + + public static TicketType create(String name, Comparator argumentComparator) { + return new TicketType<>(name, argumentComparator, 0L); diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java @@ -5799,6 +5807,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 GameProfile gameprofile = player.getGameProfile(); GameProfileCache usercache = this.server.getProfileCache(); // Optional optional; // CraftBukkit - decompile error +@@ -0,0 +0,0 @@ public abstract class PlayerList { + Vec3 vec3d = teleporttransition.position(); + + entityplayer1.forceSetPositionRotation(vec3d.x, vec3d.y, vec3d.z, teleporttransition.yRot(), teleporttransition.xRot()); ++ worldserver.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(net.minecraft.util.Mth.floor(vec3d.x()) >> 4, net.minecraft.util.Mth.floor(vec3d.z()) >> 4), 1, entityplayer.getId()); // Paper - post teleport ticket type + // CraftBukkit end + if (teleporttransition.missingRespawnBlock()) { + entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java diff --git a/patches/server/Moonrise-optimisation-patches.patch b/patches/server/Moonrise-optimisation-patches.patch index 3cbff59f84..dd47cc693a 100644 --- a/patches/server/Moonrise-optimisation-patches.patch +++ b/patches/server/Moonrise-optimisation-patches.patch @@ -25576,7 +25576,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void removeTicketsOnClosing() { -- ImmutableSet> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.FUTURE_AWAIT); // Paper - add additional tickets to preserve +- ImmutableSet> immutableset = ImmutableSet.of(TicketType.UNKNOWN, TicketType.POST_TELEPORT, TicketType.FUTURE_AWAIT); // Paper - add additional tickets to preserve - ObjectIterator>>> objectiterator = this.tickets.long2ObjectEntrySet().fastIterator(); - - while (objectiterator.hasNext()) { diff --git a/patches/server/More-Teleport-API.patch b/patches/server/More-Teleport-API.patch index 6b82607fe4..82c6ce0ab8 100644 --- a/patches/server/More-Teleport-API.patch +++ b/patches/server/More-Teleport-API.patch @@ -89,6 +89,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + world.loadChunksForMoveAsync(getHandle().getBoundingBoxAt(locationClone.getX(), locationClone.getY(), locationClone.getZ()), + this instanceof CraftPlayer ? ca.spottedleaf.concurrentutil.util.Priority.HIGHER : ca.spottedleaf.concurrentutil.util.Priority.NORMAL, (list) -> { + net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { ++ final net.minecraft.server.level.ServerChunkCache chunkCache = world.getChunkSource(); ++ for (final net.minecraft.world.level.chunk.ChunkAccess chunk : list) { ++ chunkCache.addTicketAtLevel(net.minecraft.server.level.TicketType.POST_TELEPORT, chunk.getPos(), 33, CraftEntity.this.getEntityId()); ++ } + try { + ret.complete(CraftEntity.this.teleport(locationClone, cause, teleportFlags) ? Boolean.TRUE : Boolean.FALSE); + } catch (Throwable throwable) {