From 348d5f3dca34b61ae9541aba68961fc00c17af14 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Tue, 7 Jun 2022 19:25:49 -0700 Subject: [PATCH] i really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really love jmp --- .../server/Add-Heightmap-API.patch | 0 .../Allow-Saving-of-Oversized-Chunks.patch | 0 ...oggleEvent-when-whitelist-is-toggled.patch | 0 .../server/Chunk-debug-command.patch | 0 .../server/ChunkMapDistance-CME.patch | 0 ...le-Keep-Spawn-Loaded-range-per-world.patch | 0 ...gurable-projectile-relative-velocity.patch | 0 ...ConvertSigns-boolean-every-sign-save.patch | 0 .../server/Entity-getEntitySpawnReason.patch | 6 +- .../Expose-the-internal-current-tick.patch | 0 .../server/Fire-event-on-GS4-query.patch | 0 ...l-to-changed-postToMainThread-method.patch | 0 ...isPrimaryThread-and-MinecraftServer-.patch | 0 .../Fix-World-isChunkGenerated-calls.patch | 66 ++++++++++--------- ...n-item-frames-are-modified-MC-123450.patch | 2 +- ...le-Oversized-Tile-Entities-in-chunks.patch | 0 .../Implement-CraftBlockSoundGroup.patch | 0 .../Implement-PlayerPostRespawnEvent.patch | 0 .../server/Mob-Spawner-API-Enhancements.patch | 0 ...al-Spawned-mobs-towards-natural-spaw.patch | 0 .../Optimize-Captured-TileEntity-Lookup.patch | 0 ...-Manager-and-add-advanced-packet-sup.patch | 2 +- .../PlayerDeathEvent-getItemsToKeep.patch | 4 +- .../server/Server-Tick-Events.patch | 0 ...st-tick-at-start-of-drowning-process.patch | 0 ...ate-location-if-we-failed-to-read-it.patch | 0 ...ity-Metadata-for-all-tracked-players.patch | 2 +- ...-for-pickupDelay-breaks-picking-up-i.patch | 0 ...ength-when-serialising-BungeeCord-te.patch | 31 --------- .../improve-CraftWorld-isChunkLoaded.patch | 30 --------- 30 files changed, 44 insertions(+), 99 deletions(-) rename patches/{unapplied => }/server/Add-Heightmap-API.patch (100%) rename patches/{unapplied => }/server/Allow-Saving-of-Oversized-Chunks.patch (100%) rename patches/{unapplied => }/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch (100%) rename patches/{unapplied => }/server/Chunk-debug-command.patch (100%) rename patches/{unapplied => }/server/ChunkMapDistance-CME.patch (100%) rename patches/{unapplied => }/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch (100%) rename patches/{unapplied => }/server/Configurable-projectile-relative-velocity.patch (100%) rename patches/{unapplied => }/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch (100%) rename patches/{unapplied => }/server/Entity-getEntitySpawnReason.patch (98%) rename patches/{unapplied => }/server/Expose-the-internal-current-tick.patch (100%) rename patches/{unapplied => }/server/Fire-event-on-GS4-query.patch (100%) rename patches/{unapplied => }/server/Fix-CB-call-to-changed-postToMainThread-method.patch (100%) rename patches/{unapplied => }/server/Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch (100%) rename patches/{unapplied => }/server/Fix-World-isChunkGenerated-calls.patch (86%) rename patches/{unapplied => }/server/Fix-sounds-when-item-frames-are-modified-MC-123450.patch (96%) rename patches/{unapplied => }/server/Handle-Oversized-Tile-Entities-in-chunks.patch (100%) rename patches/{unapplied => }/server/Implement-CraftBlockSoundGroup.patch (100%) rename patches/{unapplied => }/server/Implement-PlayerPostRespawnEvent.patch (100%) rename patches/{unapplied => }/server/Mob-Spawner-API-Enhancements.patch (100%) rename patches/{unapplied => }/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch (100%) rename patches/{unapplied => }/server/Optimize-Captured-TileEntity-Lookup.patch (100%) rename patches/{unapplied => }/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch (99%) rename patches/{unapplied => }/server/PlayerDeathEvent-getItemsToKeep.patch (95%) rename patches/{unapplied => }/server/Server-Tick-Events.patch (100%) rename patches/{unapplied => }/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch (100%) rename patches/{unapplied => }/server/Show-blockstate-location-if-we-failed-to-read-it.patch (100%) rename patches/{unapplied => }/server/Update-entity-Metadata-for-all-tracked-players.patch (96%) rename patches/{unapplied => }/server/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch (100%) delete mode 100644 patches/unapplied/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch delete mode 100644 patches/unapplied/server/improve-CraftWorld-isChunkLoaded.patch diff --git a/patches/unapplied/server/Add-Heightmap-API.patch b/patches/server/Add-Heightmap-API.patch similarity index 100% rename from patches/unapplied/server/Add-Heightmap-API.patch rename to patches/server/Add-Heightmap-API.patch diff --git a/patches/unapplied/server/Allow-Saving-of-Oversized-Chunks.patch b/patches/server/Allow-Saving-of-Oversized-Chunks.patch similarity index 100% rename from patches/unapplied/server/Allow-Saving-of-Oversized-Chunks.patch rename to patches/server/Allow-Saving-of-Oversized-Chunks.patch diff --git a/patches/unapplied/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch similarity index 100% rename from patches/unapplied/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch rename to patches/server/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch diff --git a/patches/unapplied/server/Chunk-debug-command.patch b/patches/server/Chunk-debug-command.patch similarity index 100% rename from patches/unapplied/server/Chunk-debug-command.patch rename to patches/server/Chunk-debug-command.patch diff --git a/patches/unapplied/server/ChunkMapDistance-CME.patch b/patches/server/ChunkMapDistance-CME.patch similarity index 100% rename from patches/unapplied/server/ChunkMapDistance-CME.patch rename to patches/server/ChunkMapDistance-CME.patch diff --git a/patches/unapplied/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch b/patches/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch similarity index 100% rename from patches/unapplied/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch rename to patches/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch diff --git a/patches/unapplied/server/Configurable-projectile-relative-velocity.patch b/patches/server/Configurable-projectile-relative-velocity.patch similarity index 100% rename from patches/unapplied/server/Configurable-projectile-relative-velocity.patch rename to patches/server/Configurable-projectile-relative-velocity.patch diff --git a/patches/unapplied/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/patches/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch similarity index 100% rename from patches/unapplied/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch rename to patches/server/Don-t-check-ConvertSigns-boolean-every-sign-save.patch diff --git a/patches/unapplied/server/Entity-getEntitySpawnReason.patch b/patches/server/Entity-getEntitySpawnReason.patch similarity index 98% rename from patches/unapplied/server/Entity-getEntitySpawnReason.patch rename to patches/server/Entity-getEntitySpawnReason.patch index dcaf121077..870cb75fd5 100644 --- a/patches/unapplied/server/Entity-getEntitySpawnReason.patch +++ b/patches/server/Entity-getEntitySpawnReason.patch @@ -48,13 +48,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.Boat; @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - } } - }; -+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; + } // Paper end ++ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper + private CraftEntity bukkitEntity; @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); diff --git a/patches/unapplied/server/Expose-the-internal-current-tick.patch b/patches/server/Expose-the-internal-current-tick.patch similarity index 100% rename from patches/unapplied/server/Expose-the-internal-current-tick.patch rename to patches/server/Expose-the-internal-current-tick.patch diff --git a/patches/unapplied/server/Fire-event-on-GS4-query.patch b/patches/server/Fire-event-on-GS4-query.patch similarity index 100% rename from patches/unapplied/server/Fire-event-on-GS4-query.patch rename to patches/server/Fire-event-on-GS4-query.patch diff --git a/patches/unapplied/server/Fix-CB-call-to-changed-postToMainThread-method.patch b/patches/server/Fix-CB-call-to-changed-postToMainThread-method.patch similarity index 100% rename from patches/unapplied/server/Fix-CB-call-to-changed-postToMainThread-method.patch rename to patches/server/Fix-CB-call-to-changed-postToMainThread-method.patch diff --git a/patches/unapplied/server/Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch b/patches/server/Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch rename to patches/server/Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch diff --git a/patches/unapplied/server/Fix-World-isChunkGenerated-calls.patch b/patches/server/Fix-World-isChunkGenerated-calls.patch similarity index 86% rename from patches/unapplied/server/Fix-World-isChunkGenerated-calls.patch rename to patches/server/Fix-World-isChunkGenerated-calls.patch index 2652a53271..1c9f19b43f 100644 --- a/patches/unapplied/server/Fix-World-isChunkGenerated-calls.patch +++ b/patches/server/Fix-World-isChunkGenerated-calls.patch @@ -11,24 +11,37 @@ diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -0,0 +0,0 @@ import net.minecraft.world.level.chunk.ProtoChunk; - import net.minecraft.world.level.chunk.UpgradeData; - import net.minecraft.world.level.chunk.storage.ChunkSerializer; - import net.minecraft.world.level.chunk.storage.ChunkStorage; -+import net.minecraft.world.level.chunk.storage.RegionFile; - import net.minecraft.world.level.entity.ChunkStatusUpdateListener; - import net.minecraft.world.level.levelgen.blending.BlendingData; - import net.minecraft.world.level.levelgen.structure.StructureStart; @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - @Nullable - public CompoundTag readChunk(ChunkPos pos) throws IOException { - CompoundTag nbttagcompound = this.read(pos); + // Paper end + + private CompletableFuture> readChunk(ChunkPos chunkPos) { +- return this.read(chunkPos).thenApplyAsync((optional) -> { +- return optional.map((nbttagcompound) -> this.upgradeChunkTag(nbttagcompound, chunkPos)); // CraftBukkit +- }, Util.backgroundExecutor()); ++ // Paper start - Cache chunk status on disk ++ try { ++ return CompletableFuture.completedFuture(Optional.ofNullable(this.readConvertChunkSync(chunkPos))); ++ } catch (Throwable thr) { ++ return CompletableFuture.failedFuture(thr); ++ } ++ // Paper end - Cache chunk status on disk + } + + // CraftBukkit start +@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + // CraftBukkit end + } + ++ // Paper start - Cache chunk status on disk ++ @Nullable ++ public CompoundTag readConvertChunkSync(ChunkPos pos) throws IOException { ++ CompoundTag nbttagcompound = this.readSync(pos); + // Paper start - Cache chunk status on disk + if (nbttagcompound == null) { + return null; + } + -+ nbttagcompound = this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), pos, level); // CraftBukkit ++ nbttagcompound = this.upgradeChunkTag(nbttagcompound, pos); // CraftBukkit + if (nbttagcompound == null) { + return null; + } @@ -41,14 +54,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + // Paper start - chunk status cache "api" + public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) { -+ RegionFile regionFile = regionFileCache.getRegionFileIfLoaded(chunkPos); - -- return nbttagcompound == null ? null : this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), pos, level); // CraftBukkit ++ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFileIfLoaded(chunkPos); ++ + return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); - } - ++ } ++ + public ChunkStatus getChunkStatusOnDisk(ChunkPos chunkPos) throws IOException { -+ RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, true); ++ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, true); + + if (regionFile == null || !regionFileCache.chunkExists(chunkPos)) { + return null; @@ -66,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException { -+ RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, false); ++ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, false); + + regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound)); + } @@ -191,21 +203,13 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ import java.util.Objects; - import java.util.Random; - import java.util.Set; - import java.util.UUID; -+import java.util.concurrent.CompletableFuture; - import java.util.function.Predicate; - import java.util.stream.Collectors; - import net.minecraft.core.BlockPos; @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean isChunkGenerated(int x, int z) { + // Paper start - Fix this method + if (!Bukkit.isPrimaryThread()) { -+ return CompletableFuture.supplyAsync(() -> { ++ return java.util.concurrent.CompletableFuture.supplyAsync(() -> { + return CraftWorld.this.isChunkGenerated(x, z); + }, world.getChunkSource().mainThreadProcessor).join(); + } @@ -217,12 +221,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return chunk instanceof ImposterProtoChunk || chunk instanceof net.minecraft.world.level.chunk.LevelChunk; + } try { -- return this.world.getChunkSource().getChunkAtIfCachedImmediately(x, z) != null || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null; // Paper (TODO check if the first part can be removed) +- return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)).get().isPresent(); +- } catch (InterruptedException | ExecutionException ex) { + return world.getChunkSource().chunkMap.getChunkStatusOnDisk(new ChunkPos(x, z)) == ChunkStatus.FULL; + // Paper end - } catch (IOException ex) { ++ } catch (IOException ex) { throw new RuntimeException(ex); } + } @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { diff --git a/patches/unapplied/server/Fix-sounds-when-item-frames-are-modified-MC-123450.patch b/patches/server/Fix-sounds-when-item-frames-are-modified-MC-123450.patch similarity index 96% rename from patches/unapplied/server/Fix-sounds-when-item-frames-are-modified-MC-123450.patch rename to patches/server/Fix-sounds-when-item-frames-are-modified-MC-123450.patch index a6ecbf58c5..d2ef2127a6 100644 --- a/patches/unapplied/server/Fix-sounds-when-item-frames-are-modified-MC-123450.patch +++ b/patches/server/Fix-sounds-when-item-frames-are-modified-MC-123450.patch @@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java @@ -0,0 +0,0 @@ public class ItemFrame extends HangingEntity { - } + this.onItemChanged(itemstack); this.getEntityData().set(ItemFrame.DATA_ITEM, itemstack); - if (!itemstack.isEmpty() && playSound) { // CraftBukkit + if (!itemstack.isEmpty() && flag && playSound) { // CraftBukkit // Paper - only play sound when update flag is set diff --git a/patches/unapplied/server/Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/server/Handle-Oversized-Tile-Entities-in-chunks.patch similarity index 100% rename from patches/unapplied/server/Handle-Oversized-Tile-Entities-in-chunks.patch rename to patches/server/Handle-Oversized-Tile-Entities-in-chunks.patch diff --git a/patches/unapplied/server/Implement-CraftBlockSoundGroup.patch b/patches/server/Implement-CraftBlockSoundGroup.patch similarity index 100% rename from patches/unapplied/server/Implement-CraftBlockSoundGroup.patch rename to patches/server/Implement-CraftBlockSoundGroup.patch diff --git a/patches/unapplied/server/Implement-PlayerPostRespawnEvent.patch b/patches/server/Implement-PlayerPostRespawnEvent.patch similarity index 100% rename from patches/unapplied/server/Implement-PlayerPostRespawnEvent.patch rename to patches/server/Implement-PlayerPostRespawnEvent.patch diff --git a/patches/unapplied/server/Mob-Spawner-API-Enhancements.patch b/patches/server/Mob-Spawner-API-Enhancements.patch similarity index 100% rename from patches/unapplied/server/Mob-Spawner-API-Enhancements.patch rename to patches/server/Mob-Spawner-API-Enhancements.patch diff --git a/patches/unapplied/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch similarity index 100% rename from patches/unapplied/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch rename to patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch diff --git a/patches/unapplied/server/Optimize-Captured-TileEntity-Lookup.patch b/patches/server/Optimize-Captured-TileEntity-Lookup.patch similarity index 100% rename from patches/unapplied/server/Optimize-Captured-TileEntity-Lookup.patch rename to patches/server/Optimize-Captured-TileEntity-Lookup.patch diff --git a/patches/unapplied/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 99% rename from patches/unapplied/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 9e69f9ba3c..7f92ac9ded 100644 --- a/patches/unapplied/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -265,7 +265,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.getDisconnectedReason() != null) { @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { } else if (this.getPacketListener() != null) { - this.getPacketListener().onDisconnect(new TranslatableComponent("multiplayer.disconnect.generic")); + this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic")); } - this.queue.clear(); // Free up packet queue. + clearPacketQueue(); // Paper diff --git a/patches/unapplied/server/PlayerDeathEvent-getItemsToKeep.patch b/patches/server/PlayerDeathEvent-getItemsToKeep.patch similarity index 95% rename from patches/unapplied/server/PlayerDeathEvent-getItemsToKeep.patch rename to patches/server/PlayerDeathEvent-getItemsToKeep.patch index 6a4aa335e7..3f3e9962eb 100644 --- a/patches/unapplied/server/PlayerDeathEvent-getItemsToKeep.patch +++ b/patches/server/PlayerDeathEvent-getItemsToKeep.patch @@ -56,8 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + @Override - public void die(DamageSource source) { - boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); + public void die(DamageSource damageSource) { + this.gameEvent(GameEvent.ENTITY_DIE); @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { this.dropExperience(); // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. diff --git a/patches/unapplied/server/Server-Tick-Events.patch b/patches/server/Server-Tick-Events.patch similarity index 100% rename from patches/unapplied/server/Server-Tick-Events.patch rename to patches/server/Server-Tick-Events.patch diff --git a/patches/unapplied/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch b/patches/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch similarity index 100% rename from patches/unapplied/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch rename to patches/server/Set-Zombie-last-tick-at-start-of-drowning-process.patch diff --git a/patches/unapplied/server/Show-blockstate-location-if-we-failed-to-read-it.patch b/patches/server/Show-blockstate-location-if-we-failed-to-read-it.patch similarity index 100% rename from patches/unapplied/server/Show-blockstate-location-if-we-failed-to-read-it.patch rename to patches/server/Show-blockstate-location-if-we-failed-to-read-it.patch diff --git a/patches/unapplied/server/Update-entity-Metadata-for-all-tracked-players.patch b/patches/server/Update-entity-Metadata-for-all-tracked-players.patch similarity index 96% rename from patches/unapplied/server/Update-entity-Metadata-for-all-tracked-players.patch rename to patches/server/Update-entity-Metadata-for-all-tracked-players.patch index b1d07c2080..f982f7353e 100644 --- a/patches/unapplied/server/Update-entity-Metadata-for-all-tracked-players.patch +++ b/patches/server/Update-entity-Metadata-for-all-tracked-players.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -0,0 +0,0 @@ public class ServerEntity { - return ClientboundMoveEntityPacket.packetToEntity(this.xp, this.yp, this.zp); + } + // Paper start - Add broadcast method diff --git a/patches/unapplied/server/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/patches/server/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch similarity index 100% rename from patches/unapplied/server/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch rename to patches/server/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch diff --git a/patches/unapplied/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch b/patches/unapplied/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch deleted file mode 100644 index b75aae5187..0000000000 --- a/patches/unapplied/server/Use-proper-max-length-when-serialising-BungeeCord-te.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Wed, 20 Mar 2019 21:19:29 -0700 -Subject: [PATCH] Use proper max length when serialising BungeeCord text - component - - -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet; - - public class ClientboundChatPacket implements Packet { - -+ private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper - private final Component message; - public net.kyori.adventure.text.Component adventure$message; // Paper - public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot -@@ -0,0 +0,0 @@ public class ClientboundChatPacket implements Packet { - // buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below - // Paper start - don't nest if we don't need to so that we can preserve formatting - if (this.components.length == 1) { -- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0])); -+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]), MAX_LENGTH); // Paper - use proper max length - } else { -- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components)); -+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components), MAX_LENGTH); // Paper - use proper max length - } - // Paper end - } else { diff --git a/patches/unapplied/server/improve-CraftWorld-isChunkLoaded.patch b/patches/unapplied/server/improve-CraftWorld-isChunkLoaded.patch deleted file mode 100644 index d11973a8ef..0000000000 --- a/patches/unapplied/server/improve-CraftWorld-isChunkLoaded.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Tue, 21 May 2019 02:34:04 +0100 -Subject: [PATCH] improve CraftWorld#isChunkLoaded - -getChunkAt will request the chunk using vanillas chunk loading system, -which while we're not going to load the chunk, does involve the server -waiting for the execution queue to get to our request; We can just query -the chunk status and get a response now, vs having to wait - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - - @Override - public boolean isChunkLoaded(int x, int z) { -- return this.world.getChunkSource().isChunkLoaded(x, z); -+ return this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z) != null; // Paper - } - - @Override - public boolean isChunkGenerated(int x, int z) { - try { -- return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null; -+ return this.world.getChunkSource().getChunkAtIfCachedImmediately(x, z) != null || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null; // Paper (TODO check if the first part can be removed) - } catch (IOException ex) { - throw new RuntimeException(ex); - }