diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 792158d693..150646c460 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -1404,7 +1404,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return Name of the sender + */ -+ public @NotNull Component name(); ++ public @NotNull net.kyori.adventure.text.Component name(); + + @Override + default void sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { diff --git a/patches/unapplied/api/Version-Command-2.0.patch b/patches/api/Version-Command-2.0.patch similarity index 100% rename from patches/unapplied/api/Version-Command-2.0.patch rename to patches/api/Version-Command-2.0.patch diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 37f48268c0..3e21dc3608 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -4985,6 +4985,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + } ++ ++ public static int getTicketLevelFor(net.minecraft.world.level.chunk.ChunkStatus status) { ++ return net.minecraft.server.level.ChunkMap.MAX_VIEW_DISTANCE + net.minecraft.world.level.chunk.ChunkStatus.getDistance(status); ++ } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -5076,6 +5080,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!ChunkHolder.getFullChunkStatus(this.oldTicketLevel).isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks return this.getFullChunkUnchecked(); } +@@ -0,0 +0,0 @@ public class ChunkHolder { + } + // CraftBukkit end + ++ // Paper start ++ public ChunkAccess getAvailableChunkNow() { ++ // TODO can we just getStatusFuture(EMPTY)? ++ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) { ++ CompletableFuture> future = this.getFutureIfPresentUnchecked(curr); ++ Either either = future.getNow(null); ++ if (either == null || !either.left().isPresent()) { ++ continue; ++ } ++ return either.left().get(); ++ } ++ return null; ++ } ++ // Paper end ++ + public CompletableFuture> getFutureIfPresentUnchecked(ChunkStatus leastStatus) { + CompletableFuture> completablefuture = (CompletableFuture) this.futures.get(leastStatus.getIndex()); + @@ -0,0 +0,0 @@ public class ChunkHolder { return ChunkHolder.getStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE; } @@ -5105,6 +5131,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return null; } ++ // Paper start ++ public ChunkStatus getChunkHolderStatus() { ++ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) { ++ CompletableFuture> future = this.getFutureIfPresentUnchecked(curr); ++ Either either = future.getNow(null); ++ if (either == null || !either.left().isPresent()) { ++ continue; ++ } ++ return curr; ++ } ++ ++ return null; ++ } ++ // Paper end ++ + @Nullable + public ChunkAccess getLastAvailable() { + for (int i = ChunkHolder.CHUNK_STATUSES.size() - 1; i >= 0; --i) { +@@ -0,0 +0,0 @@ public class ChunkHolder { + return null; + } + - public CompletableFuture getChunkToSave() { + public final CompletableFuture getChunkToSave() { // Paper - final for inline return this.chunkToSave; @@ -5545,6 +5593,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + + // Paper start ++ @Nullable ++ public ChunkAccess getChunkAtImmediately(int x, int z) { ++ ChunkHolder holder = this.chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); ++ if (holder == null) { ++ return null; ++ } ++ ++ return holder.getLastAvailable(); ++ } ++ + // this will try to avoid chunk neighbours for lighting + public final ChunkAccess getFullStatusChunkAt(int chunkX, int chunkZ) { + LevelChunk ifLoaded = this.getChunkAtIfLoadedImmediately(chunkX, chunkZ); @@ -5634,6 +5692,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }, this.mainThreadProcessor); + } + ++ public void addTicketAtLevel(TicketType ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) { ++ this.distanceManager.addTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier); ++ } ++ ++ public void removeTicketAtLevel(TicketType ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) { ++ this.distanceManager.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier); ++ } ++ + void chunkLoadAccept(int chunkX, int chunkZ, ChunkAccess chunk, java.util.function.Consumer consumer) { + try { + consumer.accept(chunk);