From 00be0b7b30c375eb7ba468470981c350d27ee2bd Mon Sep 17 00:00:00 2001 From: Jake Date: Wed, 24 Nov 2021 14:26:32 -0800 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: d25437bc Update to Minecraft 1.18-pre8 CraftBukkit Changes: 5a39a236 Update to Minecraft 1.18-pre8 Spigot Changes: 7840c2af Update to Minecraft 1.18-pre8 --- build.gradle.kts | 2 +- gradle.properties | 4 +- .../api/0001-Convert-project-to-Gradle.patch | 4 +- .../server/0001-Setup-Gradle-project.patch | 7 +- patches/server/0002-Remap-fixes.patch | 10 +- patches/server/0004-Paper-config-files.patch | 8 +- patches/server/0005-MC-Dev-fixes.patch | 43 +++++---- patches/server/0006-MC-Utils.patch | 91 +++++++++---------- ...-MinecraftKey-Information-to-Objects.patch | 8 +- patches/server/0010-Timings-v2.patch | 54 +++++------ ...d-mobs-to-jump-and-take-water-damage.patch | 4 +- ...ve-invalid-mob-spawner-tile-entities.patch | 4 +- patches/server/0027-Entity-Origin-API.patch | 12 +-- ...event-tile-entity-and-entity-crashes.patch | 8 +- ...dd-configurable-portal-search-radius.patch | 12 +-- .../0056-Add-exception-reporting-event.patch | 16 ++-- ...oreboards-for-non-players-by-default.patch | 6 +- ...065-Handle-Item-Meta-Inconsistencies.patch | 8 +- ...8-Custom-replacement-for-eaten-items.patch | 42 ++++----- ...070-Use-a-Shared-Random-for-Entities.patch | 6 +- ...Location-getType-and-getBlockData-fo.patch | 12 +-- ...Entity-AddTo-RemoveFrom-World-Events.patch | 6 +- ...-possibility-for-getServer-singleton.patch | 4 +- ...item-frames-performance-and-bug-fixe.patch | 4 +- ...-API-Replenishable-Lootables-Feature.patch | 4 +- ...ptimise-BlockState-s-hashCode-equals.patch | 13 ++- ...tion-to-remove-corrupt-tile-entities.patch | 4 +- ...-Bound-Treasure-Maps-to-World-Border.patch | 4 +- .../0120-Optimize-ItemStack.isEmpty.patch | 4 +- ...llow-entities-to-ride-themselves-572.patch | 4 +- .../server/0130-Cap-Entity-Collisions.patch | 6 +- ...oleAppender-for-console-improvements.patch | 4 +- .../server/0146-Entity-fromMobSpawner.patch | 10 +- ...-get-a-BlockState-without-a-snapshot.patch | 4 +- ...1-PlayerNaturallySpawnCreaturesEvent.patch | 10 +- ...e-shield-blocking-delay-configurable.patch | 4 +- .../0218-InventoryCloseEvent-Reason-API.patch | 4 +- ...-more-information-to-Entity.toString.patch | 12 +-- ...0-Vanished-players-don-t-have-rights.patch | 6 +- ...ies-option-to-debug-dupe-uuid-issues.patch | 14 +-- ...251-Optimize-CraftBlockData-Creation.patch | 4 +- .../server/0252-Optimize-MappedRegistry.patch | 14 +-- ...57-Asynchronous-chunk-IO-and-loading.patch | 64 ++++++------- ...-ray-tracing-methods-to-LivingEntity.patch | 4 +- ...ow-chests-to-be-placed-with-NBT-data.patch | 4 +- ...273-Add-LivingEntity-getTargetEntity.patch | 4 +- ...entity-dismount-during-teleportation.patch | 12 +-- .../0314-Entity-getEntitySpawnReason.patch | 12 +-- .../0323-Mob-Spawner-API-Enhancements.patch | 32 +++---- ...isPrimaryThread-and-MinecraftServer-.patch | 4 +- ...le-Keep-Spawn-Loaded-range-per-world.patch | 6 +- ...332-Allow-Saving-of-Oversized-Chunks.patch | 6 +- ...334-Fix-World-isChunkGenerated-calls.patch | 12 +-- ...revent-consuming-the-wrong-itemstack.patch | 22 ++--- ...5656-Fix-Follow-Range-Initial-Target.patch | 4 +- .../0346-Duplicate-UUID-Resolve-Option.patch | 6 +- patches/server/0347-Optimize-Hoppers.patch | 8 +- .../server/0354-Lag-compensate-eating.patch | 4 +- .../0358-Entity-Activation-Range-2.0.patch | 10 +- patches/server/0360-Fix-Light-Command.patch | 6 +- .../0362-Tracking-Range-Improvements.patch | 4 +- ...x-items-vanishing-through-end-portal.patch | 4 +- ...ement-optional-per-player-mob-spawns.patch | 12 +-- ...opper-searches-if-there-are-no-items.patch | 39 ++++---- ...e-getChunkAt-calls-for-loaded-chunks.patch | 6 +- .../0368-Add-debug-for-sync-chunk-loads.patch | 6 +- ...n-to-nerf-pigmen-from-nether-portals.patch | 8 +- ...-Add-tick-times-API-and-mspt-command.patch | 4 +- ...-PlayerChunkMap-adds-crashing-server.patch | 10 +- ...ptimize-Collision-to-not-load-chunks.patch | 20 +--- .../0393-Improved-Watchdog-Support.patch | 22 ++--- ...-Chunk-Post-Processing-deadlock-risk.patch | 10 +- ...g-Broken-behavior-of-PlayerJoinEvent.patch | 4 +- ...pawn-point-if-spawn-in-unloaded-worl.patch | 4 +- ...ntom-creative-and-insomniac-controls.patch | 4 +- ...m-duplication-issues-and-teleport-is.patch | 12 +-- .../0414-Optimize-Voxel-Shape-Merging.patch | 6 +- ...and-End-Portal-Frames-from-being-des.patch | 16 ++-- ...llocation-of-Vec3D-by-entity-tracker.patch | 4 +- ...ston-physics-inconsistency-MC-188840.patch | 4 +- ...sure-Entity-AABB-s-are-never-invalid.patch | 8 +- ...ld-Difficulty-Remembering-Difficulty.patch | 6 +- ...448-Don-t-allow-null-UUID-s-for-chat.patch | 6 +- ...ze-NibbleArray-to-use-pooled-buffers.patch | 6 +- .../server/0461-Add-entity-liquid-API.patch | 4 +- ...pdate-itemstack-legacy-name-and-lore.patch | 6 +- ...geEvent-not-firing-for-all-use-cases.patch | 4 +- ...CreateEvent-needs-to-know-its-entity.patch | 10 +- .../0496-Cache-block-data-strings.patch | 4 +- ...ortation-and-cancel-velocity-if-tele.patch | 8 +- ...y-Counter-to-allow-plugins-to-use-va.patch | 6 +- patches/server/0504-Entity-isTicking.patch | 4 +- ...-non-whitelisted-player-when-white-l.patch | 4 +- ...inig-for-some-hot-IBlockData-methods.patch | 10 +- ...der-Remove-Streams-Optimized-collect.patch | 6 +- ...-should-not-bypass-cramming-gamerule.patch | 6 +- .../0540-MC-4-Fix-item-position-desync.patch | 4 +- ...1-Added-ServerResourcesReloadedEvent.patch | 6 +- patches/server/0569-Remove-stale-POIs.patch | 4 +- ...n-for-requiring-a-player-participant.patch | 4 +- ...ce-map-update-when-spawning-disabled.patch | 4 +- ...telist-use-configurable-kick-message.patch | 4 +- ...ItemConsumeEvent-cancelling-properly.patch | 14 +-- .../0661-Add-PlayerKickEvent-causes.patch | 4 +- todo.txt | 17 ++++ work/BuildData | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 109 files changed, 547 insertions(+), 539 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ab9ef4e8cf..4f69aafe47 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,7 +46,7 @@ repositories { } dependencies { - paramMappings("net.fabricmc:yarn:1.18-pre5+build.4:mergedv2") + paramMappings("net.fabricmc:yarn:1.18-pre8+build.4:mergedv2") remapper("net.fabricmc:tiny-remapper:0.7.0:fat") decompiler("net.minecraftforge:forgeflower:1.5.498.22") paperclip("io.papermc:paperclip:2.0.1") diff --git a/gradle.properties b/gradle.properties index 25a452897d..07543018ce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group=io.papermc.paper -version=1.18-pre5-R0.1-SNAPSHOT +version=1.18-pre8-R0.1-SNAPSHOT -mcVersion=1.18-pre5 +mcVersion=1.18-pre8 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/api/0001-Convert-project-to-Gradle.patch b/patches/api/0001-Convert-project-to-Gradle.patch index 18a7a8768b..5a361623ef 100644 --- a/patches/api/0001-Convert-project-to-Gradle.patch +++ b/patches/api/0001-Convert-project-to-Gradle.patch @@ -101,7 +101,7 @@ index 0000000000000000000000000000000000000000..2ffdda3764d92227264dd4a1ef9bf473 +} diff --git a/pom.xml b/pom.xml deleted file mode 100644 -index 8bc4d62002fded42985c2c25f7b7b558ddf25ba3..0000000000000000000000000000000000000000 +index c8947e43bcd83c51d79ebe5a110445bf1e5388b2..0000000000000000000000000000000000000000 --- a/pom.xml +++ /dev/null @@ -1,262 +0,0 @@ @@ -112,7 +112,7 @@ index 8bc4d62002fded42985c2c25f7b7b558ddf25ba3..00000000000000000000000000000000 - - org.spigotmc - spigot-api -- 1.18-pre5-R0.1-SNAPSHOT +- 1.18-pre8-R0.1-SNAPSHOT - jar - - Spigot-API diff --git a/patches/server/0001-Setup-Gradle-project.patch b/patches/server/0001-Setup-Gradle-project.patch index b1d11690eb..3558d21ef6 100644 --- a/patches/server/0001-Setup-Gradle-project.patch +++ b/patches/server/0001-Setup-Gradle-project.patch @@ -184,17 +184,17 @@ index 0000000000000000000000000000000000000000..9778c18a2822b00d48134583de87ea28 +} diff --git a/pom.xml b/pom.xml deleted file mode 100644 -index 3610b0d8e10f873b8480864d6f73c20ae8c5d1f1..0000000000000000000000000000000000000000 +index ceaffe39fddbcc5f646f7fc5ddd471ba0ebb3bf3..0000000000000000000000000000000000000000 --- a/pom.xml +++ /dev/null -@@ -1,539 +0,0 @@ +@@ -1,540 +0,0 @@ - - 4.0.0 - org.spigotmc - spigot - jar -- 1.18-pre5-R0.1-SNAPSHOT +- 1.18-pre8-R0.1-SNAPSHOT - Spigot - https://www.spigotmc.org/ - @@ -552,6 +552,7 @@ index 3610b0d8e10f873b8480864d6f73c20ae8c5d1f1..00000000000000000000000000000000 - - SHA-256 - +- true - - compile - runtime diff --git a/patches/server/0002-Remap-fixes.patch b/patches/server/0002-Remap-fixes.patch index 72fb568a5c..68bd5b35fd 100644 --- a/patches/server/0002-Remap-fixes.patch +++ b/patches/server/0002-Remap-fixes.patch @@ -59,7 +59,7 @@ index bb57dacc71711abfd9fb22a395ff798920564e5a..f6aed91482d9c7bf8b56fb7c53f938a4 if (entity1 == null) { diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java -index b925f8e74cad0214c57b2c5cb75502dce3f23e15..28fbdc53dd983e462db50261164f522d1996f50d 100644 +index 88258cc1971c0764912d2f3cbfcd426d8f26cd62..e51a78e52969ec687956d16566494fc524e50cb8 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java @@ -172,11 +172,11 @@ public class BehaviorUtils { @@ -78,18 +78,18 @@ index b925f8e74cad0214c57b2c5cb75502dce3f23e15..28fbdc53dd983e462db50261164f522d entityliving1 = entityliving2; } else { diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index c0694fef35bc000a5212e377a285dfd1dd94ca07..2e2bc7213b7e19e945eba885ff5614f809c81db0 100644 +index e235729577a80475eaf6e33487363822691d2dce..28d35bde3207b1c06bd97e7c1cdc3f687a28bbf6 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -172,7 +172,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - Map, Object2ObjectLinkedOpenHashMap>> map = Maps.newHashMap(); // CraftBukkit +@@ -175,7 +175,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { + Builder> builder = ImmutableMap.builder(); recipes.forEach((irecipe) -> { - Map> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> { + Map> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes_) -> { // Paper - remap fix return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit }); - Recipe irecipe1 = (Recipe) map1.put(irecipe.getId(), irecipe); + ResourceLocation minecraftkey = irecipe.getId(); diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java index ad52c3fc6210939a39ef77a382c640a24ee44838..6b7dd01778f0a5d3a96d2d04af4b525d17efbfba 100644 --- a/src/test/java/org/bukkit/DyeColorsTest.java diff --git a/patches/server/0004-Paper-config-files.patch b/patches/server/0004-Paper-config-files.patch index 2e22172ecb..2b7deade27 100644 --- a/patches/server/0004-Paper-config-files.patch +++ b/patches/server/0004-Paper-config-files.patch @@ -629,7 +629,7 @@ index dc2cb18ec926e2eed1caa8e2106e70bcb04f6c0f..a497b281d03c097587b21e9f141a6a66 Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, generatorOptions, eraseCache); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index cf64088cbf19ef17943fdfd51fc543d4acc0e794..6e97d5101be851518461df440d8160a2710afc0d 100644 +index 5c03d8f93d6a5c63434f1992ed401bf0421a47c9..15e6c1d87e8a165b8a9e3bc72796109fd1e2e063 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -601,6 +601,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop extends WritableRegistry { + } + + static record RegistryEntry(ResourceKey key, int id, T value) { +- RegistryEntry(ResourceKey key, int rawId, T entry) { +- this.key = key; +- this.id = rawId; +- this.value = entry; +- } + } + } diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java index 8c37ed1d70c5874bb1bd96fe33b087d4ddc2d68e..ea68b26e506e48d8238b7ee4266e61b211d52bd2 100644 --- a/src/main/java/net/minecraft/nbt/ListTag.java @@ -123,18 +138,10 @@ index 1f70fdaf08541ad57b2046e85e156be9446b372d..ea69f11e3cd9775998679baaccdaf980 private static final int MIN_PROTOCOL_ID = -1; private static final int MAX_PROTOCOL_ID = 2; diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java -index a444455e8b216f9d1a34089c5793788923eec916..5b08eaaf42566827e1cb755710736f1306ef04db 100644 +index 11d3d7d1a42f342bcbdc313fd39b379ceec3c0eb..f6e043810e654db6497be6720a9fbfb93aff12f6 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLoginPacket.java -@@ -12,32 +12,13 @@ import net.minecraft.world.level.GameType; - import net.minecraft.world.level.Level; - import net.minecraft.world.level.dimension.DimensionType; - --public record ClientboundLoginPacket(int playerId, boolean hardcore, GameType gameType, GameType previousGameType, Set> levels, RegistryAccess.RegistryHolder registryHolder, DimensionType dimensionType, ResourceKey dimension, long seed, int maxPlayers, int chunkRadius, int simulationDistance, boolean reducedDebugInfo, boolean showDeathScreen, boolean isDebug, boolean isFlat) implements Packet { -+public record ClientboundLoginPacket(int playerId, boolean hardcore, GameType gameType, GameType previousGameType, Set> levels, RegistryAccess.RegistryHolder registryHolder, DimensionType dimensionType, ResourceKey dimension, long seed, int maxPlayers, int chunkRadius, int simulationDistance, boolean reducedDebugInfo, boolean showDeathScreen, boolean isDebug, boolean isFlat) implements Packet { // Paper - fix missing generic - public ClientboundLoginPacket(FriendlyByteBuf buf) { - this(buf.readInt(), buf.readBoolean(), GameType.byId(buf.readByte()), GameType.byNullableId(buf.readByte()), buf.readCollection(Sets::newHashSetWithExpectedSize, (b) -> { - return ResourceKey.create(Registry.DIMENSION_REGISTRY, b.readResourceLocation()); +@@ -19,25 +19,6 @@ public record ClientboundLoginPacket(int playerId, boolean hardcore, GameType ga }), buf.readWithCodec(RegistryAccess.RegistryHolder.NETWORK_CODEC), buf.readWithCodec(DimensionType.CODEC).get(), ResourceKey.create(Registry.DIMENSION_REGISTRY, buf.readResourceLocation()), buf.readLong(), buf.readVarInt(), buf.readVarInt(), buf.readVarInt(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean()); } @@ -161,10 +168,10 @@ index a444455e8b216f9d1a34089c5793788923eec916..5b08eaaf42566827e1cb755710736f13 public void write(FriendlyByteBuf buf) { buf.writeInt(this.playerId); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6e97d5101be851518461df440d8160a2710afc0d..b06105d3920f68bcedb81359b0f62925421b338d 100644 +index 15e6c1d87e8a165b8a9e3bc72796109fd1e2e063..18f1bfed979e756a62ff8f5ee434d8270ab987d4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1724,7 +1724,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop SortedArraySet create(Comparator comparator) { diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -index 4c56628f7a930e1d46e486a957551425e25b0508..6514401da53772301be2b3abc827504903e43644 100644 +index 93d9b14eb8793b8ee2193f7525306a5e4f1900f6..63f283f32bdad02299d4a16c305a28c3bfbce9a8 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java @@ -30,7 +30,7 @@ public class PoiSection { @@ -213,20 +220,20 @@ index 4c56628f7a930e1d46e486a957551425e25b0508..6514401da53772301be2b3abc8275049 return poiSet.isValid; }), PoiRecord.codec(updateListener).listOf().fieldOf("Records").forGetter((poiSet) -> { diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 2e2bc7213b7e19e945eba885ff5614f809c81db0..b4edadc980c8305613bb4277c7028e2588653857 100644 +index 28d35bde3207b1c06bd97e7c1cdc3f687a28bbf6..32263bc80fba1a0df6ea387d8e9c3cf27b29bbb1 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -75,7 +75,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { +@@ -77,7 +77,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { } this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { - return (entry1.getValue()); // CraftBukkit + return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* // todo: is this needed anymore? })); + this.byName = Maps.newHashMap(builder.build()); // CraftBukkit RecipeManager.LOGGER.info("Loaded {} recipes", map1.size()); - } diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index 3c20bd9405f7844d92fdb42a49efd260bff7c7a0..315a6bbdfa59d85be721735cfe727d34b28fc0ad 100644 +index 0f7950458dc2dfac51ed0d56f1790395f0b03bc2..fa4544541b9c5f163b633596e73a5197cd081eb8 100644 --- a/src/main/java/net/minecraft/world/level/biome/Biome.java +++ b/src/main/java/net/minecraft/world/level/biome/Biome.java @@ -39,8 +39,32 @@ import org.apache.logging.log4j.Logger; @@ -264,7 +271,7 @@ index 3c20bd9405f7844d92fdb42a49efd260bff7c7a0..315a6bbdfa59d85be721735cfe727d34 public static final Codec> CODEC = RegistryFileCodec.create(Registry.BIOME_REGISTRY, DIRECT_CODEC); public static final Codec>> LIST_CODEC = RegistryFileCodec.homogeneousList(Registry.BIOME_REGISTRY, DIRECT_CODEC); private static final PerlinSimplexNoise TEMPERATURE_NOISE = new PerlinSimplexNoise(new WorldgenRandom(new LegacyRandomSource(1234L)), ImmutableList.of(0)); -@@ -242,33 +266,6 @@ public final class Biome { +@@ -257,33 +281,6 @@ public final class Biome { return resourceLocation == null ? super.toString() : resourceLocation.toString(); } diff --git a/patches/server/0006-MC-Utils.patch b/patches/server/0006-MC-Utils.patch index f5d70c265f..39170d6c83 100644 --- a/patches/server/0006-MC-Utils.patch +++ b/patches/server/0006-MC-Utils.patch @@ -5016,7 +5016,7 @@ index 0000000000000000000000000000000000000000..ff4def7ec3dcfa30fdc0135bd1add8e4 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b06105d3920f68bcedb81359b0f62925421b338d..6fc450b66d381c6453498fa18d36570ef74b124d 100644 +index 18f1bfed979e756a62ff8f5ee434d8270ab987d4..2361a92630d2639d602bc1434b061ad9a969130b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -294,6 +294,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); this.visibleChunkMap = this.updatingChunkMap.clone(); -@@ -191,6 +242,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -192,6 +243,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.overworldDataStorage = persistentStateManagerFactory; this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, world); this.setViewDistance(viewDistance); @@ -5366,7 +5366,7 @@ index 370a5c20e544f5ae03bc5b392aaa3f375d100bec..6e5a25db47b0de69303060ad172eae7c } protected ChunkGenerator generator() { -@@ -318,6 +373,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -319,6 +374,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -5381,7 +5381,7 @@ index 370a5c20e544f5ae03bc5b392aaa3f375d100bec..6e5a25db47b0de69303060ad172eae7c private CompletableFuture, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkPos centerChunk, int margin, IntFunction distanceToStatus) { List>> list = Lists.newArrayList(); int j = centerChunk.x; -@@ -408,6 +471,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -409,6 +472,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider holder.setTicketLevel(level); } else { holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); @@ -5393,7 +5393,7 @@ index 370a5c20e544f5ae03bc5b392aaa3f375d100bec..6e5a25db47b0de69303060ad172eae7c } this.updatingChunkMap.put(pos, holder); -@@ -532,7 +600,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -534,7 +602,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (completablefuture1 != completablefuture) { this.scheduleUnload(pos, holder); } else { @@ -5408,7 +5408,7 @@ index 370a5c20e544f5ae03bc5b392aaa3f375d100bec..6e5a25db47b0de69303060ad172eae7c if (ichunkaccess instanceof LevelChunk) { ((LevelChunk) ichunkaccess).setLoaded(false); } -@@ -547,7 +621,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -549,7 +623,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lightEngine.updateChunkStatus(ichunkaccess.getPos()); this.lightEngine.tryScheduleUpdate(); this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); @@ -5421,7 +5421,7 @@ index 370a5c20e544f5ae03bc5b392aaa3f375d100bec..6e5a25db47b0de69303060ad172eae7c } }; -@@ -1061,6 +1139,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1089,6 +1167,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!flag1) { this.distanceManager.addPlayer(SectionPos.of((Entity) player), player); } @@ -5429,7 +5429,7 @@ index 370a5c20e544f5ae03bc5b392aaa3f375d100bec..6e5a25db47b0de69303060ad172eae7c } else { SectionPos sectionposition = player.getLastSectionPos(); -@@ -1068,6 +1147,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1096,6 +1175,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!flag2) { this.distanceManager.removePlayer(sectionposition, player); } @@ -5437,7 +5437,7 @@ index 370a5c20e544f5ae03bc5b392aaa3f375d100bec..6e5a25db47b0de69303060ad172eae7c } for (int k = i - this.viewDistance; k <= i + this.viewDistance; ++k) { -@@ -1184,6 +1264,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1212,6 +1292,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -5447,22 +5447,19 @@ index 370a5c20e544f5ae03bc5b392aaa3f375d100bec..6e5a25db47b0de69303060ad172eae7c @Override diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..2616debed901b2dd0bd5ad3ea26ffce2d92dc6c1 100644 +index bdc774e3fbb949290fbc94c4b0cbc8f2c09f5bd8..8509bf94f64c6b761ee38e39278d12fcedeeff75 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -46,8 +46,11 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana - import net.minecraft.world.level.storage.DimensionDataStorage; - import net.minecraft.world.level.storage.LevelData; +@@ -48,6 +48,8 @@ import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.level.storage.LevelStorageSource; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper +import java.util.function.Function; // Paper public class ServerChunkCache extends ChunkSource { -+ public static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper - public static final List CHUNK_STATUSES = ChunkStatus.getStatusList(); - private final DistanceManager distanceManager; -@@ -67,6 +70,334 @@ public class ServerChunkCache extends ChunkSource { +@@ -70,6 +72,334 @@ public class ServerChunkCache extends ChunkSource { @Nullable @VisibleForDebug private NaturalSpawner.SpawnState lastSpawnState; @@ -5797,7 +5794,7 @@ index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..2616debed901b2dd0bd5ad3ea26ffce2 public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory) { this.level = world; -@@ -127,6 +458,49 @@ public class ServerChunkCache extends ChunkSource { +@@ -130,6 +460,49 @@ public class ServerChunkCache extends ChunkSource { this.lastChunk[0] = chunk; } @@ -5847,7 +5844,7 @@ index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..2616debed901b2dd0bd5ad3ea26ffce2 @Nullable @Override public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) { -@@ -441,7 +815,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -444,7 +817,7 @@ public class ServerChunkCache extends ChunkSource { gameprofilerfiller.popPush("spawnAndTick"); boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit @@ -5857,7 +5854,7 @@ index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..2616debed901b2dd0bd5ad3ea26ffce2 while (iterator1.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 54b4b73c05d87fc7b939a38915e62fef2405db7f..d94dca6db38207021026953ef4598756a797562c 100644 +index 718cfd07e2449657e402ba1c26b4a13b82c4e5d5..8a6d3ea7fd43a6a25e904227f005a452956f7d9e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -9,6 +9,7 @@ import it.unimi.dsi.fastutil.longs.LongSet; @@ -6008,7 +6005,7 @@ index 3a4f026c73cdd22d30bdadabbcf24bef969b73e4..0d536d72ac918fbd403397ff369d1014 private final String name; private final Comparator comparator; diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index 1898616fa04a16983fefe8e4fa0c60de82b52f03..fea9a73b64523b8a065b37ebf8be50d5ec0faccb 100644 +index 04204239808a6479b6354520abcead24bcd40dc8..5d189257f494eb12b5fd98b12da6dd09ca14f972 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java @@ -152,6 +152,26 @@ public class WorldGenRegion implements WorldGenLevel { @@ -6056,7 +6053,7 @@ index cf596d49cf21f66245095753f38aebaaa680259b..0251908052d6221dc9fdab38ff8cfb3b private final AtomicInteger chatSpamTickCount = new AtomicInteger(); // CraftBukkit end diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index a4c5edee297af6d68d518b77f706732b5ccbe4de..7bf4bf5cb2c1b54a7e2733091f48f3a824336d36 100644 +index 430919a5aa261951a6f79483655dbd6111b4824a..58692386e24723a1075ff4f4cc70f40ed957c52f 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java @@ -78,6 +78,13 @@ public abstract class BlockableEventLoop implements Profiler @@ -6074,10 +6071,10 @@ index a4c5edee297af6d68d518b77f706732b5ccbe4de..7bf4bf5cb2c1b54a7e2733091f48f3a8 @Override public void tell(R runnable) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b40beedacba589ac2ec117d6e619730d7e072e12..371ecc33fec6b8c1a2c022196e90e6169ca1eb3b 100644 +index 6cedaffa7de69c3ca0eb8435cdcb5d25b57cefc9..6478a8225bbf434e25c4b159cb890d39892e32d8 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -302,6 +302,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -301,6 +301,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); } // CraftBukkit end @@ -6090,7 +6087,7 @@ index b40beedacba589ac2ec117d6e619730d7e072e12..371ecc33fec6b8c1a2c022196e90e616 public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index dde1e84b2ff048fe96b77daa81374f0e68be4310..010d7a0dc97c7bdd3fbafe974aa73f3dba106d4d 100644 +index e772ed45ba7cf366c6da0dc8b1bd3497d561473a..e9e97cf0b202c84252fb3bada97890198fcc6bb9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -256,6 +256,7 @@ public abstract class LivingEntity extends Entity { @@ -6139,10 +6136,10 @@ index 6c3044b6194dfd3037389d717bbe6783f58b951d..457880c9e894a83d88505cf0b7235df9 super(type, world); this.xpReward = 5; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 208a713ec4b7b592801eb26860b7b81a2b3f7aa2..df787c12053f799b111c539d866ff8c751e21611 100644 +index 962c942c05fc02befef6c306df51c0b438dd1dab..566f1b8a0acd679b2f776db2e80458b1c532f97e 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -727,6 +727,25 @@ public final class ItemStack { +@@ -728,6 +728,25 @@ public final class ItemStack { return this.tag != null ? this.tag.getList("Enchantments", 10) : new ListTag(); } @@ -6168,7 +6165,7 @@ index 208a713ec4b7b592801eb26860b7b81a2b3f7aa2..df787c12053f799b111c539d866ff8c7 public void setTag(@Nullable CompoundTag nbt) { this.tag = nbt; if (this.getItem().canBeDepleted()) { -@@ -1127,6 +1146,7 @@ public final class ItemStack { +@@ -1128,6 +1147,7 @@ public final class ItemStack { // CraftBukkit start @Deprecated public void setItem(Item item) { @@ -6214,10 +6211,10 @@ index 76251b5adf41f8e5bf2c07145abe3108fcde8669..a60b8043540cacfa8cc3baba0872eefd FluidState getFluidState(BlockPos pos); diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java -index 134d9a360ce32ee1bbd37a5ad51d4a593b2fc022..18c8988dcb5b475c8738a313f1775b73c9d961f4 100644 +index bd7d159bdc21d7fcb25db1e3f07b9ad9d7eb5157..4c5f8a103b550a681178926096d5f758654c61a7 100644 --- a/src/main/java/net/minecraft/world/level/ChunkPos.java +++ b/src/main/java/net/minecraft/world/level/ChunkPos.java -@@ -17,6 +17,7 @@ public class ChunkPos { +@@ -18,6 +18,7 @@ public class ChunkPos { private static final int REGION_MASK = 31; public final int x; public final int z; @@ -6225,7 +6222,7 @@ index 134d9a360ce32ee1bbd37a5ad51d4a593b2fc022..18c8988dcb5b475c8738a313f1775b73 private static final int HASH_A = 1664525; private static final int HASH_C = 1013904223; private static final int HASH_Z_XOR = -559038737; -@@ -24,23 +25,26 @@ public class ChunkPos { +@@ -25,23 +26,26 @@ public class ChunkPos { public ChunkPos(int x, int z) { this.x = x; this.z = z; @@ -6278,7 +6275,7 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..c7d499bfc22152e0a49f50a2a8133f31 public BlockState getBlockState(BlockPos pos) { return Blocks.AIR.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e2b9c20a82630f1991228c6194acef5ef6a7b8b0..8427d08ca3b61cce9d7bbdfdcf5946e1f459a21f 100644 +index f18ae5b80c930c3a7c2da079b9926ab2657c36a3..9e6a02a05ea20c21aed26ed4bc92488627febd4c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -85,6 +85,7 @@ import org.bukkit.craftbukkit.CraftServer; @@ -6364,7 +6361,7 @@ index e2b9c20a82630f1991228c6194acef5ef6a7b8b0..8427d08ca3b61cce9d7bbdfdcf5946e1 return chunk.getBlockState(pos); } diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java -index 945fe8969eb61d13207d60e9c2a906aa9b5b6650..4fede11c074894686a9bdc18b031243af72292ad 100644 +index a1cb8379ed4062d765659e829ba2262487ce7f8b..aa76f45d18f23997af5a9508559817964ef5e23c 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java @@ -18,6 +18,7 @@ import net.minecraft.world.level.levelgen.Heightmap; @@ -6418,10 +6415,10 @@ index 47bd74f75f4c49a34a485d1963325a2152756c29..7c921d024205b683c3881c4db9314155 @Override public BlockEntity getBlockEntity(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index c8d857e354b567be7bd885b3b6b4015390519af1..7d06d476d8e12bdb395488e85e34231daccbd853 100644 +index 0cb0b6143e3307e546c78ecda2c35ac31a8a7001..a3f44e3a44b2ec21ef41f6d598b428448c847c5f 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -602,14 +602,14 @@ public abstract class BlockBehaviour { +@@ -644,14 +644,14 @@ public abstract class BlockBehaviour { public abstract static class BlockStateBase extends StateHolder { @@ -6439,7 +6436,7 @@ index c8d857e354b567be7bd885b3b6b4015390519af1..7d06d476d8e12bdb395488e85e34231d private final BlockBehaviour.StatePredicate isRedstoneConductor; private final BlockBehaviour.StatePredicate isSuffocating; private final BlockBehaviour.StatePredicate isViewBlocking; -@@ -637,10 +637,18 @@ public abstract class BlockBehaviour { +@@ -679,10 +679,18 @@ public abstract class BlockBehaviour { this.emissiveRendering = blockbase_info.emissiveRendering; } @@ -6458,7 +6455,7 @@ index c8d857e354b567be7bd885b3b6b4015390519af1..7d06d476d8e12bdb395488e85e34231d } -@@ -672,8 +680,8 @@ public abstract class BlockBehaviour { +@@ -714,8 +722,8 @@ public abstract class BlockBehaviour { return this.getBlock().getOcclusionShape(this.asState(), world, pos); } @@ -6470,7 +6467,7 @@ index c8d857e354b567be7bd885b3b6b4015390519af1..7d06d476d8e12bdb395488e85e34231d public boolean useShapeForLightOcclusion() { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 0c04dd7f71598aeb673ccdd626d6b7f6040ae9a1..2e5619a581d18008df31f4b2a279e7418264aa4f 100644 +index aeceb5106dd5af79236cfb724c7837448897138d..7cceac53e445fe199f59a619a69a96ef97ae50b5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java @@ -58,7 +58,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @@ -6480,9 +6477,9 @@ index 0c04dd7f71598aeb673ccdd626d6b7f6040ae9a1..2e5619a581d18008df31f4b2a279e741 - protected final ChunkPos chunkPos; + protected final ChunkPos chunkPos; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key private long inhabitedTime; + /** @deprecated */ @Nullable - @Deprecated -@@ -77,7 +77,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -78,7 +78,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom protected final LevelChunkSection[] sections; public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry biome, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) { @@ -6493,7 +6490,7 @@ index 0c04dd7f71598aeb673ccdd626d6b7f6040ae9a1..2e5619a581d18008df31f4b2a279e741 this.levelHeightAccessor = heightLimitView; this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()]; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index a380521593e3beff1d4ee186086b2af18cb7b4dc..4ed85501fc81de7a2262a8061ba8a38828a86817 100644 +index 0c029abf45afb7cd90477728e5e8274122a7dd21..a26306c6077da40c719c2ef2e17f00c230c886d1 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -24,6 +24,7 @@ import net.minecraft.nbt.CompoundTag; @@ -6634,7 +6631,7 @@ index a380521593e3beff1d4ee186086b2af18cb7b4dc..4ed85501fc81de7a2262a8061ba8a388 @Override public FluidState getFluidState(BlockPos pos) { return this.getFluidState(pos.getX(), pos.getY(), pos.getZ()); -@@ -344,6 +461,7 @@ public class LevelChunk extends ChunkAccess { +@@ -345,6 +462,7 @@ public class LevelChunk extends ChunkAccess { return this.getBlockEntity(pos, LevelChunk.EntityCreationType.CHECK); } @@ -6642,7 +6639,7 @@ index a380521593e3beff1d4ee186086b2af18cb7b4dc..4ed85501fc81de7a2262a8061ba8a388 @Nullable public BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType) { // CraftBukkit start -@@ -513,7 +631,25 @@ public class LevelChunk extends ChunkAccess { +@@ -514,7 +632,25 @@ public class LevelChunk extends ChunkAccess { // CraftBukkit start public void loadCallback() { @@ -6668,7 +6665,7 @@ index a380521593e3beff1d4ee186086b2af18cb7b4dc..4ed85501fc81de7a2262a8061ba8a388 if (server != null) { /* * If it's a new world, the first few chunks are generated inside -@@ -552,6 +688,22 @@ public class LevelChunk extends ChunkAccess { +@@ -553,6 +689,22 @@ public class LevelChunk extends ChunkAccess { server.getPluginManager().callEvent(unloadEvent); // note: saving can be prevented, but not forced if no saving is actually required this.mustNotSave = !unloadEvent.isSaveChunk(); @@ -6937,7 +6934,7 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0596f94c6ae22fcfddd7370e1eebd71885ed0e54..af1f7591e99b1aac95bcfabbe20447c1b5ad3adf 100644 +index bd9cf03ae91e3cede79190c573ec32199637e5d5..11385b98a7197a3912b94ca12129e61aa0736571 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -88,8 +88,17 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0009-Add-MinecraftKey-Information-to-Objects.patch b/patches/server/0009-Add-MinecraftKey-Information-to-Objects.patch index cb25d7943c..4e7139897c 100644 --- a/patches/server/0009-Add-MinecraftKey-Information-to-Objects.patch +++ b/patches/server/0009-Add-MinecraftKey-Information-to-Objects.patch @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..9f0c7fd903f085e70db1785fb8bcdb54 + } +} diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 371ecc33fec6b8c1a2c022196e90e6169ca1eb3b..05de8dd72834c689af47628155af2f9b0084273f 100644 +index 6478a8225bbf434e25c4b159cb890d39892e32d8..97a154a106c7084e2a70d39e8b4c336db8cd51c6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -146,7 +146,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; +@@ -145,7 +145,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.plugin.PluginManager; // CraftBukkit end @@ -48,7 +48,7 @@ index 371ecc33fec6b8c1a2c022196e90e6169ca1eb3b..05de8dd72834c689af47628155af2f9b // CraftBukkit start private static final int CURRENT_LEVEL = 2; -@@ -1989,12 +1989,32 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -1943,12 +1943,32 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { return true; } @@ -83,7 +83,7 @@ index 371ecc33fec6b8c1a2c022196e90e6169ca1eb3b..05de8dd72834c689af47628155af2f9b protected abstract void readAdditionalSaveData(CompoundTag nbt); diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 31389ab9ac85ac14487d8715504ded2ee8754ab8..927133867393fc805b44e824f7b78fac372b0b25 100644 +index 7fb9a450408702268855e29f1025a1a596543b9d..23f0a89b01d02a5757a90f0232cafa8e1cd7cf85 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -23,7 +23,7 @@ import org.bukkit.inventory.InventoryHolder; diff --git a/patches/server/0010-Timings-v2.patch b/patches/server/0010-Timings-v2.patch index 13185a52ee..352b339454 100644 --- a/patches/server/0010-Timings-v2.patch +++ b/patches/server/0010-Timings-v2.patch @@ -772,7 +772,7 @@ index b3a6aeba2363d283f03982cf749f25cfa11a5052..449f1b2f5dca350dc0912e14c8c2bf3e PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6fc450b66d381c6453498fa18d36570ef74b124d..37ace477c170be9453ab65976085837faa312255 100644 +index 2361a92630d2639d602bc1434b061ad9a969130b..f63468868f13ddfeef3fe395c3dc011f191eeda8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -179,7 +179,7 @@ import org.bukkit.craftbukkit.generator.CustomWorldChunkManager; @@ -1041,7 +1041,7 @@ index 4dd57007af218ba1c0e666117a49939c5884f2c6..a6cb949b6f048455acc50c897fdd93d3 } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6e5a25db47b0de69303060ad172eae7c9b8b0905..66416d761cc71b2d57acb840b781870dc3180c46 100644 +index 85c177bdf9ab329b7ff30294fd8d45b6690d6b71..032bd9e952c0336f643dda514f265e78c491c8e2 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1,8 +1,10 @@ @@ -1055,7 +1055,7 @@ index 6e5a25db47b0de69303060ad172eae7c9b8b0905..66416d761cc71b2d57acb840b781870d import com.google.common.collect.Lists; import com.google.common.collect.Queues; import com.google.common.collect.Sets; -@@ -677,11 +679,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -679,11 +681,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private CompletableFuture> scheduleChunkLoad(ChunkPos pos) { return CompletableFuture.supplyAsync(() -> { @@ -1073,7 +1073,7 @@ index 6e5a25db47b0de69303060ad172eae7c9b8b0905..66416d761cc71b2d57acb840b781870d boolean flag = nbttagcompound.contains("Status", 8); if (flag) { -@@ -692,7 +697,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -694,7 +699,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } ChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", pos); @@ -1082,7 +1082,7 @@ index 6e5a25db47b0de69303060ad172eae7c9b8b0905..66416d761cc71b2d57acb840b781870d } catch (ReportedException reportedexception) { Throwable throwable = reportedexception.getCause(); -@@ -806,6 +811,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -811,6 +816,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkstatus = ChunkHolder.getStatus(chunkHolder.getTicketLevel()); return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> { @@ -1090,7 +1090,7 @@ index 6e5a25db47b0de69303060ad172eae7c9b8b0905..66416d761cc71b2d57acb840b781870d ChunkPos chunkcoordintpair = chunkHolder.getPos(); ProtoChunk protochunk = (ProtoChunk) ichunkaccess; LevelChunk chunk; -@@ -830,6 +836,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -835,6 +841,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } return chunk; @@ -1098,7 +1098,7 @@ index 6e5a25db47b0de69303060ad172eae7c9b8b0905..66416d761cc71b2d57acb840b781870d }); }, (runnable) -> { ProcessorHandle mailbox = this.mainThreadMailbox; -@@ -1349,6 +1356,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1377,6 +1384,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider List list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); @@ -1106,7 +1106,7 @@ index 6e5a25db47b0de69303060ad172eae7c9b8b0905..66416d761cc71b2d57acb840b781870d ChunkMap.TrackedEntity playerchunkmap_entitytracker; -@@ -1373,14 +1381,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1401,14 +1409,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider playerchunkmap_entitytracker.serverEntity.sendChanges(); } } @@ -1125,10 +1125,10 @@ index 6e5a25db47b0de69303060ad172eae7c9b8b0905..66416d761cc71b2d57acb840b781870d } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 2616debed901b2dd0bd5ad3ea26ffce2d92dc6c1..c79521ab00a1c258bbeae56a687636e34932ac6f 100644 +index 8509bf94f64c6b761ee38e39278d12fcedeeff75..5be81f72e01cf4f3d5f99b48b8c8a0d7df78f93b 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -526,13 +526,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -528,13 +528,15 @@ public class ServerChunkCache extends ChunkSource { } gameprofilerfiller.incrementCounter("getChunkCacheMiss"); @@ -1146,7 +1146,7 @@ index 2616debed901b2dd0bd5ad3ea26ffce2d92dc6c1..c79521ab00a1c258bbeae56a687636e3 ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; }, (playerchunk_failure) -> { -@@ -730,7 +732,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -732,7 +734,9 @@ public class ServerChunkCache extends ChunkSource { public void save(boolean flush) { this.runDistanceManagerUpdates(); @@ -1156,7 +1156,7 @@ index 2616debed901b2dd0bd5ad3ea26ffce2d92dc6c1..c79521ab00a1c258bbeae56a687636e3 } @Override -@@ -768,7 +772,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -770,7 +774,9 @@ public class ServerChunkCache extends ChunkSource { this.runDistanceManagerUpdates(); this.level.timings.doChunkMap.stopTiming(); // Spigot this.level.getProfiler().popPush("chunks"); @@ -1166,7 +1166,7 @@ index 2616debed901b2dd0bd5ad3ea26ffce2d92dc6c1..c79521ab00a1c258bbeae56a687636e3 this.level.timings.doChunkUnload.startTiming(); // Spigot this.level.getProfiler().popPush("unload"); this.chunkMap.tick(booleansupplier); -@@ -795,13 +801,16 @@ public class ServerChunkCache extends ChunkSource { +@@ -797,13 +803,16 @@ public class ServerChunkCache extends ChunkSource { boolean flag1 = level.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit gameprofilerfiller.push("naturalSpawnCount"); @@ -1183,7 +1183,7 @@ index 2616debed901b2dd0bd5ad3ea26ffce2d92dc6c1..c79521ab00a1c258bbeae56a687636e3 while (iterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) iterator.next(); -@@ -830,27 +839,27 @@ public class ServerChunkCache extends ChunkSource { +@@ -832,27 +841,27 @@ public class ServerChunkCache extends ChunkSource { } if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { @@ -1217,7 +1217,7 @@ index 2616debed901b2dd0bd5ad3ea26ffce2d92dc6c1..c79521ab00a1c258bbeae56a687636e3 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index d94dca6db38207021026953ef4598756a797562c..0486dc411f7cbda85c4e02fc85512a122522e035 100644 +index 8a6d3ea7fd43a6a25e904227f005a452956f7d9e..4dbac963fe8c006f75d47871a0545dd9b241b7eb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1,6 +1,8 @@ @@ -1315,7 +1315,7 @@ index d94dca6db38207021026953ef4598756a797562c..0486dc411f7cbda85c4e02fc85512a12 @@ -935,6 +950,7 @@ public class ServerLevel extends Level implements WorldGenLevel { - if (!flag1) { + if (!savingDisabled) { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit + try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper if (progressListener != null) { @@ -1412,10 +1412,10 @@ index 966291f62b8a57be28f47d6e5643bbcda57827c6..6ea948d9a7e20a389f445836f8ab4098 public UserWhiteList getWhiteList() { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 05de8dd72834c689af47628155af2f9b0084273f..bab72d3d0395fc6a137975982799341626626bc0 100644 +index 97a154a106c7084e2a70d39e8b4c336db8cd51c6..85e96c00f4574a5b98c20634f21372d8829d9fdb 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -126,7 +126,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; +@@ -125,7 +125,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Vehicle; @@ -1423,7 +1423,7 @@ index 05de8dd72834c689af47628155af2f9b0084273f..bab72d3d0395fc6a1379759827993416 import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -@@ -286,7 +285,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -285,7 +284,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public boolean forceExplosionKnockback; // SPIGOT-949 public boolean persistentInvisibility = false; @@ -1504,7 +1504,7 @@ index e688949fc2f3031dc9c9817bc59554e9f5a436af..20cfdba68c200e87d00995a6a4e25a5f } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 010d7a0dc97c7bdd3fbafe974aa73f3dba106d4d..906c23068d1f5be76a6985b7255f6f155335b673 100644 +index e9e97cf0b202c84252fb3bada97890198fcc6bb9..2a65e7ae49f2fc1d56cdace60f72b729c1d9b28c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -137,7 +137,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; @@ -1582,7 +1582,7 @@ index 010d7a0dc97c7bdd3fbafe974aa73f3dba106d4d..906c23068d1f5be76a6985b7255f6f15 if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { this.hurt(DamageSource.DROWN, 1.0F); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 8427d08ca3b61cce9d7bbdfdcf5946e1f459a21f..2bee54c8008e9c5a353b971c40d0a11722cd5eff 100644 +index 9e6a02a05ea20c21aed26ed4bc92488627febd4c..f4561232aa390d1c40216f2d5599ecf8720e60c2 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -83,7 +83,6 @@ import org.bukkit.Bukkit; @@ -1649,7 +1649,7 @@ index c9e6cb9f5c3eae53140236e09768ff759e27ace0..5147f67c87ba3b8912a8ae24f876a9e9 private String descriptionId; @Nullable diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 927133867393fc805b44e824f7b78fac372b0b25..e1cbecc402bfc14fb9e36d5c449cd404f119752d 100644 +index 23f0a89b01d02a5757a90f0232cafa8e1cd7cf85..53830d4f51365973092194ab38344ad13e84470a 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -22,10 +22,12 @@ import org.bukkit.inventory.InventoryHolder; @@ -1667,10 +1667,10 @@ index 927133867393fc805b44e824f7b78fac372b0b25..e1cbecc402bfc14fb9e36d5c449cd404 private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 4ed85501fc81de7a2262a8061ba8a38828a86817..8278f85964b8a7c954a5d4746795b6870ca3cea1 100644 +index a26306c6077da40c719c2ef2e17f00c230c886d1..bd0d36822cbfb4005d280f8721b6ba0aafa370b4 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -659,6 +659,7 @@ public class LevelChunk extends ChunkAccess { +@@ -660,6 +660,7 @@ public class LevelChunk extends ChunkAccess { server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration)); if (this.needsDecoration) { @@ -1678,7 +1678,7 @@ index 4ed85501fc81de7a2262a8061ba8a38828a86817..8278f85964b8a7c954a5d4746795b687 this.needsDecoration = false; java.util.Random random = new java.util.Random(); random.setSeed(this.level.getSeed()); -@@ -678,6 +679,7 @@ public class LevelChunk extends ChunkAccess { +@@ -679,6 +680,7 @@ public class LevelChunk extends ChunkAccess { } } server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk)); @@ -1687,7 +1687,7 @@ index 4ed85501fc81de7a2262a8061ba8a38828a86817..8278f85964b8a7c954a5d4746795b687 } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 3deb0b089ac9f803b728cdc5fbfb28542a2dc1c4..2fd969d1450d1251c139f3721d146fd2e191c4dd 100644 +index e7f17f682346e083dab4944cc014b39f9d3a98de..d3051e8bdec40cc00326c6ab4ab08e56065c1f56 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -481,13 +481,10 @@ public class ChunkSerializer { @@ -2114,7 +2114,7 @@ index e52ef47b783785dc214746b678e7b549aea9a274..3d90b3426873a3528af14f7f1ab0adae this.value = value; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index af1f7591e99b1aac95bcfabbe20447c1b5ad3adf..bad8455d5128b3b2e188143c704964bdf8e445dd 100644 +index 11385b98a7197a3912b94ca12129e61aa0736571..a527c2bc1314d05309be8f63f4696b373d3cee20 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -173,6 +173,12 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index e93bf74e6a..8e4b448759 100644 --- a/patches/server/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/0016-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -19,10 +19,10 @@ index 5896b4e4646d722db5622a424fa26f42d3f8d9ff..0a6e98ca5534430540044a32c280e568 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index bab72d3d0395fc6a137975982799341626626bc0..969017958ff8ea6d8efba261ce1fe6e5c3a3f518 100644 +index 85e96c00f4574a5b98c20634f21372d8829d9fdb..d5bc0d74a015b8f066516be40eefc275b1b88f81 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1299,6 +1299,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1253,6 +1253,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return this.isInWater() || this.isInRain(); } diff --git a/patches/server/0024-Remove-invalid-mob-spawner-tile-entities.patch b/patches/server/0024-Remove-invalid-mob-spawner-tile-entities.patch index f37d7e0891..00dc0b69a4 100644 --- a/patches/server/0024-Remove-invalid-mob-spawner-tile-entities.patch +++ b/patches/server/0024-Remove-invalid-mob-spawner-tile-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove invalid mob spawner tile entities diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 8278f85964b8a7c954a5d4746795b6870ca3cea1..3e4ece7b607d06c9d88322ce79f4888e1cc07aee 100644 +index bd0d36822cbfb4005d280f8721b6ba0aafa370b4..fc6324aae881358dbf74caa70cd84ca5f566c701 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -541,6 +541,11 @@ public class LevelChunk extends ChunkAccess { +@@ -542,6 +542,11 @@ public class LevelChunk extends ChunkAccess { } // CraftBukkit start diff --git a/patches/server/0027-Entity-Origin-API.patch b/patches/server/0027-Entity-Origin-API.patch index ea67886bdc..14051de95e 100644 --- a/patches/server/0027-Entity-Origin-API.patch +++ b/patches/server/0027-Entity-Origin-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0486dc411f7cbda85c4e02fc85512a122522e035..057285ca421dc7e9a0c6449238409eaf42235ef5 100644 +index 4dbac963fe8c006f75d47871a0545dd9b241b7eb..ae5e64778e2acc4bf0c5156cf8d4bd010a7fe1e6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1980,6 +1980,15 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1983,6 +1983,15 @@ public class ServerLevel extends Level implements WorldGenLevel { } entity.valid = true; // CraftBukkit @@ -25,10 +25,10 @@ index 0486dc411f7cbda85c4e02fc85512a122522e035..057285ca421dc7e9a0c6449238409eaf public void onTrackingEnd(Entity entity) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 969017958ff8ea6d8efba261ce1fe6e5c3a3f518..ff233d417d3f4f8fa4fa9ae9e77de7640102a172 100644 +index d5bc0d74a015b8f066516be40eefc275b1b88f81..de3bd691197eb61d0f9a999da6a0154ad4ad8714 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -285,6 +285,27 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -284,6 +284,27 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public boolean forceExplosionKnockback; // SPIGOT-949 public boolean persistentInvisibility = false; @@ -56,7 +56,7 @@ index 969017958ff8ea6d8efba261ce1fe6e5c3a3f518..ff233d417d3f4f8fa4fa9ae9e77de764 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -1847,6 +1868,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1801,6 +1822,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.bukkitEntity.storeBukkitValues(nbt); } // CraftBukkit end @@ -72,7 +72,7 @@ index 969017958ff8ea6d8efba261ce1fe6e5c3a3f518..ff233d417d3f4f8fa4fa9ae9e77de764 return nbt; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); -@@ -1973,6 +2003,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1927,6 +1957,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } // CraftBukkit end diff --git a/patches/server/0028-Prevent-tile-entity-and-entity-crashes.patch b/patches/server/0028-Prevent-tile-entity-and-entity-crashes.patch index decf1c68a3..78cdae51d2 100644 --- a/patches/server/0028-Prevent-tile-entity-and-entity-crashes.patch +++ b/patches/server/0028-Prevent-tile-entity-and-entity-crashes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent tile entity and entity crashes diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 0fa0bd695cc6d71eaba1565a408a2a0c257c3838..f5dd0965b8194aa6e6b82ac22238f7c78690110e 100644 +index 03c667b08db332f33b6da4e386c22d1a69c4f9a7..8a2d18524e089cdc07125e424b37f1b629e591a6 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -738,11 +738,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -26,7 +26,7 @@ index 0fa0bd695cc6d71eaba1565a408a2a0c257c3838..f5dd0965b8194aa6e6b82ac22238f7c7 } diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index e1cbecc402bfc14fb9e36d5c449cd404f119752d..52b4c231faa2f33f766f50399e52e30184fb01a7 100644 +index 53830d4f51365973092194ab38344ad13e84470a..a1bfe449cc2a9155ac1b8e68882e630cd75b1555 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -233,7 +233,12 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { @@ -44,10 +44,10 @@ index e1cbecc402bfc14fb9e36d5c449cd404f119752d..52b4c231faa2f33f766f50399e52e301 } } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 3e4ece7b607d06c9d88322ce79f4888e1cc07aee..cadcafec7dc8af1e938b20d07bd9a24acd350ab1 100644 +index fc6324aae881358dbf74caa70cd84ca5f566c701..5c77901cb6f3c9096b16f061a75341c2c9d466a9 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -1029,11 +1029,11 @@ public class LevelChunk extends ChunkAccess { +@@ -1030,11 +1030,11 @@ public class LevelChunk extends ChunkAccess { gameprofilerfiller.pop(); } catch (Throwable throwable) { diff --git a/patches/server/0053-Add-configurable-portal-search-radius.patch b/patches/server/0053-Add-configurable-portal-search-radius.patch index ad42837010..4229c1ced4 100644 --- a/patches/server/0053-Add-configurable-portal-search-radius.patch +++ b/patches/server/0053-Add-configurable-portal-search-radius.patch @@ -23,10 +23,10 @@ index 1e3c39f0eeeb07f8d49e3651b18a152db9ccba7b..c248b66486044150c64eaddbef85fa66 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6bc8c8e15e66cd54cbb6ebc6d09a6fe8652b5d18..8161cbd3cfed89bee74209c718d0ceff2b401890 100644 +index c061489a3178efc99292e6865adf260d1bad351c..7347438a3c8feeb1caaf6c8a8a20b6b94d21c0b8 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2939,7 +2939,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2895,7 +2895,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i double d0 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType()); BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0); // CraftBukkit start @@ -42,15 +42,15 @@ index 6bc8c8e15e66cd54cbb6ebc6d09a6fe8652b5d18..8161cbd3cfed89bee74209c718d0ceff return null; } diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -index 194465751c351a921100e621a0ef1616c7e5f3fb..80811386c1006d56824ff4d43830f2a140aaee30 100644 +index 2f9ce2a5d187bbaf55f2599998aad357dac72ecc..05150fbade1d5a9b3b6de8ad1f5e825f34d1037e 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java @@ -43,7 +43,7 @@ public class PortalForcer { - public Optional findPortalAround(BlockPos blockposition, boolean destIsNether, WorldBorder worldborder) { + public Optional findPortalAround(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) { // CraftBukkit start -- return this.findPortalAround(blockposition, worldborder, destIsNether ? 16 : 128); // Search Radius -+ return this.findPortalAround(blockposition, worldborder, destIsNether ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Search Radius // Paper - search Radius +- return this.findPortalAround(pos, worldBorder, destIsNether ? 16 : 128); // Search Radius ++ return this.findPortalAround(pos, worldBorder, destIsNether ? level.paperConfig.portalCreateRadius : level.paperConfig.portalSearchRadius); // Search Radius // Paper - search Radius } public Optional findPortalAround(BlockPos blockposition, WorldBorder worldborder, int i) { diff --git a/patches/server/0056-Add-exception-reporting-event.patch b/patches/server/0056-Add-exception-reporting-event.patch index 5f73823ca9..f37d1d7fb3 100644 --- a/patches/server/0056-Add-exception-reporting-event.patch +++ b/patches/server/0056-Add-exception-reporting-event.patch @@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8 + } +} diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 66416d761cc71b2d57acb840b781870dc3180c46..cb0ba135e766783a00b37c5b72f1cc1ed23ce07a 100644 +index 032bd9e952c0336f643dda514f265e78c491c8e2..713be7a4bee692d346a1f94cd891030be53260a5 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -924,6 +924,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -952,6 +952,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return true; } catch (Exception exception) { ChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception); @@ -108,7 +108,7 @@ index 4cde8d630a0951f297622af4ef781f5b3fabf9af..7044d8c71e85551e11bf2d96b767e088 } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index db226fe9515e904b8520a063b6dcde62b315a9b1..4060b72729609f66e5ad7b14f4aafa3c6a79a0e1 100644 +index 50a2fdc1f51fe6ca5a62d17e36ed88ecf7d20473..c68ababd68a8c49be6dbef275b94f3f90320e10a 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -1,5 +1,10 @@ @@ -151,7 +151,7 @@ index 81b61b6cc1e99328d4d339ca32895d1268c88ca7..28a7c53d98450cc79bee953411a18f50 } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index cadcafec7dc8af1e938b20d07bd9a24acd350ab1..ac17877ea6e210acfb54961a2818ca1ae7f6c738 100644 +index 5c77901cb6f3c9096b16f061a75341c2c9d466a9..3bfc47869ad378ae2c1e506fd6af479353689507 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -1,6 +1,7 @@ @@ -162,7 +162,7 @@ index cadcafec7dc8af1e938b20d07bd9a24acd350ab1..ac17877ea6e210acfb54961a2818ca1a import com.google.common.collect.Maps; import com.google.common.collect.UnmodifiableIterator; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -@@ -547,10 +548,15 @@ public class LevelChunk extends ChunkAccess { +@@ -548,10 +549,15 @@ public class LevelChunk extends ChunkAccess { this.removeBlockEntity(blockEntity.getBlockPos()); // Paper end } else { @@ -182,7 +182,7 @@ index cadcafec7dc8af1e938b20d07bd9a24acd350ab1..ac17877ea6e210acfb54961a2818ca1a // CraftBukkit end } } -@@ -1032,6 +1038,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1033,6 +1039,7 @@ public class LevelChunk extends ChunkAccess { // Paper start - Prevent tile entity and entity crashes final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); @@ -191,7 +191,7 @@ index cadcafec7dc8af1e938b20d07bd9a24acd350ab1..ac17877ea6e210acfb54961a2818ca1a // Paper end // Spigot start diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index c87faa811ec3eafa206d74c89927259d382fb492..9f3223947d2fcc1aaf259effe6afce7a47888858 100644 +index c30d7b04e8383aed7d5f3e93f42c612c685a4df7..fd70133714990ad44b4b2b80c52ffc55be8c9b63 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -274,6 +274,7 @@ public class RegionFile implements AutoCloseable { @@ -211,7 +211,7 @@ index c87faa811ec3eafa206d74c89927259d382fb492..9f3223947d2fcc1aaf259effe6afce7a try { filechannel.close(); diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -index 2fdb313e8eaed868c36f68c9b7f6a6f9f4864575..c8ed0673ff819cb88d0ee6f53f2a2b9b46b203d4 100644 +index 68b1a5b6b27f70b0185bb8f0ed924d6d21b43323..e84b99ca10621cb1021d7ec17ba21df24e8c7474 100644 --- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java @@ -120,6 +120,7 @@ public class DimensionDataStorage { diff --git a/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch index 3b76c6ee8a..dee886bba2 100644 --- a/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/0058-Disable-Scoreboards-for-non-players-by-default.patch @@ -25,10 +25,10 @@ index ada624b5f58381122e59568c2087cf38fd2baf3e..5b55fce59db9ac3ab6030ebe8374c514 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8161cbd3cfed89bee74209c718d0ceff2b401890..a957a168450ee5c34a58ed993f281ca774fccfc1 100644 +index 7347438a3c8feeb1caaf6c8a8a20b6b94d21c0b8..ddbbef22813831267c407d9864ce8decb5706df5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2588,6 +2588,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2542,6 +2542,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i @Nullable public Team getTeam() { @@ -37,7 +37,7 @@ index 8161cbd3cfed89bee74209c718d0ceff2b401890..a957a168450ee5c34a58ed993f281ca7 } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index deef28110441cd2965c6b531bc255ee2aa994ace..60356e889f2da17b313ee5cf223ee0c5066182c4 100644 +index 181711ccb45ffaefddc846c374d5704696c31845..09cea6b92aa8a0b60716163b7bda61823268bed7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -798,6 +798,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0065-Handle-Item-Meta-Inconsistencies.patch b/patches/server/0065-Handle-Item-Meta-Inconsistencies.patch index f02a4ad354..34a545a702 100644 --- a/patches/server/0065-Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/0065-Handle-Item-Meta-Inconsistencies.patch @@ -18,7 +18,7 @@ For consistency, the old API methods now forward to use the ItemMeta API equivalents, and should deprecate the old API's. diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index df787c12053f799b111c539d866ff8c751e21611..4019a8cd594f8c093cf790600a92f0725250e82b 100644 +index 566f1b8a0acd679b2f776db2e80458b1c532f97e..c39d3f15ebc8956714f963ce7ed11e0f2b2bad4f 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -13,6 +13,8 @@ import java.text.DecimalFormatSymbols; @@ -30,7 +30,7 @@ index df787c12053f799b111c539d866ff8c751e21611..4019a8cd594f8c093cf790600a92f072 import java.util.Locale; import java.util.Map.Entry; import java.util.Optional; -@@ -151,6 +153,23 @@ public final class ItemStack { +@@ -152,6 +154,23 @@ public final class ItemStack { return this.getItem().getTooltipImage(this); } @@ -54,7 +54,7 @@ index df787c12053f799b111c539d866ff8c751e21611..4019a8cd594f8c093cf790600a92f072 public ItemStack(ItemLike item) { this(item, 1); } -@@ -194,9 +213,11 @@ public final class ItemStack { +@@ -195,9 +214,11 @@ public final class ItemStack { // CraftBukkit start - make defensive copy as this data may be coming from the save thread this.tag = nbttagcompound.getCompound("tag").copy(); // CraftBukkit end @@ -66,7 +66,7 @@ index df787c12053f799b111c539d866ff8c751e21611..4019a8cd594f8c093cf790600a92f072 if (this.getItem().canBeDepleted()) { this.setDamageValue(this.getDamageValue()); } -@@ -1055,6 +1076,7 @@ public final class ItemStack { +@@ -1056,6 +1077,7 @@ public final class ItemStack { ListTag nbttaglist = this.tag.getList("Enchantments", 10); nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level)); diff --git a/patches/server/0068-Custom-replacement-for-eaten-items.patch b/patches/server/0068-Custom-replacement-for-eaten-items.patch index 71ba9205fd..251d098ea9 100644 --- a/patches/server/0068-Custom-replacement-for-eaten-items.patch +++ b/patches/server/0068-Custom-replacement-for-eaten-items.patch @@ -5,25 +5,25 @@ Subject: [PATCH] Custom replacement for eaten items diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 60356e889f2da17b313ee5cf223ee0c5066182c4..c8e60153986e9be21a1e372d5c1cb25c762ab81b 100644 +index 09cea6b92aa8a0b60716163b7bda61823268bed7..76da306041b61f6c93e6f58f580054af7dfc234e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3563,9 +3563,10 @@ public abstract class LivingEntity extends Entity { - this.triggerItemUseEffects(this.useItem, 16); - // CraftBukkit start - fire PlayerItemConsumeEvent - ItemStack itemstack; +@@ -3564,9 +3564,10 @@ public abstract class LivingEntity extends Entity { + this.triggerItemUseEffects(this.useItem, 16); + // CraftBukkit start - fire PlayerItemConsumeEvent + ItemStack itemstack; + PlayerItemConsumeEvent event = null; // Paper - if (this instanceof ServerPlayer) { - org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem); -- PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem); + if (this instanceof ServerPlayer) { + org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem); +- PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem); + event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem); // Paper - level.getCraftServer().getPluginManager().callEvent(event); + level.getCraftServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { -@@ -3579,6 +3580,13 @@ public abstract class LivingEntity extends Entity { - } else { - itemstack = this.useItem.finishUsingItem(this.level, this); - } + if (event.isCancelled()) { +@@ -3580,6 +3581,13 @@ public abstract class LivingEntity extends Entity { + } else { + itemstack = this.useItem.finishUsingItem(this.level, this); + } + + // Paper start - save the default replacement item and change it if necessary + final ItemStack defaultReplacement = itemstack; @@ -31,18 +31,18 @@ index 60356e889f2da17b313ee5cf223ee0c5066182c4..c8e60153986e9be21a1e372d5c1cb25c + itemstack = CraftItemStack.asNMSCopy(event.getReplacement()); + } + // Paper end - // CraftBukkit end + // CraftBukkit end - if (itemstack != this.useItem) { -@@ -3586,6 +3594,11 @@ public abstract class LivingEntity extends Entity { - } + if (itemstack != this.useItem) { +@@ -3587,6 +3595,11 @@ public abstract class LivingEntity extends Entity { + } - this.stopUsingItem(); + this.stopUsingItem(); + // Paper start - if the replacement is anything but the default, update the client inventory + if (this instanceof ServerPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) { + ((ServerPlayer) this).getBukkitEntity().updateInventory(); + } + // Paper end - } + } - } + } diff --git a/patches/server/0070-Use-a-Shared-Random-for-Entities.patch b/patches/server/0070-Use-a-Shared-Random-for-Entities.patch index f85b5478bd..618da6448d 100644 --- a/patches/server/0070-Use-a-Shared-Random-for-Entities.patch +++ b/patches/server/0070-Use-a-Shared-Random-for-Entities.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use a Shared Random for Entities Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a957a168450ee5c34a58ed993f281ca774fccfc1..30d30c2fd66b312a45d3bf706d41b38724d52a7b 100644 +index ddbbef22813831267c407d9864ce8decb5706df5..664d7199e21f0c617ba41bc7596ead99a0325792 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -153,6 +153,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -152,6 +152,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } @@ -31,7 +31,7 @@ index a957a168450ee5c34a58ed993f281ca774fccfc1..30d30c2fd66b312a45d3bf706d41b387 private CraftEntity bukkitEntity; public CraftEntity getBukkitEntity() { -@@ -334,7 +349,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -333,7 +348,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i this.bb = Entity.INITIAL_AABB; this.stuckSpeedMultiplier = Vec3.ZERO; this.nextStep = 1.0F; diff --git a/patches/server/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/patches/server/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 69075c2129..c5924d32d5 100644 --- a/patches/server/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/patches/server/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -33,7 +33,7 @@ index 543d5a67e76a3114f6eac29a053ff04ceecb6256..c33bac27edfdab4c3ee618c9ed39c629 this.x = x; this.y = y; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 507d38a8e7b643712fe235c73f440c0a52b6d8b2..b6f2be487720e31a548a3cee4cd73319f402f6ff 100644 +index de1bb9ecb8891b66b2c469f2ee52b9eee9d7ddea..7ee958e6a4f16780aa746ce0eb8cb8ee27df08e1 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -263,7 +263,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -46,10 +46,10 @@ index 507d38a8e7b643712fe235c73f440c0a52b6d8b2..b6f2be487720e31a548a3cee4cd73319 public static boolean isInSpawnableBounds(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 2e5619a581d18008df31f4b2a279e7418264aa4f..7bec92f343d5c79fdff43b36272c0e979c6879d4 100644 +index 7cceac53e445fe199f59a619a69a96ef97ae50b5..04b58d6aec04cc98777f88c2bcc9a820c5fd2f57 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -113,6 +113,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -114,6 +114,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom return GameEventDispatcher.NOOP; } @@ -74,7 +74,7 @@ index 31d01f8df394e718f1f2a268ddccee77b6706eb9..25e9cc39d748dfd99d38f504c14f40f9 public BlockState getBlockState(BlockPos pos) { return Blocks.VOID_AIR.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index 65967fd834d8aadf9a6af3ee26164819488dc680..de235aadb3aebcd173fea7ea4783c1e8aa8f4c6a 100644 +index ef74f37cae96e61d5648fce7bbd793fb67ba9e4a..7c5b3acd299c5b021bd20f17ff0b89c8208a6623 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java @@ -46,6 +46,11 @@ public class ImposterProtoChunk extends ProtoChunk { @@ -90,7 +90,7 @@ index 65967fd834d8aadf9a6af3ee26164819488dc680..de235aadb3aebcd173fea7ea4783c1e8 @Override public FluidState getFluidState(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index ac17877ea6e210acfb54961a2818ca1ae7f6c738..6e998ca50d07e1ecb0cd0639b81cc07e8be71cb8 100644 +index 3bfc47869ad378ae2c1e506fd6af479353689507..e305f2839b1bea2a3c1938542c1157b0179aa4bc 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -287,12 +287,28 @@ public class LevelChunk extends ChunkAccess { @@ -126,7 +126,7 @@ index ac17877ea6e210acfb54961a2818ca1ae7f6c738..6e998ca50d07e1ecb0cd0639b81cc07e BlockState iblockdata = null; diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index 10848c41b7f2f83717df650bd1fac7149c3a32af..92a42aea3f54c49e2055e8000645d91da9471e09 100644 +index 6abd3cf0a388b158252628d8031b92bb8a6d65fb..50b6ecfea7a342be0d21e37ae87777a4b4860026 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java @@ -20,7 +20,7 @@ public class LevelChunkSection { diff --git a/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch index eabfd7d532..ae18b6c2b3 100644 --- a/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0074-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index bd53d00db453767fb43ba0e50c0dc0a7730d55a4..9582da4afcc68b3c898be86dcf74f0833258e34c 100644 +index afaaff4f49f083c1071d082856181e3d815ea227..8c5133defa9d3166cf987a6f1d02f02f0515746d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1990,6 +1990,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1993,6 +1993,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); } // Paper end @@ -16,7 +16,7 @@ index bd53d00db453767fb43ba0e50c0dc0a7730d55a4..9582da4afcc68b3c898be86dcf74f083 } public void onTrackingEnd(Entity entity) { -@@ -2054,6 +2055,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2057,6 +2058,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } entity.valid = false; // CraftBukkit diff --git a/patches/server/0090-remove-null-possibility-for-getServer-singleton.patch b/patches/server/0090-remove-null-possibility-for-getServer-singleton.patch index 1d724523f6..1929f73392 100644 --- a/patches/server/0090-remove-null-possibility-for-getServer-singleton.patch +++ b/patches/server/0090-remove-null-possibility-for-getServer-singleton.patch @@ -6,7 +6,7 @@ Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d2941bb9bfb0517a05942714015bdf72da0a775d..9a58a678b07bb45ee0e608fdd662b13fcc04d31c 100644 +index 0bbefc2643f7db64389c4e1ee3419abcc967ee98..fecc9f721f3fb136212f6e8ed7e3e11e8eda8323 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -185,6 +185,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot @@ -25,7 +25,7 @@ index d2941bb9bfb0517a05942714015bdf72da0a775d..9a58a678b07bb45ee0e608fdd662b13f this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; this.profiler = this.metricsRecorder.getProfiler(); this.onMetricsRecordingStopped = (methodprofilerresults) -> { -@@ -2255,7 +2257,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { - } +@@ -68,14 +68,7 @@ public abstract class Property> { + @Override public boolean equals(Object object) { - if (this == object) { - return true; - } else if (!(object instanceof Property)) { - return false; - } else { -- Property iblockstate = (Property) object; -- -- return this.clazz.equals(iblockstate.clazz) && this.name.equals(iblockstate.name); +- Property property = (Property)object; +- return this.clazz.equals(property.clazz) && this.name.equals(property.name); - } + return this == object; // Paper } - public final int hashCode() { + @Override diff --git a/patches/server/0108-Option-to-remove-corrupt-tile-entities.patch b/patches/server/0108-Option-to-remove-corrupt-tile-entities.patch index b0c5a4bac5..4951088e11 100644 --- a/patches/server/0108-Option-to-remove-corrupt-tile-entities.patch +++ b/patches/server/0108-Option-to-remove-corrupt-tile-entities.patch @@ -19,7 +19,7 @@ index d7734fbc6b684b14bc32c94e65947fb41aae126a..80345730b8ccc11d3d0833485d25b03f + } } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index e641779c58b503c88cb533a45a3614f45c4b8fa3..805101792508bd721dd38fb57514f7f21bd90504 100644 +index 5ff0475c08fe3e1a48358ddbf112345a985caad7..2cc323734a49d82104046f4f02eb224458c151b4 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -261,7 +261,7 @@ public class LevelChunk extends ChunkAccess { @@ -31,7 +31,7 @@ index e641779c58b503c88cb533a45a3614f45c4b8fa3..805101792508bd721dd38fb57514f7f2 this.needsDecoration = true; // CraftBukkit } -@@ -579,6 +579,12 @@ public class LevelChunk extends ChunkAccess { +@@ -580,6 +580,12 @@ public class LevelChunk extends ChunkAccess { "Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16)); e.printStackTrace(); ServerInternalException.reportInternalException(e); diff --git a/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch b/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch index 6696afa9ac..0e66af94ae 100644 --- a/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch +++ b/patches/server/0118-Bound-Treasure-Maps-to-World-Border.patch @@ -34,14 +34,14 @@ index 6ec5a1525d0b8ced8fe78d3eab29c5eb82996844..2442c287a7f26cfee10a19e9015558cd return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ(); } diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java -index 3ff9f40df7f4f837a59362c6da6a172f42d6e8bc..0670c1f72d9d0c4f8ea32ed314f75a106b2e2b09 100644 +index cea24d53d94973218d947ece41be722f1ee79b7e..461464a4208bbb09800d87bcdb54978758863c7b 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java @@ -168,6 +168,7 @@ public class StructureFeature { int o = j + i * m; int p = k + i * n; ChunkPos chunkPos = this.getPotentialFeatureChunk(config, worldSeed, o, p); -+ if (!levelReader.getWorldBorder().isChunkInBounds(chunkPos.x, chunkPos.z)) { continue; } // Paper ++ if (!world.getWorldBorder().isChunkInBounds(chunkPos.x, chunkPos.z)) { continue; } // Paper StructureCheckResult structureCheckResult = structureAccessor.checkStructurePresence(chunkPos, this, skipExistingChunks); if (structureCheckResult != StructureCheckResult.START_NOT_PRESENT) { if (!skipExistingChunks && structureCheckResult == StructureCheckResult.START_PRESENT) { diff --git a/patches/server/0120-Optimize-ItemStack.isEmpty.patch b/patches/server/0120-Optimize-ItemStack.isEmpty.patch index 67358807f2..d37b4953c1 100644 --- a/patches/server/0120-Optimize-ItemStack.isEmpty.patch +++ b/patches/server/0120-Optimize-ItemStack.isEmpty.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize ItemStack.isEmpty() Remove hashMap lookup every check, simplify code to remove ternary diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 4019a8cd594f8c093cf790600a92f0725250e82b..6c82bb01db0431080425bfa65ab67ce703194214 100644 +index c39d3f15ebc8956714f963ce7ed11e0f2b2bad4f..033f7486556f5928d902dd25cd3d5a38e0e8097e 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -240,7 +240,7 @@ public final class ItemStack { +@@ -241,7 +241,7 @@ public final class ItemStack { } public boolean isEmpty() { diff --git a/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch index 73520a3d4c..c55eb9edf8 100644 --- a/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch +++ b/patches/server/0128-Don-t-allow-entities-to-ride-themselves-572.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4b23eaa6bcd7fd3eddbe7512bae4270c6324242b..819fbb2e786cc4546a981b34ff55a6241c72b5a3 100644 +index 1dba6be93f1078b71712d0b5a24224bdcaeb61a0..0041783c4cc05ce2730f15b4c8c58ff6f1a94f57 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2283,6 +2283,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2237,6 +2237,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } protected boolean addPassenger(Entity entity) { // CraftBukkit diff --git a/patches/server/0130-Cap-Entity-Collisions.patch b/patches/server/0130-Cap-Entity-Collisions.patch index 146a41a358..f69bcd95ff 100644 --- a/patches/server/0130-Cap-Entity-Collisions.patch +++ b/patches/server/0130-Cap-Entity-Collisions.patch @@ -27,10 +27,10 @@ index f383f30b9dd1a7c6cf69d342f99118beec70b206..7cd6a36e000d9e1958d260739e6fcfb0 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 819fbb2e786cc4546a981b34ff55a6241c72b5a3..4f1add992cef7bfa194a9e464ae9ea56eab1f191 100644 +index 0041783c4cc05ce2730f15b4c8c58ff6f1a94f57..a1ca58317ed0c6a395503d00cff332b092c4d549 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -326,6 +326,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -325,6 +325,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -39,7 +39,7 @@ index 819fbb2e786cc4546a981b34ff55a6241c72b5a3..4f1add992cef7bfa194a9e464ae9ea56 // Spigot end diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a11ee8a247affeb97de4c3152ea1449e8bc5b223..77b96f632342026fcd2c37e34e63db3e11396c34 100644 +index 36aef3dbfe407ca6fa206bc3fc4390e5c2770aa3..e0fe53045da81fc9b2eac3b215d641cf0c722895 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3227,8 +3227,11 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0136-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0136-Use-TerminalConsoleAppender-for-console-improvements.patch index 7e25157a7a..94eece50bf 100644 --- a/patches/server/0136-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0136-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -112,7 +112,7 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 450e7165bd4806a4ed39a1b25486b408cc760460..543acb52698deb890a2624112e63be275a52c008 100644 +index 6d57327ca2450352a0ff153da00cc1d3b3ac1aca..ad857dc0929bdc11a4be58e1bc2fa6be95eea4c3 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -9,6 +9,7 @@ import com.mojang.authlib.GameProfile; @@ -169,7 +169,7 @@ index 450e7165bd4806a4ed39a1b25486b408cc760460..543acb52698deb890a2624112e63be27 } catch (Exception ignored) { } // CraftBukkit end -@@ -1559,7 +1564,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange; chunkRange = (chunkRange > 8) ? 8 : chunkRange; @@ -23,7 +23,7 @@ index cb0ba135e766783a00b37c5b72f1cc1ed23ce07a..a268ea70d084465bf2ba0550083a1365 // Spigot end long i = chunkcoordintpair.toLong(); -@@ -1094,6 +1096,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1122,6 +1124,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } entityplayer = (ServerPlayer) iterator.next(); @@ -40,10 +40,10 @@ index cb0ba135e766783a00b37c5b72f1cc1ed23ce07a..a268ea70d084465bf2ba0550083a1365 return true; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index c79521ab00a1c258bbeae56a687636e34932ac6f..212261651fd650cc895f817ccca37699d1cade8f 100644 +index 5be81f72e01cf4f3d5f99b48b8c8a0d7df78f93b..80ccd821d83b318d3758252ce4ed349bfa5acb69 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -825,6 +825,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -827,6 +827,15 @@ public class ServerChunkCache extends ChunkSource { boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit //Collections.shuffle(list); // Paper - no... just no... diff --git a/patches/server/0209-Make-shield-blocking-delay-configurable.patch b/patches/server/0209-Make-shield-blocking-delay-configurable.patch index f7c8480cf0..d27451e583 100644 --- a/patches/server/0209-Make-shield-blocking-delay-configurable.patch +++ b/patches/server/0209-Make-shield-blocking-delay-configurable.patch @@ -19,10 +19,10 @@ index d74c86f401c0161ac139f0dfd789d03bc616fe3b..97ad6c164281df845b3789e68287157c + } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5c9f9b6a1bd66d33fd194ad1d78a907b005a101c..4ca6feea7910d613ffcf4339d809f98f34e17ffb 100644 +index 1bc502eb058685f97d12a859fb8b189eabdf952f..e0d958b2e23e1128b09a27c32836aa3fd012c49d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3668,12 +3668,24 @@ public abstract class LivingEntity extends Entity { +@@ -3670,12 +3670,24 @@ public abstract class LivingEntity extends Entity { if (this.isUsingItem() && !this.useItem.isEmpty()) { Item item = this.useItem.getItem(); diff --git a/patches/server/0218-InventoryCloseEvent-Reason-API.patch b/patches/server/0218-InventoryCloseEvent-Reason-API.patch index 7d0d8cd05d..e5e51d8a0a 100644 --- a/patches/server/0218-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0218-InventoryCloseEvent-Reason-API.patch @@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a734416fd80f0b367300c179e90fb51e206ca36c..5d63b8843beaeb6f6d42d1c122c89ea57ed44e36 100644 +index c6111e041fa85a13fdc96595bff62775e4f54ddb..e497604cd97095abdad38331c29ed1cbd15bcc14 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1128,7 +1128,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -19,7 +19,7 @@ index a734416fd80f0b367300c179e90fb51e206ca36c..5d63b8843beaeb6f6d42d1c122c89ea5 } } } -@@ -2027,7 +2027,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2030,7 +2030,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) { for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { diff --git a/patches/server/0223-add-more-information-to-Entity.toString.patch b/patches/server/0223-add-more-information-to-Entity.toString.patch index 1ea48c0f04..e05bc0e21a 100644 --- a/patches/server/0223-add-more-information-to-Entity.toString.patch +++ b/patches/server/0223-add-more-information-to-Entity.toString.patch @@ -6,15 +6,15 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 31c502705ed3daef86df6e81215c0c7f9e8d22f8..9cf4f75f61179229e652ae56108626ba8c968121 100644 +index 6f6a2c6bd371b892dd0e7a9d4c79c462de8b1ffa..5df955eea09b5abd32c12abf5d13030bf9a3a9ae 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2852,7 +2852,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i - } - +@@ -2808,7 +2808,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public String toString() { -- return String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.level == null ? "~NULL~" : this.level.toString(), this.getX(), this.getY(), this.getZ()); -+ return String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b, rR=%s]", new Object[] { this.getClass().getSimpleName(), this.getName().getString(), Integer.valueOf(this.id), this.uuid.toString(), this.level == null ? "~NULL~" : this.level.toString(), Double.valueOf(this.getX()), Double.valueOf(this.getY()), Double.valueOf(this.getZ()), this.chunkPosition(), this.tickCount, this.valid, this.removalReason}); // Paper - add more information + String s = this.level == null ? "~NULL~" : this.level.toString(); + +- return this.removalReason != null ? String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f, removed=%s]", this.getClass().getSimpleName(), this.getName().getString(), this.id, s, this.getX(), this.getY(), this.getZ(), this.removalReason) : String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName().getString(), this.id, s, this.getX(), this.getY(), this.getZ()); ++ return this.removalReason != null ? String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b, removed=%s]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.uuid, s, this.getX(), this.getY(), this.getZ(), this.chunkPosition(), this.tickCount, this.valid, this.removalReason) : String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.uuid, s, this.getX(), this.getY(), this.getZ(), this.chunkPosition(), this.tickCount, this.valid); } public boolean isInvulnerableTo(DamageSource damageSource) { diff --git a/patches/server/0230-Vanished-players-don-t-have-rights.patch b/patches/server/0230-Vanished-players-don-t-have-rights.patch index 469aa182ba..6aac7a9842 100644 --- a/patches/server/0230-Vanished-players-don-t-have-rights.patch +++ b/patches/server/0230-Vanished-players-don-t-have-rights.patch @@ -24,10 +24,10 @@ index 3b2322e359ea0fa8cf6c256054c4d0dcd3f43d73..1382a16d21133b368158914509eb9ef3 return false; } diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java -index 5eb5dde9c2a6c7e54f91f66eb40c3ad9821c96cb..0269c264f6137ade22c9e3f89fc780f6a9632087 100644 +index c3fb7d41688855010c643b91c8d9496486dae089..8175bb6331727440da2232998bdad068a1c47ae8 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java -@@ -194,7 +194,8 @@ public class BlockItem extends Item { +@@ -195,7 +195,8 @@ public class BlockItem extends Item { Player entityhuman = context.getPlayer(); CollisionContext voxelshapecollision = entityhuman == null ? CollisionContext.empty() : CollisionContext.of(entityhuman); // CraftBukkit start - store default return @@ -38,7 +38,7 @@ index 5eb5dde9c2a6c7e54f91f66eb40c3ad9821c96cb..0269c264f6137ade22c9e3f89fc780f6 BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(context.getLevel(), context.getClickedPos()), player, CraftBlockData.fromData(state), defaultReturn); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 0e71e1cb15640d397b4da9a8cfef4fdf0a61ec51..44251a6aaaeb508e8b9ed50b6b51b3b78c67d833 100644 +index aba12f5a941fb07a2f4dd54af8f0a4310488ac78..aa8bbf6435c19013e3ccaa963118d71200b6efea 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -72,6 +72,10 @@ import net.minecraft.world.level.saveddata.maps.MapItemSavedData; diff --git a/patches/server/0241-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/0241-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 18b1f74bb0..ca34fcf329 100644 --- a/patches/server/0241-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/patches/server/0241-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -8,10 +8,10 @@ Add -Ddebug.entities=true to your JVM flags to gain more information 1.17: Needs to be reworked for new entity storage system diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a268ea70d084465bf2ba0550083a136540d88734..0727c025e87e889861b2f3e78e28d4d17840ff54 100644 +index 398f90cacfcf93f6abd395758f0188d785fd764d..e24f441cd1465389f02192796ab0b6605157cf15 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1319,6 +1319,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1347,6 +1347,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } else { ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas()); @@ -19,7 +19,7 @@ index a268ea70d084465bf2ba0550083a136540d88734..0727c025e87e889861b2f3e78e28d4d1 this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); playerchunkmap_entitytracker.updatePlayers(this.level.players()); if (entity instanceof ServerPlayer) { -@@ -1361,7 +1362,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1389,7 +1390,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (playerchunkmap_entitytracker1 != null) { playerchunkmap_entitytracker1.broadcastRemoved(); } @@ -29,7 +29,7 @@ index a268ea70d084465bf2ba0550083a136540d88734..0727c025e87e889861b2f3e78e28d4d1 protected void tick() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5d63b8843beaeb6f6d42d1c122c89ea57ed44e36..29b2ddee252759c7ad17df8fe19ea08a36eb2673 100644 +index e497604cd97095abdad38331c29ed1cbd15bcc14..8411c314b5a4a8131c8e96432f8b0f42b207277e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -206,6 +206,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -72,10 +72,10 @@ index 5d63b8843beaeb6f6d42d1c122c89ea57ed44e36..29b2ddee252759c7ad17df8fe19ea08a return false; } else { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9cf4f75f61179229e652ae56108626ba8c968121..752e4593bed746e663f018f85ae1ac43cd7b0795 100644 +index 5df955eea09b5abd32c12abf5d13030bf9a3a9ae..d442725c1c9ae274b11f3a11ea4cf15f51d62def 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -171,6 +171,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -170,6 +170,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper private CraftEntity bukkitEntity; @@ -85,7 +85,7 @@ index 9cf4f75f61179229e652ae56108626ba8c968121..752e4593bed746e663f018f85ae1ac43 if (this.bukkitEntity == null) { this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 44251a6aaaeb508e8b9ed50b6b51b3b78c67d833..0663aa74688104c551e8ef52b01947dacf95bb22 100644 +index aa8bbf6435c19013e3ccaa963118d71200b6efea..2cdf117a5041830f201d5f1e98f7cc8f9cb6dd6f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -142,6 +142,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0251-Optimize-CraftBlockData-Creation.patch b/patches/server/0251-Optimize-CraftBlockData-Creation.patch index 56299c2d0d..a7acf9bded 100644 --- a/patches/server/0251-Optimize-CraftBlockData-Creation.patch +++ b/patches/server/0251-Optimize-CraftBlockData-Creation.patch @@ -7,10 +7,10 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData and cloning it when one is needed. diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 7d06d476d8e12bdb395488e85e34231daccbd853..987a4180a1eb902c512c2e6a36d692cbdd9b1563 100644 +index a3f44e3a44b2ec21ef41f6d598b428448c847c5f..3c6b1b92fedf9986ebb835170c070ebd461f5d25 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -636,6 +636,14 @@ public abstract class BlockBehaviour { +@@ -678,6 +678,14 @@ public abstract class BlockBehaviour { this.hasPostProcess = blockbase_info.hasPostProcess; this.emissiveRendering = blockbase_info.emissiveRendering; } diff --git a/patches/server/0252-Optimize-MappedRegistry.patch b/patches/server/0252-Optimize-MappedRegistry.patch index 16ab57f49b..ad28f0dfd9 100644 --- a/patches/server/0252-Optimize-MappedRegistry.patch +++ b/patches/server/0252-Optimize-MappedRegistry.patch @@ -8,19 +8,21 @@ Use larger initial sizes to increase bucket capacity on the BiMap BiMap.get was seen to be using a good bit of CPU time. diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java -index 3b9eb0d19623a8a8e60f785edfd2faadba54ce84..0ae87b1ee3373a7eead633fa2a85d64f8d88bcaf 100644 +index 25a6d195c5d6ee456258d2167f8acc5eb717e187..76b0b8b03c1d1c548ff67cfd6e6b127764f951d9 100644 --- a/src/main/java/net/minecraft/core/MappedRegistry.java +++ b/src/main/java/net/minecraft/core/MappedRegistry.java -@@ -38,12 +38,10 @@ public class MappedRegistry extends WritableRegistry { +@@ -36,13 +36,11 @@ import org.apache.logging.log4j.Logger; + public class MappedRegistry extends WritableRegistry { protected static final Logger LOGGER = LogManager.getLogger(); - private final ObjectList byId = new ObjectArrayList(256); -- private final Object2IntMap toId = (Object2IntMap) Util.make(new Object2IntOpenCustomHashMap(Util.identityStrategy()), (object2intopencustomhashmap) -> { -- object2intopencustomhashmap.defaultReturnValue(-1); +- private final ObjectList byId = new ObjectArrayList<>(256); +- private final Object2IntMap toId = Util.make(new Object2IntOpenCustomHashMap<>(Util.identityStrategy()), (object2IntOpenCustomHashMap) -> { +- object2IntOpenCustomHashMap.defaultReturnValue(-1); - }); - private final BiMap storage = HashBiMap.create(); - private final BiMap, T> keyStorage = HashBiMap.create(); - private final Map lifecycles = Maps.newIdentityHashMap(); ++ private final ObjectList byId = new ObjectArrayList(256); + private final it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap toId = new it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap(2048);// Paper - use bigger expected size to reduce collisions and direct intent for FastUtil to be identity map + private final BiMap storage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions + private final BiMap, T> keyStorage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions @@ -28,7 +30,7 @@ index 3b9eb0d19623a8a8e60f785edfd2faadba54ce84..0ae87b1ee3373a7eead633fa2a85d64f private Lifecycle elementsLifecycle; @Nullable protected Object[] randomCache; -@@ -52,6 +50,7 @@ public class MappedRegistry extends WritableRegistry { +@@ -51,6 +49,7 @@ public class MappedRegistry extends WritableRegistry { public MappedRegistry(ResourceKey> key, Lifecycle lifecycle) { super(key, lifecycle); this.elementsLifecycle = lifecycle; diff --git a/patches/server/0257-Asynchronous-chunk-IO-and-loading.patch b/patches/server/0257-Asynchronous-chunk-IO-and-loading.patch index 4740a91106..7c982414ba 100644 --- a/patches/server/0257-Asynchronous-chunk-IO-and-loading.patch +++ b/patches/server/0257-Asynchronous-chunk-IO-and-loading.patch @@ -2291,7 +2291,7 @@ index 4ab820c43ddc79f5a280e2d4b322a667b9ba725f..e0c1e4e38ff49429a587c59afb86e95c DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataFixers.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, LoggerChunkProgressListener::new); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 44f32023db3edaae107f48fd9b96baf5432417d9..a9f54a691af0cd15cbc38af8b8df3831de244aa7 100644 +index 746d8eb657808bfaa92654c36093abd9b67a0288..3380aca80bdda5edf8809f6fe36eaf5ba40a68ae 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -984,7 +984,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return true; }); @@ -2336,9 +2336,9 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 + //this.flushWorker(); // Paper - nuke IOWorker + this.level.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour } else { - this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).forEach((playerchunk) -> { - ChunkAccess ichunkaccess = (ChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error -@@ -546,17 +548,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + this.visibleChunkMap.values().forEach(this::saveChunkIfNeeded); + } +@@ -539,17 +541,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider protected void tick(BooleanSupplier shouldKeepTicking) { ProfilerFiller gameprofilerfiller = this.level.getProfiler(); @@ -2361,7 +2361,7 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 private void processUnloads(BooleanSupplier shouldKeepTicking) { LongIterator longiterator = this.toDrop.iterator(); -@@ -573,12 +579,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -566,12 +572,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (playerchunk != null) { this.pendingUnloads.put(j, playerchunk); this.modified = true; @@ -2376,7 +2376,7 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 } } activityAccountant.endActivity(); // Spigot -@@ -613,7 +620,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -615,7 +622,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ((LevelChunk) ichunkaccess).setLoaded(false); } @@ -2394,7 +2394,7 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 if (this.entitiesInLevel.remove(pos) && ichunkaccess instanceof LevelChunk) { LevelChunk chunk = (LevelChunk) ichunkaccess; -@@ -678,20 +694,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -680,20 +696,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } private CompletableFuture> scheduleChunkLoad(ChunkPos pos) { @@ -2427,7 +2427,7 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 this.markPosition(pos, protochunk.getStatus().getChunkType()); return Either.left(protochunk); } -@@ -713,7 +730,32 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -715,7 +732,32 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.markPositionReplaceable(pos); return Either.left(new ProtoChunk(pos, UpgradeData.EMPTY, this.level, this.level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), (BlendingData) null)); @@ -2461,8 +2461,8 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 } private void markPositionReplaceable(ChunkPos pos) { -@@ -895,7 +937,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - return this.tickingGenerated.get(); +@@ -923,7 +965,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + } } + // Paper start - async chunk save for unload @@ -2510,7 +2510,7 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 this.poiManager.flush(chunk.getPos()); if (!chunk.isUnsaved()) { return false; -@@ -907,7 +990,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -935,7 +1018,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkstatus = chunk.getStatus(); if (chunkstatus.getChunkType() != ChunkStatus.ChunkType.LEVELCHUNK) { @@ -2519,7 +2519,7 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 return false; } -@@ -917,9 +1000,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -945,9 +1028,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } this.level.getProfiler().incrementCounter("chunkSave"); @@ -2537,7 +2537,7 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 this.markPosition(chunkcoordintpair, chunkstatus.getChunkType()); return true; } catch (Exception exception) { -@@ -928,6 +1017,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -956,6 +1045,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return false; } } @@ -2545,7 +2545,7 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 } private boolean isExistingChunkFull(ChunkPos pos) { -@@ -1060,6 +1150,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1088,6 +1178,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -2582,10 +2582,10 @@ index 0727c025e87e889861b2f3e78e28d4d17840ff54..a605b0868b8214408e20419e336ad526 public CompoundTag readChunk(ChunkPos pos) throws IOException { CompoundTag nbttagcompound = this.read(pos); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 212261651fd650cc895f817ccca37699d1cade8f..8923c305a34a8b8cfae90661a831a6fc656bef9f 100644 +index 80ccd821d83b318d3758252ce4ed349bfa5acb69..30b38f85870bd3fd5f04e8ed37c360ee3a10abad 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -500,10 +500,111 @@ public class ServerChunkCache extends ChunkSource { +@@ -502,10 +502,111 @@ public class ServerChunkCache extends ChunkSource { return ret; } // Paper end @@ -2697,7 +2697,7 @@ index 212261651fd650cc895f817ccca37699d1cade8f..8923c305a34a8b8cfae90661a831a6fc if (Thread.currentThread() != this.mainThread) { return (ChunkAccess) CompletableFuture.supplyAsync(() -> { return this.getChunk(x, z, leastStatus, create); -@@ -526,13 +627,18 @@ public class ServerChunkCache extends ChunkSource { +@@ -528,13 +629,18 @@ public class ServerChunkCache extends ChunkSource { } gameprofilerfiller.incrementCounter("getChunkCacheMiss"); @@ -2717,7 +2717,7 @@ index 212261651fd650cc895f817ccca37699d1cade8f..8923c305a34a8b8cfae90661a831a6fc this.level.timings.syncChunkLoad.stopTiming(); // Paper } // Paper ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { -@@ -619,6 +725,11 @@ public class ServerChunkCache extends ChunkSource { +@@ -621,6 +727,11 @@ public class ServerChunkCache extends ChunkSource { } private CompletableFuture> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { @@ -2729,7 +2729,7 @@ index 212261651fd650cc895f817ccca37699d1cade8f..8923c305a34a8b8cfae90661a831a6fc ChunkPos chunkcoordintpair = new ChunkPos(chunkX, chunkZ); long k = chunkcoordintpair.toLong(); int l = 33 + ChunkStatus.getDistance(leastStatus); -@@ -1028,11 +1139,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -1035,11 +1146,12 @@ public class ServerChunkCache extends ChunkSource { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task public boolean pollTask() { try { @@ -2744,7 +2744,7 @@ index 212261651fd650cc895f817ccca37699d1cade8f..8923c305a34a8b8cfae90661a831a6fc } finally { chunkMap.callbackExecutor.run(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 29b2ddee252759c7ad17df8fe19ea08a36eb2673..93751b6df3c8eab6445262e98296eaaa2a65e1b3 100644 +index 8411c314b5a4a8131c8e96432f8b0f42b207277e..3f6634056fe00ee47e6b33deee97d67bd9dfa6fb 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -307,6 +307,78 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2866,7 +2866,7 @@ index c8a5cd52689b2cd81a2206f0f71623d784c379ce..7ed73ea4a5f7383c953ee3e28ce8f234 StringReader stringreader = new StringReader(packet.getCommand()); diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index 2a73700b0cd31e2a88c478b884de0a7f3d018259..0a1e667487e2c7849e11c0395816dc8ce20e0113 100644 +index 2b60fc107c309958ec3f20539b243d32765f3518..4a972b26242cf4c9d7e8f655cb1264cddad5f143 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java @@ -37,9 +37,11 @@ public class PoiManager extends SectionStorage { @@ -2881,7 +2881,7 @@ index 2a73700b0cd31e2a88c478b884de0a7f3d018259..0a1e667487e2c7849e11c0395816dc8c this.distanceTracker = new PoiManager.DistanceTracker(); } -@@ -172,7 +174,18 @@ public class PoiManager extends SectionStorage { +@@ -173,7 +175,18 @@ public class PoiManager extends SectionStorage { @Override public void tick(BooleanSupplier shouldKeepTicking) { @@ -2901,7 +2901,7 @@ index 2a73700b0cd31e2a88c478b884de0a7f3d018259..0a1e667487e2c7849e11c0395816dc8c this.distanceTracker.runAllUpdates(); } -@@ -265,6 +278,35 @@ public class PoiManager extends SectionStorage { +@@ -266,6 +279,35 @@ public class PoiManager extends SectionStorage { } } @@ -2938,7 +2938,7 @@ index 2a73700b0cd31e2a88c478b884de0a7f3d018259..0a1e667487e2c7849e11c0395816dc8c HAS_SPACE(PoiRecord::hasSpace), IS_OCCUPIED(PoiRecord::isOccupied), diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 2fd969d1450d1251c139f3721d146fd2e191c4dd..3215238699f46d64d0291597f5936d1f3d7b6d6c 100644 +index d3051e8bdec40cc00326c6ab4ab08e56065c1f56..9168bc15f8fbc8719e6c83428b8241053505441e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -75,7 +75,31 @@ public class ChunkSerializer { @@ -3169,7 +3169,7 @@ index 2fd969d1450d1251c139f3721d146fd2e191c4dd..3215238699f46d64d0291597f5936d1f CompoundTag nbttagcompound3 = new CompoundTag(); Iterator iterator1 = chunk.getHeightmaps().iterator(); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -index 0259baec1ceb911f39e733d52d232dec19577550..1fc202caf9051f12192ed479898b01b0a02eebbd 100644 +index e2beb58065e049745c063d0edc49e295b14f9084..2eba8c2d1e978f677eaedac2e09cd1124f1d03db 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java @@ -25,27 +25,38 @@ import net.minecraft.world.level.storage.DimensionDataStorage; @@ -3278,7 +3278,7 @@ index 0259baec1ceb911f39e733d52d232dec19577550..1fc202caf9051f12192ed479898b01b0 } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 7b69007609ed421ee72ddc3d6f2a7b64888babf1..6f7bcf74b0ff42841e37f36561d6c54e1ee8c989 100644 +index 87ea11505849cc9d4455d42eaae9af310ad63ae4..04e45b4de2f4e26853a4fed6271cf79ef8607154 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -44,6 +44,7 @@ public class RegionFile implements AutoCloseable { @@ -3287,8 +3287,8 @@ index 7b69007609ed421ee72ddc3d6f2a7b64888babf1..6f7bcf74b0ff42841e37f36561d6c54e protected final RegionBitmap usedSectors; + public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper - public RegionFile(Path path, Path path1, boolean dsync) throws IOException { - this(path, path1, RegionFileVersion.VERSION_DEFLATE, dsync); + public RegionFile(Path file, Path directory, boolean dsync) throws IOException { + this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); @@ -228,7 +229,7 @@ public class RegionFile implements AutoCloseable { return (byteCount + 4096 - 1) / 4096; } @@ -3430,7 +3430,7 @@ index deb852aa0fb2ad55a94d3c7ee542a0cc8013be42..40830a2b231df9bbf676d8325e76c825 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index a7d73e1fff7a5728053e877f3dbd94ef0e0a3012..8ec74454438e7a36415a5f7fa379b31d14858df3 100644 +index 415ec2cb81e956526e7f4965b899c9aa04f62f2e..ff6cadec530dedf9efc5d6226e48a096a1073ad6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java @@ -30,10 +30,10 @@ import net.minecraft.world.level.LevelHeightAccessor; diff --git a/patches/server/0258-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/server/0258-Add-ray-tracing-methods-to-LivingEntity.patch index 95823b3217..07e26b413f 100644 --- a/patches/server/0258-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/server/0258-Add-ray-tracing-methods-to-LivingEntity.patch @@ -28,10 +28,10 @@ index 4f45ac04a219e619c13b31befd2c4e452057079c..170b3cbc89793bb92e249383d86a5f0c switch (enumDirection) { case DOWN: diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a1de99f07f47e4b378b0c36ea158ce0693ee2686..e19bfd60c9905b003ff541b6f2c3371116fe3e5b 100644 +index 16936d7ce3faec09ccdde58b2bf2b6f9db0f9cd8..cf4640f1e38f3e50b3a85692e032a78b4102d31e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3689,6 +3689,23 @@ public abstract class LivingEntity extends Entity { +@@ -3691,6 +3691,23 @@ public abstract class LivingEntity extends Entity { } // Paper start diff --git a/patches/server/0261-Allow-chests-to-be-placed-with-NBT-data.patch b/patches/server/0261-Allow-chests-to-be-placed-with-NBT-data.patch index 2d75e11b9c..6605721498 100644 --- a/patches/server/0261-Allow-chests-to-be-placed-with-NBT-data.patch +++ b/patches/server/0261-Allow-chests-to-be-placed-with-NBT-data.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow chests to be placed with NBT data diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 6c82bb01db0431080425bfa65ab67ce703194214..9126aa0c988824ce89ffa724ae9895105184d0f1 100644 +index 033f7486556f5928d902dd25cd3d5a38e0e8097e..b8b77a3c8aa3feb433bd232d0f60867bfcae530d 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -339,6 +339,7 @@ public final class ItemStack { +@@ -340,6 +340,7 @@ public final class ItemStack { enuminteractionresult = InteractionResult.FAIL; // cancel placement // PAIL: Remove this when MC-99075 fixed placeEvent.getPlayer().updateInventory(); diff --git a/patches/server/0273-Add-LivingEntity-getTargetEntity.patch b/patches/server/0273-Add-LivingEntity-getTargetEntity.patch index 5e6633ca02..b1853925ba 100644 --- a/patches/server/0273-Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/0273-Add-LivingEntity-getTargetEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d61375bdd0cff7dfd74dd5dc1e6803e6320aa82a..5d47b536e89f192b10aa1434cd9cdccc49cd3eec 100644 +index 4fbc60ef1e6769bd54b2976935b222f7224cb5c2..ea3d289a859e5f093600ae40baa043599ba2d704 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -113,6 +113,7 @@ import net.minecraft.world.level.storage.loot.LootTable; @@ -16,7 +16,7 @@ index d61375bdd0cff7dfd74dd5dc1e6803e6320aa82a..5d47b536e89f192b10aa1434cd9cdccc import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.scores.PlayerTeam; -@@ -3735,6 +3736,38 @@ public abstract class LivingEntity extends Entity { +@@ -3737,6 +3738,38 @@ public abstract class LivingEntity extends Entity { return level.clip(raytrace); } diff --git a/patches/server/0294-force-entity-dismount-during-teleportation.patch b/patches/server/0294-force-entity-dismount-during-teleportation.patch index f7b9a82620..cd43ec2834 100644 --- a/patches/server/0294-force-entity-dismount-during-teleportation.patch +++ b/patches/server/0294-force-entity-dismount-during-teleportation.patch @@ -41,10 +41,10 @@ index db7f2715534ed71a2b285de095238586fe6a35b0..f51c416e7938b7905f7efb154ab14cad if (entity1 != entity && this.connection != null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 752e4593bed746e663f018f85ae1ac43cd7b0795..a1744b820a49cd4195b0e9ced960dc6bd2d58d45 100644 +index d442725c1c9ae274b11f3a11ea4cf15f51d62def..5e4fdf4bd8f4f28ddbd59e054c4621fa01f6d165 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2279,11 +2279,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2233,11 +2233,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void removeVehicle() { @@ -62,7 +62,7 @@ index 752e4593bed746e663f018f85ae1ac43cd7b0795..a1744b820a49cd4195b0e9ced960dc6b } } -@@ -2346,7 +2351,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2300,7 +2305,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return true; // CraftBukkit } @@ -74,7 +74,7 @@ index 752e4593bed746e663f018f85ae1ac43cd7b0795..a1744b820a49cd4195b0e9ced960dc6b if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -2356,7 +2364,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2310,7 +2318,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( (Vehicle) this.getBukkitEntity(), @@ -83,7 +83,7 @@ index 752e4593bed746e663f018f85ae1ac43cd7b0795..a1744b820a49cd4195b0e9ced960dc6b ); // Suppress during worldgen if (this.valid) { -@@ -2370,7 +2378,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2324,7 +2332,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } // CraftBukkit end // Spigot start @@ -93,7 +93,7 @@ index 752e4593bed746e663f018f85ae1ac43cd7b0795..a1744b820a49cd4195b0e9ced960dc6b if (this.valid) { Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5d47b536e89f192b10aa1434cd9cdccc49cd3eec..00900427e88f8e9118df4fb2e0e98c26b9f1b7d4 100644 +index ea3d289a859e5f093600ae40baa043599ba2d704..8bdaf925580480a9467b5611e77580bb205c0a4a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3336,9 +3336,15 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0314-Entity-getEntitySpawnReason.patch b/patches/server/0314-Entity-getEntitySpawnReason.patch index 3bde58a4a9..9458e9ffa1 100644 --- a/patches/server/0314-Entity-getEntitySpawnReason.patch +++ b/patches/server/0314-Entity-getEntitySpawnReason.patch @@ -10,7 +10,7 @@ persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 93751b6df3c8eab6445262e98296eaaa2a65e1b3..d5d72c70d4e414f618d7a6478843deec82f2386a 100644 +index 3f6634056fe00ee47e6b33deee97d67bd9dfa6fb..cd2dd257126a207b0ccf7e94bc71c5a52ca8509d 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1183,6 +1183,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -35,7 +35,7 @@ index 601eb789e19efe4a2fa697c0b5e7c28b245f0990..de713d1c41642ff6d9e992981252c91f }); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a1744b820a49cd4195b0e9ced960dc6bd2d58d45..d9feae255354f5577b5fa2b202f33bbc7e645867 100644 +index 5e4fdf4bd8f4f28ddbd59e054c4621fa01f6d165..c116987952f53026ef0b5d67ec8da1fa9baa71b6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -67,6 +67,8 @@ import net.minecraft.world.InteractionHand; @@ -47,7 +47,7 @@ index a1744b820a49cd4195b0e9ced960dc6bd2d58d45..d9feae255354f5577b5fa2b202f33bbc import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.Boat; -@@ -166,6 +168,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -165,6 +167,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } } }; @@ -55,7 +55,7 @@ index a1744b820a49cd4195b0e9ced960dc6bd2d58d45..d9feae255354f5577b5fa2b202f33bbc // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -@@ -1900,6 +1903,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1854,6 +1857,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -65,7 +65,7 @@ index a1744b820a49cd4195b0e9ced960dc6bd2d58d45..d9feae255354f5577b5fa2b202f33bbc // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); -@@ -2045,6 +2051,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1999,6 +2005,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -93,7 +93,7 @@ index a1744b820a49cd4195b0e9ced960dc6bd2d58d45..d9feae255354f5577b5fa2b202f33bbc } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 36d1bdef298cecd84fdaa400f414f2798a9a49bb..66ce7d852cf7a6070c29402c80700b2b31d08832 100644 +index f08c5ae9d41ec9efb627665f5de4dd6165fd0092..30930a24c197c45f2ed86eaf7a150252005e7a37 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -179,6 +179,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0323-Mob-Spawner-API-Enhancements.patch b/patches/server/0323-Mob-Spawner-API-Enhancements.patch index e09f846dbb..41e2e0f229 100644 --- a/patches/server/0323-Mob-Spawner-API-Enhancements.patch +++ b/patches/server/0323-Mob-Spawner-API-Enhancements.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Mob Spawner API Enhancements diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 1e0d630a5c192a0fb60882acecd8a6ed68d00a92..dba24bb35085a14a3780c10762f229eb40f84ef9 100644 +index 30930a24c197c45f2ed86eaf7a150252005e7a37..c0f33a6cb4812e13204552c125df06210adc7196 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -230,7 +230,13 @@ public abstract class BaseSpawner { @@ -43,29 +43,29 @@ index 1e0d630a5c192a0fb60882acecd8a6ed68d00a92..dba24bb35085a14a3780c10762f229eb @@ -285,9 +297,20 @@ public abstract class BaseSpawner { } - public CompoundTag save(CompoundTag nbttagcompound) { -- nbttagcompound.putShort("Delay", (short) this.spawnDelay); -- nbttagcompound.putShort("MinSpawnDelay", (short) this.minSpawnDelay); -- nbttagcompound.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay); + public CompoundTag save(CompoundTag nbt) { +- nbt.putShort("Delay", (short) this.spawnDelay); +- nbt.putShort("MinSpawnDelay", (short) this.minSpawnDelay); +- nbt.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay); + // Paper start + if (spawnDelay > Short.MAX_VALUE) { -+ nbttagcompound.putInt("Paper.Delay", this.spawnDelay); ++ nbt.putInt("Paper.Delay", this.spawnDelay); + } -+ nbttagcompound.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay)); ++ nbt.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay)); + + if (minSpawnDelay > Short.MAX_VALUE || maxSpawnDelay > Short.MAX_VALUE) { -+ nbttagcompound.putInt("Paper.MinSpawnDelay", this.minSpawnDelay); -+ nbttagcompound.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay); ++ nbt.putInt("Paper.MinSpawnDelay", this.minSpawnDelay); ++ nbt.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay); + } + -+ nbttagcompound.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay)); -+ nbttagcompound.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay)); -+ // Paper end - nbttagcompound.putShort("SpawnCount", (short) this.spawnCount); - nbttagcompound.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities); - nbttagcompound.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange); ++ nbt.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay)); ++ nbt.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay)); ++ // Paper nbt + nbt.putShort("SpawnCount", (short) this.spawnCount); + nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities); + nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java -index 6c427b15f78970912bae881f5aba1cfae2a4ba53..128a675a5af5148216dfa4bea6a5762b639f69f6 100644 +index 6c427b15f78970912bae881f5aba1cfae2a4ba53..3877376619d633f48e37b6c854ae7df77ccca456 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java @@ -116,4 +116,30 @@ public class CraftCreatureSpawner extends CraftBlockEntityState extends TargetG +@@ -38,6 +38,7 @@ public class NearestAttackableTargetGoal extends TargetG this.randomInterval = reducedTickDelay(reciprocalChance); this.setFlags(EnumSet.of(Goal.Flag.TARGET)); this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate); diff --git a/patches/server/0346-Duplicate-UUID-Resolve-Option.patch b/patches/server/0346-Duplicate-UUID-Resolve-Option.patch index 50af03801f..842c9ac06f 100644 --- a/patches/server/0346-Duplicate-UUID-Resolve-Option.patch +++ b/patches/server/0346-Duplicate-UUID-Resolve-Option.patch @@ -83,7 +83,7 @@ index 5628ddebd2a24dc8461c1bd4b0571aa5efd3b418..a0b04a04f90ef79edae77e6ab4cddd2a private void countAllMobsForSpawning() { countAllMobsForSpawning = getBoolean("count-all-mobs-for-spawning", false); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 18d442feb77f7763d8f6c411b0e5cb0aeca1f725..969401d1c4a506111ad212950bca42fdac59ad1f 100644 +index d302c074d8808145e425380eb0f8e5ccf8f256c3..97ca952fd3d7262b72606be4fb4c3320b142d4c3 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1,6 +1,7 @@ @@ -112,7 +112,7 @@ index 18d442feb77f7763d8f6c411b0e5cb0aeca1f725..969401d1c4a506111ad212950bca42fd import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionStage; -@@ -840,6 +845,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -845,6 +850,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.discard(); needsRemoval = true; } @@ -120,7 +120,7 @@ index 18d442feb77f7763d8f6c411b0e5cb0aeca1f725..969401d1c4a506111ad212950bca42fd return !needsRemoval; })); // CraftBukkit end -@@ -890,6 +896,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -895,6 +901,43 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } diff --git a/patches/server/0347-Optimize-Hoppers.patch b/patches/server/0347-Optimize-Hoppers.patch index 4dd405b2c9..9c84ae5ee4 100644 --- a/patches/server/0347-Optimize-Hoppers.patch +++ b/patches/server/0347-Optimize-Hoppers.patch @@ -35,7 +35,7 @@ index a0b04a04f90ef79edae77e6ab4cddd2a7d299abf..7dbb7f0e476c82fcbec7b51b62be18ad } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 977dc521cff5b448665e00b953f4a02ecf04ee75..4661d571cd4047c6b7d76de7ba0cb34ada348d63 100644 +index c6409dfa739f0056484e70d2be4cd448e868d6bb..e31eab1baaa77dfb6a3e804481d91b91b6878f65 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1420,6 +1420,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> worldgenMailbox; public final ProcessorHandle> mainThreadMailbox; @@ -150,7 +150,7 @@ index 969401d1c4a506111ad212950bca42fdac59ad1f..f3f6fc973cd75a42594f1ec222c220e3 public final ChunkProgressListener progressListener; private final ChunkStatusUpdateListener chunkStatusListener; public final ChunkMap.ChunkDistanceManager distanceManager; -@@ -240,11 +246,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -241,11 +247,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.progressListener = worldGenerationProgressListener; this.chunkStatusListener = chunkStatusChangeListener; diff --git a/patches/server/0362-Tracking-Range-Improvements.patch b/patches/server/0362-Tracking-Range-Improvements.patch index fab24b3b10..0e7afcf55f 100644 --- a/patches/server/0362-Tracking-Range-Improvements.patch +++ b/patches/server/0362-Tracking-Range-Improvements.patch @@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f3f6fc973cd75a42594f1ec222c220e3894e11ee..701f6f9e7d3077436daf03679d3a375a6647e30b 100644 +index 90a2153d8037d51f701b80d7ac7d46d9e282fa6e..3e3de423696a85d0dbdf9171a82a39635f00cd59 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1832,6 +1832,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1860,6 +1860,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); int j = entity.getType().clientTrackingRange() * 16; diff --git a/patches/server/0363-Fix-items-vanishing-through-end-portal.patch b/patches/server/0363-Fix-items-vanishing-through-end-portal.patch index f4d400301e..7c4a1c1564 100644 --- a/patches/server/0363-Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/0363-Fix-items-vanishing-through-end-portal.patch @@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d789a9068353c8e7be774c275d4d099283bf826c..898ce2c6acb5a6af51a465344da4447809c2993a 100644 +index ba436054bcbce6ef990b71d58d74ff5d4d53fef2..ee66ad71eee4619bb69eaada8f6a0a42a03283d4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3050,6 +3050,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3006,6 +3006,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i BlockPos blockposition1; if (flag1) { diff --git a/patches/server/0364-implement-optional-per-player-mob-spawns.patch b/patches/server/0364-implement-optional-per-player-mob-spawns.patch index 1e4383082d..22e32c1578 100644 --- a/patches/server/0364-implement-optional-per-player-mob-spawns.patch +++ b/patches/server/0364-implement-optional-per-player-mob-spawns.patch @@ -547,10 +547,10 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc + } +} diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 701f6f9e7d3077436daf03679d3a375a6647e30b..04c63334c4387965b2f9fc2643c28b8a954c936d 100644 +index 3e3de423696a85d0dbdf9171a82a39635f00cd59..ae1e347072bd898cebd00e66c8593f928a95a84c 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -149,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -150,6 +150,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final Long2ByteMap chunkTypeCache; private final Queue unloadQueue; int viewDistance; @@ -558,7 +558,7 @@ index 701f6f9e7d3077436daf03679d3a375a6647e30b..04c63334c4387965b2f9fc2643c28b8a // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); -@@ -261,6 +262,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -262,6 +263,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); this.regionManagers.add(this.dataRegionManager); // Paper end @@ -566,7 +566,7 @@ index 701f6f9e7d3077436daf03679d3a375a6647e30b..04c63334c4387965b2f9fc2643c28b8a } protected ChunkGenerator generator() { -@@ -278,6 +280,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -279,6 +281,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } @@ -593,10 +593,10 @@ index 701f6f9e7d3077436daf03679d3a375a6647e30b..04c63334c4387965b2f9fc2643c28b8a double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 8923c305a34a8b8cfae90661a831a6fc656bef9f..0c84161d82245ab9d5c87a981a3c0f4fa5644640 100644 +index 30b38f85870bd3fd5f04e8ed37c360ee3a10abad..dd0237a92a02d3239119234b3ef74328ce8e5b92 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -914,7 +914,22 @@ public class ServerChunkCache extends ChunkSource { +@@ -916,7 +916,22 @@ public class ServerChunkCache extends ChunkSource { gameprofilerfiller.push("naturalSpawnCount"); this.level.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.distanceManager.getNaturalSpawnChunkCount(); diff --git a/patches/server/0365-Avoid-hopper-searches-if-there-are-no-items.patch b/patches/server/0365-Avoid-hopper-searches-if-there-are-no-items.patch index cc649c8b14..39a2c52b7b 100644 --- a/patches/server/0365-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/patches/server/0365-Avoid-hopper-searches-if-there-are-no-items.patch @@ -14,7 +14,7 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 04ef0245877ab7e6978149209549151e4f157920..de069f9f7af5ff3e346d68e254ae7138fb19f3f3 100644 +index 77e58257dc3fb517aeca8f8436a4279aa133b570..9842e4d39130f45481b643df38ee4b25076c5c08 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -985,7 +985,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -27,7 +27,7 @@ index 04ef0245877ab7e6978149209549151e4f157920..de069f9f7af5ff3e346d68e254ae7138 } diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java -index 06649ebed94f2d3e1a076e06e1027e4ee37a8c37..8cf4373486cbb913f9876891ed3bd6f5ee2b405f 100644 +index e3027cae3674502bdc34fdbd7002980515ffc837..07691d38960add169d24bc830ac7b951bd5afaef 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java +++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java @@ -13,6 +13,10 @@ public class EntitySection { @@ -44,60 +44,59 @@ index 06649ebed94f2d3e1a076e06e1027e4ee37a8c37..8cf4373486cbb913f9876891ed3bd6f5 @@ -20,10 +24,24 @@ public class EntitySection { } - public void add(T entityAccess) { + public void add(T entity) { + // Paper start -+ if (entityAccess instanceof net.minecraft.world.entity.item.ItemEntity) { ++ if (entity instanceof net.minecraft.world.entity.item.ItemEntity) { + this.itemCount++; -+ } else if (entityAccess instanceof net.minecraft.world.Container) { ++ } else if (entity instanceof net.minecraft.world.Container) { + this.inventoryEntityCount++; + } + // Paper end - this.storage.add(entityAccess); + this.storage.add(entity); } - public boolean remove(T entityAccess) { + public boolean remove(T entity) { + // Paper start -+ if (entityAccess instanceof net.minecraft.world.entity.item.ItemEntity) { ++ if (entity instanceof net.minecraft.world.entity.item.ItemEntity) { + this.itemCount--; -+ } else if (entityAccess instanceof net.minecraft.world.Container) { ++ } else if (entity instanceof net.minecraft.world.Container) { + this.inventoryEntityCount--; + } + // Paper end - return this.storage.remove(entityAccess); + return this.storage.remove(entity); } @@ -42,7 +60,7 @@ public class EntitySection { for(T entityAccess : collection) { U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess)); - if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(aABB)) { + if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box)) { - action.accept((T)entityAccess2); + action.accept(entityAccess2); // Paper - decompile fixes } } diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java -index 2e070899554a04c6be650b5b0557b704f972d63b..344e994887e44477c0fb070b5ddcbdb18e6d8e67 100644 +index 13df7889b2b5249fb81c54fadf55315a4c515116..984e940a1d8060e5945a6efd10c9f81bed2bf057 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java +++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java -@@ -111,13 +111,20 @@ public class EntitySectionStorage { +@@ -111,13 +111,19 @@ public class EntitySectionStorage { } public void getEntities(AABB box, Consumer action) { + // Paper start -+ this.getEntities(box, action, false); + } + public void getEntities(AABB box, Consumer action, boolean isContainerSearch) { + // Paper end - this.forEachAccessibleNonEmptySection(box, (entitySection) -> { -+ if (isContainerSearch && entitySection.inventoryEntityCount <= 0) return; // Paper - entitySection.getEntities(box, action); + this.forEachAccessibleNonEmptySection(box, (section) -> { ++ if (isContainerSearch && section.inventoryEntityCount <= 0) return; // Paper + section.getEntities(box, action); }); } public void getEntities(EntityTypeTest filter, AABB box, Consumer action) { - this.forEachAccessibleNonEmptySection(box, (entitySection) -> { -+ if (filter.getBaseClass() == net.minecraft.world.entity.item.ItemEntity.class && entitySection.itemCount <= 0) return; // Paper - entitySection.getEntities(filter, box, action); + this.forEachAccessibleNonEmptySection(box, (section) -> { ++ if (filter.getBaseClass() == net.minecraft.world.entity.item.ItemEntity.class && section.itemCount <= 0) return; // Paper + section.getEntities(filter, box, action); }); } diff --git a/src/main/java/net/minecraft/world/level/entity/LevelEntityGetter.java b/src/main/java/net/minecraft/world/level/entity/LevelEntityGetter.java diff --git a/patches/server/0367-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/patches/server/0367-Optimise-getChunkAt-calls-for-loaded-chunks.patch index 11596925af..a513ec9604 100644 --- a/patches/server/0367-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/patches/server/0367-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either, then unwrap it... diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 0c84161d82245ab9d5c87a981a3c0f4fa5644640..f3de621c371d97c24dd0c5a8039204a221bd8a3a 100644 +index dd0237a92a02d3239119234b3ef74328ce8e5b92..3156badcef61c028df3e78e97019093c9ac01cb4 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -610,6 +610,12 @@ public class ServerChunkCache extends ChunkSource { +@@ -612,6 +612,12 @@ public class ServerChunkCache extends ChunkSource { return this.getChunk(x, z, leastStatus, create); }, this.mainThreadProcessor).join(); } else { @@ -23,7 +23,7 @@ index 0c84161d82245ab9d5c87a981a3c0f4fa5644640..f3de621c371d97c24dd0c5a8039204a2 ProfilerFiller gameprofilerfiller = this.level.getProfiler(); gameprofilerfiller.incrementCounter("getChunk"); -@@ -661,39 +667,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -663,39 +669,7 @@ public class ServerChunkCache extends ChunkSource { if (Thread.currentThread() != this.mainThread) { return null; } else { diff --git a/patches/server/0368-Add-debug-for-sync-chunk-loads.patch b/patches/server/0368-Add-debug-for-sync-chunk-loads.patch index 4db48d5b97..697dd597d2 100644 --- a/patches/server/0368-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0368-Add-debug-for-sync-chunk-loads.patch @@ -305,10 +305,10 @@ index 0000000000000000000000000000000000000000..0bb4aaa546939b67a5d22865190f3047 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index f3de621c371d97c24dd0c5a8039204a221bd8a3a..2f31cae237b74e8281142c5ccf9ac4272607b8eb 100644 +index 3156badcef61c028df3e78e97019093c9ac01cb4..0af558b8246cc5661c2be6655cc0658519456202 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -642,6 +642,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -644,6 +644,7 @@ public class ServerChunkCache extends ChunkSource { this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1); // Paper end @@ -317,7 +317,7 @@ index f3de621c371d97c24dd0c5a8039204a221bd8a3a..2f31cae237b74e8281142c5ccf9ac427 chunkproviderserver_b.managedBlock(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 09deaa9badf53bdc1292796c643751d8d92ac585..1ac40d31c5abefb062886757a78adc65daede768 100644 +index 37e9ef7b6378c0dca958426e223fb181b6ca12ff..e7ae70ae59b65a8577bf4dc065fb729a3d5c5d95 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -379,6 +379,12 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0372-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0372-Add-option-to-nerf-pigmen-from-nether-portals.patch index c4f3f6e4cd..0553ffd647 100644 --- a/patches/server/0372-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0372-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -21,10 +21,10 @@ index 14d96b70a56946f21e7ffb5841e7eda3f24e087b..8ce19dcc8eb55557186b4716b54937dc private void lightQueueSize() { lightQueueSize = getInt("light-queue-size", lightQueueSize); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 898ce2c6acb5a6af51a465344da4447809c2993a..c7581c1b306d9c6498e18456d67f5acd067357e6 100644 +index ee66ad71eee4619bb69eaada8f6a0a42a03283d4..13e6fd62d7e9026a31455c5e2fa36392c7a0b249 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -334,6 +334,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -333,6 +333,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public long activatedImmunityTick = Integer.MIN_VALUE; // Paper public boolean isTemporarilyActive = false; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @@ -32,7 +32,7 @@ index 898ce2c6acb5a6af51a465344da4447809c2993a..c7581c1b306d9c6498e18456d67f5acd protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1921,6 +1922,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1875,6 +1876,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); } @@ -42,7 +42,7 @@ index 898ce2c6acb5a6af51a465344da4447809c2993a..c7581c1b306d9c6498e18456d67f5acd // Paper end return nbt; } catch (Throwable throwable) { -@@ -2062,6 +2066,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2016,6 +2020,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status diff --git a/patches/server/0381-Add-tick-times-API-and-mspt-command.patch b/patches/server/0381-Add-tick-times-API-and-mspt-command.patch index d414178ee3..2ff9bfcbcb 100644 --- a/patches/server/0381-Add-tick-times-API-and-mspt-command.patch +++ b/patches/server/0381-Add-tick-times-API-and-mspt-command.patch @@ -87,7 +87,7 @@ index 4875e323e8ba52cf91259262b8418310061718ad..a074df5708624bd4b0bc2ad3dcbd4bc4 version = getInt("config-version", 24); set("config-version", 24); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 758a972589b607447dc507c6c4f4b2a62f6a2832..56682365381d34784b63d36ab50a1deedfb73e74 100644 +index b80a7d98d4b088e3cc98c3d6f9b053974a71c568..64370c9c5e443f8e84e7f2f018c56f0223eb4b24 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -245,6 +245,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 1ac40d31c5abefb062886757a78adc65daede768..cdacb26699a54659d1e43ec0f73640556a743700 100644 +index e7ae70ae59b65a8577bf4dc065fb729a3d5c5d95..cda574e825164587bd126029d5b556c049c18015 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2167,7 +2167,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2170,7 +2170,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public void onTrackingStart(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot @@ -38,7 +38,7 @@ index 1ac40d31c5abefb062886757a78adc65daede768..cdacb26699a54659d1e43ec0f7364055 if (entity instanceof ServerPlayer) { ServerLevel.this.players.add((ServerPlayer) entity); ServerLevel.this.updateSleepingPlayerList(); -@@ -2189,6 +2189,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2192,6 +2192,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } entity.valid = true; // CraftBukkit diff --git a/patches/server/0390-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0390-Optimize-Collision-to-not-load-chunks.patch index 62bfb4a710..144ae76af0 100644 --- a/patches/server/0390-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0390-Optimize-Collision-to-not-load-chunks.patch @@ -26,10 +26,10 @@ index 494b18a3dfa05b5e6ecbb9b99abf06bfe6e1d166..5c54bc74c668778161ae47c9160f8c4c entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c7581c1b306d9c6498e18456d67f5acd067357e6..82068b1ccc958fd9c1ba6887cf3ffad1c0660f07 100644 +index 13e6fd62d7e9026a31455c5e2fa36392c7a0b249..c068e5fad2d9238201cada0d3a77ff2af1b8d8e1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -172,6 +172,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -171,6 +171,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper @@ -38,7 +38,7 @@ index c7581c1b306d9c6498e18456d67f5acd067357e6..82068b1ccc958fd9c1ba6887cf3ffad1 public net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java -index 301b0545e40b95497e6f35ae0fbfdf72f63e4a1a..b0ac1457c61e8831da77a54030f124f4c2c1c8b9 100644 +index 8390ce194ccc692139c0e870c16a7fb76ac8ba68..d40bbc5ae6b87028a6dde400ea714249792da79a 100644 --- a/src/main/java/net/minecraft/world/level/BlockCollisions.java +++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java @@ -66,22 +66,41 @@ public class BlockCollisions extends AbstractIterator { @@ -109,17 +109,3 @@ index 4c373d6c8ddd9f5db88888cd8dbbfc24eb5df793..56d94c94fb0d4dc468bb5d69be655ddd if (!this.getEntityCollisions(entity, box).isEmpty()) { return false; -diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 48812329969b7192acd948db974bb77bb546f979..5b1e0ea40dea6c7d787699ed25160c8b75ab3bf3 100644 ---- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -237,7 +237,8 @@ public final class Shapes { - - if (s < 3) { - mutableBlockPos.set(axisCycle, q, r, p); -- BlockState blockState = world.getBlockState(mutableBlockPos); -+ BlockState blockState = world.getTypeIfLoaded(mutableBlockPos); // Paper -+ if (blockState == null) return 0.0D; // Paper - if ((s != 1 || blockState.hasLargeCollisionShape()) && (s != 2 || blockState.is(Blocks.MOVING_PISTON))) { - initial = blockState.getCollisionShape(world, mutableBlockPos, context).collide(axis3, box.move((double)(-mutableBlockPos.getX()), (double)(-mutableBlockPos.getY()), (double)(-mutableBlockPos.getZ())), initial); - if (Math.abs(initial) < 1.0E-7D) { diff --git a/patches/server/0393-Improved-Watchdog-Support.patch b/patches/server/0393-Improved-Watchdog-Support.patch index e01da255e8..7054f4bebe 100644 --- a/patches/server/0393-Improved-Watchdog-Support.patch +++ b/patches/server/0393-Improved-Watchdog-Support.patch @@ -59,10 +59,10 @@ index e3b74dbdf8e14219a56fab939f3174e0c2f66de6..218f5bafeed8551b55b91c7fccaf6935 // Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the // bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay. diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java -index e3b605695e3b837246f72ccb364af06ea48bda45..62c3c597732e6fb30ed5367d902ea8763507a6b8 100644 +index c54530d1c66845b190a9cb6d06f985943bb4dbe1..35c9b3e6c5a2d11b4dbd491b16647df105960d1a 100644 --- a/src/main/java/net/minecraft/CrashReport.java +++ b/src/main/java/net/minecraft/CrashReport.java -@@ -232,6 +232,7 @@ public class CrashReport { +@@ -228,6 +228,7 @@ public class CrashReport { } public static CrashReport forThrowable(Throwable cause, String title) { @@ -71,7 +71,7 @@ index e3b605695e3b837246f72ccb364af06ea48bda45..62c3c597732e6fb30ed5367d902ea876 cause = cause.getCause(); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 56682365381d34784b63d36ab50a1deedfb73e74..77820cd4d464f2582b57f60d34bc0c2f3622e4ae 100644 +index 64370c9c5e443f8e84e7f2f018c56f0223eb4b24..cab914abbc6c655895f09d71f253889a0dcc4e02 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -297,7 +297,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements Profiler @@ -296,10 +296,10 @@ index 7bf4bf5cb2c1b54a7e2733091f48f3a824336d36..dcce05d2f4ab16424db4ab103a12188e } catch (Exception var3) { + if (var3.getCause() instanceof ThreadDeath) throw var3; // Paper LOGGER.fatal("Error executing task on {}", this.name(), var3); + throw var3; } - diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index de069f9f7af5ff3e346d68e254ae7138fb19f3f3..b74a92acd890e63d88d5841391f4ee56fca94676 100644 +index 9842e4d39130f45481b643df38ee4b25076c5c08..4a77494ddb94d5fd2d82665c6bd4e513b66f1d9f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -831,6 +831,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -311,10 +311,10 @@ index de069f9f7af5ff3e346d68e254ae7138fb19f3f3..b74a92acd890e63d88d5841391f4ee56 final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); MinecraftServer.LOGGER.error(msg, throwable); diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index fc0ac2a5ad24951f05a18607318e5b5edf4f3463..c76e46afa685fbaa5c83aff4ef72b5fe32bc6d10 100644 +index 1df4ddab06b6065464302bdc0e4eb0950964fa84..b92da719a5d35a60a2e13ccb0f55c41b242f9b50 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -1067,6 +1067,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1068,6 +1068,7 @@ public class LevelChunk extends ChunkAccess { gameprofilerfiller.pop(); } catch (Throwable throwable) { diff --git a/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch b/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch index 17e5fa7119..c450ef5318 100644 --- a/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 0758f0983c17e7e4b5b5aea64ea12e990f7a22e4..f3021f34a73c11ad2e181deda8a43d026280bef0 100644 +index 91d1b7ee3f47d06cdd15234a799f95ae6882af03..aeaaf975221a6495040ecf477cfb04f536fef213 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -172,6 +172,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -173,6 +173,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; // CraftBukkit end @@ -36,7 +36,7 @@ index 0758f0983c17e7e4b5b5aea64ea12e990f7a22e4..f3021f34a73c11ad2e181deda8a43d02 // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -976,7 +977,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -981,7 +982,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return Either.left(chunk); }); }, (runnable) -> { @@ -46,10 +46,10 @@ index 0758f0983c17e7e4b5b5aea64ea12e990f7a22e4..f3021f34a73c11ad2e181deda8a43d02 completablefuture1.thenAcceptAsync((either) -> { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 2f31cae237b74e8281142c5ccf9ac4272607b8eb..d56eb5071ed3ae2b9d5636cafb3aca9b2cd71d15 100644 +index 0af558b8246cc5661c2be6655cc0658519456202..a66d9d6df1fc0ad68f51ea96d4e1a2d725c73b05 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -1137,6 +1137,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -1144,6 +1144,7 @@ public class ServerChunkCache extends ChunkSource { return super.pollTask() || execChunkTask; // Paper } } finally { diff --git a/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 631f75894f..02bd9527a0 100644 --- a/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick delays anymore. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f3021f34a73c11ad2e181deda8a43d026280bef0..5592f879ef2c1b8f15bc63b38edb57f19e9d589d 100644 +index aeaaf975221a6495040ecf477cfb04f536fef213..ab0e3059e5d1e012f5c94d18aaebf218470d3be3 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1555,6 +1555,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1583,6 +1583,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider .printStackTrace(); return; } diff --git a/patches/server/0406-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0406-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 913a3842da..1cd8d81c83 100644 --- a/patches/server/0406-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0406-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,10 +7,10 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 82068b1ccc958fd9c1ba6887cf3ffad1c0660f07..1bc7c52e8de4325315f9d2204400e3447cfe7f4f 100644 +index c068e5fad2d9238201cada0d3a77ff2af1b8d8e1..6c06897513ed4d9a2edd5675c71d9966994cecaf 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2039,9 +2039,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1993,9 +1993,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i bworld = server.getWorld(worldName); } diff --git a/patches/server/0409-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0409-Add-phantom-creative-and-insomniac-controls.patch index 57d9bfbe8d..b098b72d35 100644 --- a/patches/server/0409-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0409-Add-phantom-creative-and-insomniac-controls.patch @@ -33,10 +33,10 @@ index b91a61be7c4829fce0ff8da290eab580e20bb78d..22f36cd3df49160f1b6668befdd05c22 private EntitySelector() {} // Paper start diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 451be9232eaa513ed66ff0d2b93c932317ad6729..7344301e1cdeccd95375b77f6955edb508362a7b 100644 +index e032d3e854bd60c37a5e6328389de3361108d9b2..573107f1281e68c7ba00d4dea8fac02f2d18504d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -548,6 +548,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -558,6 +558,7 @@ public class Phantom extends FlyingMob implements Enemy { Player entityhuman = (Player) iterator.next(); if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { diff --git a/patches/server/0410-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0410-Fix-numerous-item-duplication-issues-and-teleport-is.patch index 65c7abd0a6..a1d367c4eb 100644 --- a/patches/server/0410-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0410-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 1bc7c52e8de4325315f9d2204400e3447cfe7f4f..1e23785eb13082037b982886b27c460219f2cb0c 100644 +index 6c06897513ed4d9a2edd5675c71d9966994cecaf..95fcf31b0ea68312f6c3475c1b4a01ca2b269536 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2189,11 +2189,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2143,11 +2143,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -34,7 +34,7 @@ index 1bc7c52e8de4325315f9d2204400e3447cfe7f4f..1e23785eb13082037b982886b27c4602 entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -2944,6 +2945,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2900,6 +2901,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i @Nullable public Entity teleportTo(ServerLevel worldserver, BlockPos location) { // CraftBukkit end @@ -47,7 +47,7 @@ index 1bc7c52e8de4325315f9d2204400e3447cfe7f4f..1e23785eb13082037b982886b27c4602 if (this.level instanceof ServerLevel && !this.isRemoved()) { this.level.getProfiler().push("changeDimension"); // CraftBukkit start -@@ -2964,6 +2971,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2920,6 +2927,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // CraftBukkit end this.level.getProfiler().popPush("reloading"); @@ -59,7 +59,7 @@ index 1bc7c52e8de4325315f9d2204400e3447cfe7f4f..1e23785eb13082037b982886b27c4602 Entity entity = this.getType().create(worldserver); if (entity != null) { -@@ -2977,10 +2989,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -2933,10 +2945,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index 1bc7c52e8de4325315f9d2204400e3447cfe7f4f..1e23785eb13082037b982886b27c4602 // CraftBukkit end } -@@ -3101,7 +3109,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3057,7 +3065,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public boolean canChangeDimensions() { diff --git a/patches/server/0414-Optimize-Voxel-Shape-Merging.patch b/patches/server/0414-Optimize-Voxel-Shape-Merging.patch index 1e6eb75fe1..7bfe849396 100644 --- a/patches/server/0414-Optimize-Voxel-Shape-Merging.patch +++ b/patches/server/0414-Optimize-Voxel-Shape-Merging.patch @@ -68,10 +68,10 @@ index 9e0afab2329e560c4b2512548dd4b02dd1a2e69f..06662dbff8180751a8684841aa35f709 this.firstIndices = new int[k]; this.secondIndices = new int[k]; diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 5b1e0ea40dea6c7d787699ed25160c8b75ab3bf3..e29ed24999ae483c7d3e358a1e86fef99d67ef0c 100644 +index 2d273be8145bbd86ffdf33358629da7fc08b4d4c..9176735c08a75854209f24113b0e78332249dc4d 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -338,9 +338,21 @@ public final class Shapes { +@@ -247,9 +247,21 @@ public final class Shapes { } @VisibleForTesting @@ -94,7 +94,7 @@ index 5b1e0ea40dea6c7d787699ed25160c8b75ab3bf3..e29ed24999ae483c7d3e358a1e86fef9 if (first instanceof CubePointRange && second instanceof CubePointRange) { long l = lcm(i, j); if ((long)size * l <= 256L) { -@@ -348,13 +360,22 @@ public final class Shapes { +@@ -257,13 +269,22 @@ public final class Shapes { } } diff --git a/patches/server/0427-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/0427-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index fcb181734a..72a981c4cb 100644 --- a/patches/server/0427-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/0427-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -54,7 +54,7 @@ index 548f103e648d9670d7434182c6598dc29ae77b57..f0c789d339fe8402c9c2a684d7e0415f this.level.getProfiler().push("explosion_blocks"); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b74a92acd890e63d88d5841391f4ee56fca94676..4f97f11c248cbb06dbd604da0e88d9570e641af7 100644 +index 4a77494ddb94d5fd2d82665c6bd4e513b66f1d9f..0bcb14f1377d603c93c471ce206d2e38d0278b60 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -414,6 +414,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -135,19 +135,19 @@ index 2f1345d3c3671953a806cb243a152e080fbb9108..e9b315fb5a7b466e2ac65ae4ae69e893 world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 987a4180a1eb902c512c2e6a36d692cbdd9b1563..e1beb18dfb5529f48c312bf7ff85be18f6c935b5 100644 +index 3c6b1b92fedf9986ebb835170c070ebd461f5d25..9055a82e9c91ecb8fc2ef5ac58db043ffb759168 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -205,7 +205,7 @@ public abstract class BlockBehaviour { - +@@ -223,7 +223,7 @@ public abstract class BlockBehaviour { + /** @deprecated */ @Deprecated public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { - return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())); + return this.material.isReplaceable() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().getAbilities().instabuild)); // Paper } - @Deprecated -@@ -663,7 +663,11 @@ public abstract class BlockBehaviour { + /** @deprecated */ +@@ -705,7 +705,11 @@ public abstract class BlockBehaviour { public Block getBlock() { return (Block) this.owner; } @@ -160,7 +160,7 @@ index 987a4180a1eb902c512c2e6a36d692cbdd9b1563..e1beb18dfb5529f48c312bf7ff85be18 public Material getMaterial() { return this.material; } -@@ -761,7 +765,7 @@ public abstract class BlockBehaviour { +@@ -803,7 +807,7 @@ public abstract class BlockBehaviour { } public PushReaction getPistonPushReaction() { @@ -170,7 +170,7 @@ index 987a4180a1eb902c512c2e6a36d692cbdd9b1563..e1beb18dfb5529f48c312bf7ff85be18 public boolean isSolidRender(BlockGetter world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -index 80811386c1006d56824ff4d43830f2a140aaee30..2aa59b14b171ff4efbb113816c04675da0954d0e 100644 +index 05150fbade1d5a9b3b6de8ad1f5e825f34d1037e..ed79058696eb26a89b9d4116821840dbad9ea449 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java @@ -210,6 +210,13 @@ public class PortalForcer { diff --git a/patches/server/0429-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0429-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index 72e968dd93..39e16edf1d 100644 --- a/patches/server/0429-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0429-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5592f879ef2c1b8f15bc63b38edb57f19e9d589d..2e127a2eb9b00eabe1f5c9c966e405e280c38756 100644 +index ab0e3059e5d1e012f5c94d18aaebf218470d3be3..e8b68702d7f720ba9d2985984547d0dda9541d41 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1828,9 +1828,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1856,9 +1856,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public void updatePlayer(ServerPlayer player) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (player != this.entity) { diff --git a/patches/server/0437-Fix-piston-physics-inconsistency-MC-188840.patch b/patches/server/0437-Fix-piston-physics-inconsistency-MC-188840.patch index 2c6122ee57..84ffd5bdd4 100644 --- a/patches/server/0437-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/patches/server/0437-Fix-piston-physics-inconsistency-MC-188840.patch @@ -83,11 +83,11 @@ index e9b315fb5a7b466e2ac65ae4ae69e893dd992739..da9ae487799e58b196ebf219a62020d0 } diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index e2ea913f9e5ae2351f10e0ebedba89d2a6e62d96..15b709c73e1685cc903c121949a18b8aa7978a35 100644 +index 78d252b829e5c1f19532656a728620852403760c..613db573cef142e0ab1b24dc994677105a253042 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java @@ -285,7 +285,7 @@ public class PistonMovingBlockEntity extends BlockEntity { - if (blockEntity.movedState != null && world.getBlockState(pos).is(Blocks.MOVING_PISTON)) { + if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) { BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos); if (blockState.isAir()) { - world.setBlock(pos, blockEntity.movedState, 84); diff --git a/patches/server/0445-Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/0445-Ensure-Entity-AABB-s-are-never-invalid.patch index 01374d2106..5d1aa34725 100644 --- a/patches/server/0445-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/patches/server/0445-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 1e23785eb13082037b982886b27c460219f2cb0c..7bf34e0fc2658d56c8515e7acd68c6f36692e451 100644 +index 95fcf31b0ea68312f6c3475c1b4a01ca2b269536..7b6f23136330e14e977dd4fe24b18339ca25be6e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -556,8 +556,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -555,8 +555,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void setPos(double x, double y, double z) { @@ -19,7 +19,7 @@ index 1e23785eb13082037b982886b27c460219f2cb0c..7bf34e0fc2658d56c8515e7acd68c6f3 } protected AABB makeBoundingBox() { -@@ -3771,6 +3771,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3727,6 +3727,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public final void setPosRaw(double x, double y, double z) { @@ -31,7 +31,7 @@ index 1e23785eb13082037b982886b27c460219f2cb0c..7bf34e0fc2658d56c8515e7acd68c6f3 if (this.position.x != x || this.position.y != y || this.position.z != z) { this.position = new Vec3(x, y, z); int i = Mth.floor(x); -@@ -3793,6 +3798,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3749,6 +3754,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } } diff --git a/patches/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 9234b108ea..1ed13d0300 100644 --- a/patches/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0446-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -8,7 +8,7 @@ makes it so that the server keeps the last difficulty used instead of restoring the server.properties every single load. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 22885b3d7931f2e439769cad39a37e8af3b3de54..f7a0976488732e41e197a3a77f20a937d44c7be3 100644 +index 7bac10fca1c44768bb7c93362b331f89afbba702..4351dd9c293d1db48c87c5df28bcb2b9a59583f7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -823,7 +823,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - public ClientboundChatPacket(Component message, ChatType location, UUID sender) { + public ClientboundChatPacket(Component message, ChatType type, UUID sender) { this.message = message; - this.type = location; + this.type = type; - this.sender = sender; + this.sender = sender != null ? sender : net.minecraft.Util.NIL_UUID; } diff --git a/patches/server/0458-Optimize-NibbleArray-to-use-pooled-buffers.patch b/patches/server/0458-Optimize-NibbleArray-to-use-pooled-buffers.patch index e7993e3588..50f950e9e5 100644 --- a/patches/server/0458-Optimize-NibbleArray-to-use-pooled-buffers.patch +++ b/patches/server/0458-Optimize-NibbleArray-to-use-pooled-buffers.patch @@ -9,7 +9,7 @@ an object pool for these. Uses lots of advanced new capabilities of the Paper codebase :) diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java -index 079734654c0fd421561b5f9003cd318bad5787a9..a15dbd37bf810c89b751710537203d6bf1d085bc 100644 +index 7825d6f0fdcfda6212cff8033ec55fb7db236154..2218ddb8d075d042bb7c41886aa9dd2082a5a40f 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java @@ -2,8 +2,11 @@ package net.minecraft.network.protocol.game; @@ -45,7 +45,7 @@ index 079734654c0fd421561b5f9003cd318bad5787a9..a15dbd37bf810c89b751710537203d6b + } + // Paper end + - public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet bitSet, @Nullable BitSet bitSet2, boolean bl) { + public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits, boolean nonEdge) { ChunkPos chunkPos = chunk.getPos(); this.x = chunkPos.x; diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java @@ -256,7 +256,7 @@ index 81701abd11fbc4671393a76a42973f53835ca234..e8cf0088e94925934acd02ba05b9411b public String toString() { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index fdc80d70cf444e9b6d968764e4232f23f3ae9c37..5c21871c7bdfce191db499860725da769dc9caac 100644 +index 0980efbc9ef092f56713c7ef776f78fd89cca818..634e44c3eac516f080b565a3b4c7691e31a3eb38 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -496,11 +496,11 @@ public class ChunkSerializer { diff --git a/patches/server/0461-Add-entity-liquid-API.patch b/patches/server/0461-Add-entity-liquid-API.patch index c714cf7911..12ad8db74f 100644 --- a/patches/server/0461-Add-entity-liquid-API.patch +++ b/patches/server/0461-Add-entity-liquid-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add entity liquid API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7bf34e0fc2658d56c8515e7acd68c6f36692e451..e4dff1ee8329694ed42e4f3c66d896ea32f62747 100644 +index 7b6f23136330e14e977dd4fe24b18339ca25be6e..b61f728c83e006197fdb158e83d04b5498133cc3 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1360,7 +1360,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1314,7 +1314,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return this.isInWater() || this.isInRain(); } diff --git a/patches/server/0462-Update-itemstack-legacy-name-and-lore.patch b/patches/server/0462-Update-itemstack-legacy-name-and-lore.patch index 105db03eec..b98004d198 100644 --- a/patches/server/0462-Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/0462-Update-itemstack-legacy-name-and-lore.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Update itemstack legacy name and lore diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 3d6d48ce4b762091aeee3b4fdd28bd121aaf291b..a18cf051b374cbf294e319b619b7e2fba10a6268 100644 +index 57a9106005413e6767f0fe291c463742ba9afb21..31439467f1730d96712e53a8e27892dfce017c70 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -168,6 +168,44 @@ public final class ItemStack { +@@ -169,6 +169,44 @@ public final class ItemStack { list.sort((Comparator) enchantSorter); // Paper } catch (Exception ignored) {} } @@ -53,7 +53,7 @@ index 3d6d48ce4b762091aeee3b4fdd28bd121aaf291b..a18cf051b374cbf294e319b619b7e2fb // Paper end public ItemStack(ItemLike item) { -@@ -214,6 +252,7 @@ public final class ItemStack { +@@ -215,6 +253,7 @@ public final class ItemStack { this.tag = nbttagcompound.getCompound("tag").copy(); // CraftBukkit end this.processEnchantOrder(this.tag); // Paper diff --git a/patches/server/0483-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0483-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 58ae2fc8e2..78ce2bb7a2 100644 --- a/patches/server/0483-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0483-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index cdacb26699a54659d1e43ec0f73640556a743700..f9daa7183e29d203e73b242c285d10cda44aab11 100644 +index cda574e825164587bd126029d5b556c049c18015..01b4bd2176b751f895e39002f105a171a32d65af 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1688,6 +1688,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1689,6 +1689,7 @@ public class ServerLevel extends Level implements WorldGenLevel { //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); this.levelData.setSpawn(pos, angle); diff --git a/patches/server/0491-PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/0491-PortalCreateEvent-needs-to-know-its-entity.patch index 3909c7026d..d1abf96af1 100644 --- a/patches/server/0491-PortalCreateEvent-needs-to-know-its-entity.patch +++ b/patches/server/0491-PortalCreateEvent-needs-to-know-its-entity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index a18cf051b374cbf294e319b619b7e2fba10a6268..77785840754651b914c069d37a084a60995acd41 100644 +index 31439467f1730d96712e53a8e27892dfce017c70..c5286b3751c58df1b70d9ac01b0497b83c0f917a 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -410,7 +410,7 @@ public final class ItemStack { +@@ -411,7 +411,7 @@ public final class ItemStack { net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition); if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically @@ -79,7 +79,7 @@ index 08bc35b40720ca001d3f6c1185bdd11c61ec9ee1..d8e4fda2d501545e5f891bca317e2aa5 private static int getFireTickDelay(Random random) { diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index e1beb18dfb5529f48c312bf7ff85be18f6c935b5..23662570869de3bb1f6207a7d5104fdaff75163e 100644 +index 9055a82e9c91ecb8fc2ef5ac58db043ffb759168..aba21b3f30e56dc19aa914cc05c1abb364f3f348 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -31,6 +31,7 @@ import net.minecraft.world.item.DyeColor; @@ -90,7 +90,7 @@ index e1beb18dfb5529f48c312bf7ff85be18f6c935b5..23662570869de3bb1f6207a7d5104fda import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.EmptyBlockGetter; import net.minecraft.world.level.Level; -@@ -127,6 +128,12 @@ public abstract class BlockBehaviour { +@@ -132,6 +133,12 @@ public abstract class BlockBehaviour { DebugPackets.sendNeighborsUpdatePacket(world, pos); } @@ -100,9 +100,9 @@ index e1beb18dfb5529f48c312bf7ff85be18f6c935b5..23662570869de3bb1f6207a7d5104fda + this.onPlace(iblockdata, world, blockposition, iblockdata1, flag); + } + // Paper end + /** @deprecated */ @Deprecated public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java index c327308dd0209b952e738a01cc9cefdaece393e4..5d76674d5e181f012c0686e9915556bc93087706 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java diff --git a/patches/server/0496-Cache-block-data-strings.patch b/patches/server/0496-Cache-block-data-strings.patch index 9de33fb7d3..de85a14464 100644 --- a/patches/server/0496-Cache-block-data-strings.patch +++ b/patches/server/0496-Cache-block-data-strings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache block data strings diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f7a0976488732e41e197a3a77f20a937d44c7be3..461ee423bfdcc63267f32f2b29ed9d87b1423f8c 100644 +index 4351dd9c293d1db48c87c5df28bcb2b9a59583f7..fe8b825adfa3f7ed5c85e238ef93e46908ca88ae 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1960,6 +1960,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= level; } -@@ -1563,6 +1564,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1517,6 +1518,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public void moveTo(double x, double y, double z, float yaw, float pitch) { @@ -57,7 +57,7 @@ index e4dff1ee8329694ed42e4f3c66d896ea32f62747..8ec0a2ca0e1aa2e31c73df6ddb6b626d this.setYRot(yaw); this.setXRot(pitch); diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index dba24bb35085a14a3780c10762f229eb40f84ef9..135abdd46561cfdcb2186c5872802fdcedc86359 100644 +index c0f33a6cb4812e13204552c125df06210adc7196..03726227fdd60e9cf77213d50184abff438e01ef 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -161,6 +161,7 @@ public abstract class BaseSpawner { diff --git a/patches/server/0502-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0502-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index bb18548c24..e59c48e559 100644 --- a/patches/server/0502-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0502-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8ec0a2ca0e1aa2e31c73df6ddb6b626d386797d8..41acc6d9e5b01526a2f0d5fa68b2913eb2e97cc2 100644 +index a7dfb3e53b3618b7071ee9840906debade1c5f83..b5d3032ce9f711ff2843b2c22ad2b4aa2c147504 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3971,4 +3971,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3927,4 +3927,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i void accept(Entity entity, double x, double y, double z); } @@ -21,7 +21,7 @@ index 8ec0a2ca0e1aa2e31c73df6ddb6b626d386797d8..41acc6d9e5b01526a2f0d5fa68b2913e + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index b3afb10f96e0662714ff89244132a6df8bbd3769..e28bb9f0f27d2d7347f48891256ac8225e1e1459 100644 +index 1380df5f70f9284b47b9e6426672d82df384b2c0..33b85d2cd6be32d70a9621c02666e297fc78ff97 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -466,6 +466,10 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0504-Entity-isTicking.patch b/patches/server/0504-Entity-isTicking.patch index 7ff91b0975..e05036d875 100644 --- a/patches/server/0504-Entity-isTicking.patch +++ b/patches/server/0504-Entity-isTicking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 41acc6d9e5b01526a2f0d5fa68b2913eb2e97cc2..00b179d9d1a0fb1f081dd0e6f160641ce1c1caa4 100644 +index b5d3032ce9f711ff2843b2c22ad2b4aa2c147504..a6ca13b92b81f5fe7a8d9d65476b0e032a8a029b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -52,6 +52,7 @@ import net.minecraft.network.syncher.SynchedEntityData; @@ -16,7 +16,7 @@ index 41acc6d9e5b01526a2f0d5fa68b2913eb2e97cc2..00b179d9d1a0fb1f081dd0e6f160641c import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.TicketType; -@@ -3976,5 +3977,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3932,5 +3933,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public static int nextEntityId() { return ENTITY_COUNTER.incrementAndGet(); } diff --git a/patches/server/0505-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch b/patches/server/0505-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch index a0cd11b301..df40c8c339 100644 --- a/patches/server/0505-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch +++ b/patches/server/0505-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 461ee423bfdcc63267f32f2b29ed9d87b1423f8c..c739e90c4f015aea555c455e336e079a59c948bb 100644 +index fe8b825adfa3f7ed5c85e238ef93e46908ca88ae..d12c154f6110854c8ca9268edadab14b97c46d51 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2026,13 +2026,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop map = positions.stream().collect(Collectors.toMap((blockPos) -> { -- return this.nodeEvaluator.getGoal((double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ()); +- Map map = positions.stream().collect(Collectors.toMap((pos) -> { +- return this.nodeEvaluator.getGoal((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()); - }, Function.identity())); + // Paper start - remove streams - and optimize collection + List> map = Lists.newArrayList(); diff --git a/patches/server/0534-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0534-Climbing-should-not-bypass-cramming-gamerule.patch index b39c79a1eb..3b767d04a4 100644 --- a/patches/server/0534-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0534-Climbing-should-not-bypass-cramming-gamerule.patch @@ -21,10 +21,10 @@ index 5c22b8993385c1e6c72fe1fbd5f14c76253eec74..0759b9dbd37ca640b7fe410e0ecb6519 private void keepLoadedRange() { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 00b179d9d1a0fb1f081dd0e6f160641ce1c1caa4..12d9316863b6298960aedeecd08366f2e80c0acc 100644 +index a6ca13b92b81f5fe7a8d9d65476b0e032a8a029b..e12eb951d52d4bfa30e1d25139444d7663d3b946 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1744,6 +1744,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1698,6 +1698,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public boolean isPushable() { @@ -61,7 +61,7 @@ index 22f36cd3df49160f1b6668befdd05c2268edaa49..e39965c2e50bc8ee424ea07819346e06 } else if (entity.level.isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) { return false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2e02fc6d9c54bd246602b8535553dd04c4e26679..de90fc7af633576a33b0d35715c3cb68bb9f5b21 100644 +index 8fa36430da31346caa0fb1fc0b376d62bd6e247a..81df34945237ccb78fc4e2c97f78ccfeaa947637 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3276,7 +3276,7 @@ public abstract class LivingEntity extends Entity { diff --git a/patches/server/0540-MC-4-Fix-item-position-desync.patch b/patches/server/0540-MC-4-Fix-item-position-desync.patch index b6a7a22c50..5cd5c2de45 100644 --- a/patches/server/0540-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0540-MC-4-Fix-item-position-desync.patch @@ -43,10 +43,10 @@ index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f9 public Vec3 updateEntityPosition(Vec3 orig) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 12d9316863b6298960aedeecd08366f2e80c0acc..edd4246bf40a881f117b60d632f2e5f7937331e0 100644 +index e12eb951d52d4bfa30e1d25139444d7663d3b946..b3ba775d4c4674dc8cd85145cacf9ca93737fe04 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3790,6 +3790,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -3746,6 +3746,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i } public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) { // Paper end diff --git a/patches/server/0561-Added-ServerResourcesReloadedEvent.patch b/patches/server/0561-Added-ServerResourcesReloadedEvent.patch index 905665c4a9..226c8cc460 100644 --- a/patches/server/0561-Added-ServerResourcesReloadedEvent.patch +++ b/patches/server/0561-Added-ServerResourcesReloadedEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c739e90c4f015aea555c455e336e079a59c948bb..ad1e731900973deebdc363f34c4cf72058e4363d 100644 +index d12c154f6110854c8ca9268edadab14b97c46d51..36e59108d8939ea0c4dfbe5a24ff72b42a7f7216 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1939,7 +1939,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop completablefuture = CompletableFuture.supplyAsync(() -> { Stream stream = datapacks.stream(); // CraftBukkit - decompile error PackRepository resourcepackrepository = this.packRepository; -@@ -1955,6 +1961,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { this.getServer().execute(() -> { diff --git a/patches/server/0573-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0573-Collision-option-for-requiring-a-player-participant.patch index 9c60d0dedd..729ab5d3d0 100644 --- a/patches/server/0573-Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/0573-Collision-option-for-requiring-a-player-participant.patch @@ -28,10 +28,10 @@ index 4d723f5327a64cd8257bab502ae59a35b4a35cc1..e8f5ad4925b4d02bf79f9f56d0dac3f0 public int wanderingTraderSpawnDayTicks = 24000; public int wanderingTraderSpawnChanceFailureIncrement = 25; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index edd4246bf40a881f117b60d632f2e5f7937331e0..dd0ae211bff6edce71a37280f2f916892dbda49a 100644 +index b3ba775d4c4674dc8cd85145cacf9ca93737fe04..392b2745821077d4d3a99872a8b4d50da305c97c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1627,6 +1627,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i +@@ -1581,6 +1581,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i public void push(Entity entity) { if (!this.isPassengerOfSameVehicle(entity)) { if (!entity.noPhysics && !this.noPhysics) { diff --git a/patches/server/0584-Skip-distance-map-update-when-spawning-disabled.patch b/patches/server/0584-Skip-distance-map-update-when-spawning-disabled.patch index 4fed4a0c9a..4811e70599 100644 --- a/patches/server/0584-Skip-distance-map-update-when-spawning-disabled.patch +++ b/patches/server/0584-Skip-distance-map-update-when-spawning-disabled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Skip distance map update when spawning disabled. diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index d56eb5071ed3ae2b9d5636cafb3aca9b2cd71d15..46a43cd457ee39463e1bd79880e8391f60c06a52 100644 +index a66d9d6df1fc0ad68f51ea96d4e1a2d725c73b05..f716fea06702f21f1aaf0aefcc5b3ea170d2013d 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -891,7 +891,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -893,7 +893,7 @@ public class ServerChunkCache extends ChunkSource { int l = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - per player mob spawning NaturalSpawner.SpawnState spawnercreature_d; // moved down diff --git a/patches/server/0614-forced-whitelist-use-configurable-kick-message.patch b/patches/server/0614-forced-whitelist-use-configurable-kick-message.patch index 1be883768c..6727d3ef15 100644 --- a/patches/server/0614-forced-whitelist-use-configurable-kick-message.patch +++ b/patches/server/0614-forced-whitelist-use-configurable-kick-message.patch @@ -5,7 +5,7 @@ Subject: [PATCH] forced whitelist: use configurable kick message diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6694e0d6d7d8d60f54ea1a2d2dcb5a8894b5b4b9..478eb61a9e5aab8b004e75c264eca9ca79e51fbb 100644 +index 07b04d6fec9bd7615129ba6bd4fd465cb4bc1e84..877863aace3df7f50c6ad054023445bf09b1cef3 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -73,7 +73,6 @@ import net.minecraft.nbt.NbtOps; @@ -16,7 +16,7 @@ index 6694e0d6d7d8d60f54ea1a2d2dcb5a8894b5b4b9..478eb61a9e5aab8b004e75c264eca9ca import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket; import net.minecraft.network.protocol.game.ClientboundSetTimePacket; import net.minecraft.network.protocol.status.ServerStatus; -@@ -2042,7 +2041,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop