From 838d8afd76efe0591d9d0e3bb193112b1e7f08a8 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 7 Jun 2023 23:14:56 +0200 Subject: [PATCH] More more more more more more more more work --- patches/server/0010-Adventure.patch | 12 +- ...e-Oversized-Tile-Entities-in-chunks.patch} | 2 +- ...ggleEvent-when-whitelist-is-toggled.patch} | 4 +- .../0295-Entity-getEntitySpawnReason.patch} | 24 ++-- .../0296-Fire-event-on-GS4-query.patch} | 0 ...97-Implement-PlayerPostRespawnEvent.patch} | 8 +- ...for-pickupDelay-breaks-picking-up-i.patch} | 2 +- .../0299-Server-Tick-Events.patch} | 6 +- ...300-PlayerDeathEvent-getItemsToKeep.patch} | 6 +- ...Optimize-Captured-TileEntity-Lookup.patch} | 6 +- .../0302-Add-Heightmap-API.patch} | 2 +- .../0303-Mob-Spawner-API-Enhancements.patch} | 8 +- ...-to-changed-postToMainThread-method.patch} | 2 +- ...-item-frames-are-modified-MC-123450.patch} | 4 +- ...0306-Implement-CraftBlockSoundGroup.patch} | 2 +- ...e-Keep-Spawn-Loaded-range-per-world.patch} | 25 ++--- ...08-Allow-Saving-of-Oversized-Chunks.patch} | 20 ++-- ...09-Expose-the-internal-current-tick.patch} | 4 +- ...10-Fix-World-isChunkGenerated-calls.patch} | 30 +++-- ...te-location-if-we-failed-to-read-it.patch} | 0 ...l-Spawned-mobs-towards-natural-spaw.patch} | 0 ...urable-projectile-relative-velocity.patch} | 8 +- .../0314-offset-item-frame-ticking.patch} | 4 +- .../0315-Fix-MC-158900.patch} | 4 +- ...event-consuming-the-wrong-itemstack.patch} | 26 ++--- ...17-Dont-send-unnecessary-sign-update.patch | 18 +++ ...-option-to-disable-pillager-patrols.patch} | 0 ...319-Flat-bedrock-generator-settings.patch} | 8 +- ...k-loads-when-villagers-try-to-find-.patch} | 0 ...656-Fix-Follow-Range-Initial-Target.patch} | 4 +- .../0322-Duplicate-UUID-Resolve-Option.patch} | 16 +-- ...ayerDeathEvent-shouldDropExperience.patch} | 4 +- ...ading-chunks-checking-hive-position.patch} | 8 +- ...hunks-from-Hoppers-and-other-things.patch} | 0 ...timise-EntityGetter-getPlayerByUUID.patch} | 8 +- ...327-Fix-items-not-falling-correctly.patch} | 10 +- ...ize-call-to-getFluid-for-explosions.patch} | 2 +- ...-in-stack-not-having-effects-when-d.patch} | 4 +- .../0330-Entity-Activation-Range-2.0.patch} | 104 +++++++++--------- ...26-Dont-send-unnecessary-sign-update.patch | 18 --- 40 files changed, 199 insertions(+), 214 deletions(-) rename patches/{unapplied/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch => server/0293-Handle-Oversized-Tile-Entities-in-chunks.patch} (97%) rename patches/{unapplied/server/0303-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch => server/0294-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch} (82%) rename patches/{unapplied/server/0304-Entity-getEntitySpawnReason.patch => server/0295-Entity-getEntitySpawnReason.patch} (87%) rename patches/{unapplied/server/0305-Fire-event-on-GS4-query.patch => server/0296-Fire-event-on-GS4-query.patch} (100%) rename patches/{unapplied/server/0306-Implement-PlayerPostRespawnEvent.patch => server/0297-Implement-PlayerPostRespawnEvent.patch} (86%) rename patches/{unapplied/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch => server/0298-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch} (94%) rename patches/{unapplied/server/0308-Server-Tick-Events.patch => server/0299-Server-Tick-Events.patch} (85%) rename patches/{unapplied/server/0309-PlayerDeathEvent-getItemsToKeep.patch => server/0300-PlayerDeathEvent-getItemsToKeep.patch} (92%) rename patches/{unapplied/server/0310-Optimize-Captured-TileEntity-Lookup.patch => server/0301-Optimize-Captured-TileEntity-Lookup.patch} (78%) rename patches/{unapplied/server/0311-Add-Heightmap-API.patch => server/0302-Add-Heightmap-API.patch} (95%) rename patches/{unapplied/server/0312-Mob-Spawner-API-Enhancements.patch => server/0303-Mob-Spawner-API-Enhancements.patch} (95%) rename patches/{unapplied/server/0313-Fix-CB-call-to-changed-postToMainThread-method.patch => server/0304-Fix-CB-call-to-changed-postToMainThread-method.patch} (91%) rename patches/{unapplied/server/0314-Fix-sounds-when-item-frames-are-modified-MC-123450.patch => server/0305-Fix-sounds-when-item-frames-are-modified-MC-123450.patch} (85%) rename patches/{unapplied/server/0315-Implement-CraftBlockSoundGroup.patch => server/0306-Implement-CraftBlockSoundGroup.patch} (96%) rename patches/{unapplied/server/0316-Configurable-Keep-Spawn-Loaded-range-per-world.patch => server/0307-Configurable-Keep-Spawn-Loaded-range-per-world.patch} (91%) rename patches/{unapplied/server/0317-Allow-Saving-of-Oversized-Chunks.patch => server/0308-Allow-Saving-of-Oversized-Chunks.patch} (93%) rename patches/{unapplied/server/0318-Expose-the-internal-current-tick.patch => server/0309-Expose-the-internal-current-tick.patch} (83%) rename patches/{unapplied/server/0319-Fix-World-isChunkGenerated-calls.patch => server/0310-Fix-World-isChunkGenerated-calls.patch} (90%) rename patches/{unapplied/server/0320-Show-blockstate-location-if-we-failed-to-read-it.patch => server/0311-Show-blockstate-location-if-we-failed-to-read-it.patch} (100%) rename patches/{unapplied/server/0321-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch => server/0312-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch} (100%) rename patches/{unapplied/server/0322-Configurable-projectile-relative-velocity.patch => server/0313-Configurable-projectile-relative-velocity.patch} (87%) rename patches/{unapplied/server/0323-offset-item-frame-ticking.patch => server/0314-offset-item-frame-ticking.patch} (84%) rename patches/{unapplied/server/0324-Fix-MC-158900.patch => server/0315-Fix-MC-158900.patch} (90%) rename patches/{unapplied/server/0325-Prevent-consuming-the-wrong-itemstack.patch => server/0316-Prevent-consuming-the-wrong-itemstack.patch} (63%) create mode 100644 patches/server/0317-Dont-send-unnecessary-sign-update.patch rename patches/{unapplied/server/0327-Add-option-to-disable-pillager-patrols.patch => server/0318-Add-option-to-disable-pillager-patrols.patch} (100%) rename patches/{unapplied/server/0328-Flat-bedrock-generator-settings.patch => server/0319-Flat-bedrock-generator-settings.patch} (98%) rename patches/{unapplied/server/0329-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch => server/0320-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch} (100%) rename patches/{unapplied/server/0330-MC-145656-Fix-Follow-Range-Initial-Target.patch => server/0321-MC-145656-Fix-Follow-Range-Initial-Target.patch} (93%) rename patches/{unapplied/server/0331-Duplicate-UUID-Resolve-Option.patch => server/0322-Duplicate-UUID-Resolve-Option.patch} (91%) rename patches/{unapplied/server/0332-PlayerDeathEvent-shouldDropExperience.patch => server/0323-PlayerDeathEvent-shouldDropExperience.patch} (85%) rename patches/{unapplied/server/0333-Prevent-bees-loading-chunks-checking-hive-position.patch => server/0324-Prevent-bees-loading-chunks-checking-hive-position.patch} (61%) rename patches/{unapplied/server/0334-Don-t-load-Chunks-from-Hoppers-and-other-things.patch => server/0325-Don-t-load-Chunks-from-Hoppers-and-other-things.patch} (100%) rename patches/{unapplied/server/0336-Optimise-EntityGetter-getPlayerByUUID.patch => server/0326-Optimise-EntityGetter-getPlayerByUUID.patch} (79%) rename patches/{unapplied/server/0337-Fix-items-not-falling-correctly.patch => server/0327-Fix-items-not-falling-correctly.patch} (77%) rename patches/{unapplied/server/0339-Optimize-call-to-getFluid-for-explosions.patch => server/0328-Optimize-call-to-getFluid-for-explosions.patch} (91%) rename patches/{unapplied/server/0340-Fix-last-firework-in-stack-not-having-effects-when-d.patch => server/0329-Fix-last-firework-in-stack-not-having-effects-when-d.patch} (90%) rename patches/{unapplied/server/0341-Entity-Activation-Range-2.0.patch => server/0330-Entity-Activation-Range-2.0.patch} (92%) delete mode 100644 patches/unapplied/server/0326-Dont-send-unnecessary-sign-update.patch diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 6e21af8f59..6eeb09074f 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -2793,18 +2793,10 @@ index 4c62df5a3781ec9df4a5c5f1b528649e6e8a62d1..affd1b8c7589ba59330dc0b6fc803cce } diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index 8e35fecb84fb9ed61cb31d218f8a21bb7cabeb48..41c863a104d53b6c6feb4576d5b62cead229efec 100644 +index 8e35fecb84fb9ed61cb31d218f8a21bb7cabeb48..584feb744bd2aa34f788de17d43c16a04c33a2c6 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -185,6 +185,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C - this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3); - } else { - SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString()); -+ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper - ((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit - } - } -@@ -208,20 +209,22 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C +@@ -208,20 +208,22 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C // CraftBukkit start Player player1 = ((ServerPlayer) player).getBukkitEntity(); diff --git a/patches/unapplied/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/server/0293-Handle-Oversized-Tile-Entities-in-chunks.patch similarity index 97% rename from patches/unapplied/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch rename to patches/server/0293-Handle-Oversized-Tile-Entities-in-chunks.patch index 9e46199694..aec3766df7 100644 --- a/patches/unapplied/server/0302-Handle-Oversized-Tile-Entities-in-chunks.patch +++ b/patches/server/0293-Handle-Oversized-Tile-Entities-in-chunks.patch @@ -47,7 +47,7 @@ index f47eeb70661661610ef1a96dd9da67785825c126..0ef3e9b472e35bd2572b04722781abf7 } 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 aee73c4e20aff9bd0a560dc891f74f4f601c24b6..7825d6f0fdcfda6212cff8033ec55fb7db236154 100644 +index 26e46d751c8f8162c2bafe2fc109fc91dc4b7c0f..ff42a3e76500ad6e087b7f1cd6ec45acde124180 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java @@ -57,4 +57,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet { @@ -47,7 +47,7 @@ index 9f855fcbc9be12f7542557e1c32248748fad14c3..e261521d526cb2192761a0432b28f82c }); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 55658cdb2b5aca0bfebefc7fcec36aefe5f42e7b..7288d6d7f08b2e6b9696948d6c4451f479e419b6 100644 +index 53559c8cbf6df35255cb231b5eaa6cd4d940bd84..08fa8e64af8074523c6e9478b443af38a97de65e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -234,6 +234,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -58,7 +58,7 @@ index 55658cdb2b5aca0bfebefc7fcec36aefe5f42e7b..7288d6d7f08b2e6b9696948d6c4451f4 public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper private CraftEntity bukkitEntity; -@@ -2062,6 +2063,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2129,6 +2130,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -68,7 +68,7 @@ index 55658cdb2b5aca0bfebefc7fcec36aefe5f42e7b..7288d6d7f08b2e6b9696948d6c4451f4 // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); -@@ -2208,6 +2212,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2275,6 +2279,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -96,10 +96,10 @@ index 55658cdb2b5aca0bfebefc7fcec36aefe5f42e7b..7288d6d7f08b2e6b9696948d6c4451f4 } 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 405f36e9e115ad44bb91aad885785761786204ca..091c72b95e3c4c3528812ace4aec64d451f25462 100644 +index b5d605feff68181269f23d95d60a3ed555133d85..44b5b5cadad39cb20a44d7b1b73764568ac72f98 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -185,6 +185,7 @@ public abstract class BaseSpawner { +@@ -186,6 +186,7 @@ public abstract class BaseSpawner { // Spigot End } entity.spawnedViaMobSpawner = true; // Paper @@ -108,7 +108,7 @@ index 405f36e9e115ad44bb91aad885785761786204ca..091c72b95e3c4c3528812ace4aec64d4 // Spigot Start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index c69f5192f11f8bf080d752971264a01bdb91a30f..02ef4c66b18edd2138a92b609f837664ec20a559 100644 +index 18967257c5c217868a5356369e3e3b200044aa39..5d8532bc2c4253aa3941ff8c4d48cc8c3860b3b0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1303,5 +1303,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/unapplied/server/0305-Fire-event-on-GS4-query.patch b/patches/server/0296-Fire-event-on-GS4-query.patch similarity index 100% rename from patches/unapplied/server/0305-Fire-event-on-GS4-query.patch rename to patches/server/0296-Fire-event-on-GS4-query.patch diff --git a/patches/unapplied/server/0306-Implement-PlayerPostRespawnEvent.patch b/patches/server/0297-Implement-PlayerPostRespawnEvent.patch similarity index 86% rename from patches/unapplied/server/0306-Implement-PlayerPostRespawnEvent.patch rename to patches/server/0297-Implement-PlayerPostRespawnEvent.patch index b2b7f01c14..5570de33d3 100644 --- a/patches/unapplied/server/0306-Implement-PlayerPostRespawnEvent.patch +++ b/patches/server/0297-Implement-PlayerPostRespawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e261521d526cb2192761a0432b28f82c83258540..9ea6ee5a04c14a2d1b178c36d34b118a43fa05b0 100644 +index a01f2f56fb8cd10475b7e42d0c7f75d0bc49c64a..405d574f9515c8239faf1e7f996446fbb2c66e11 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -751,9 +751,14 @@ public abstract class PlayerList { +@@ -758,9 +758,14 @@ public abstract class PlayerList { boolean flag2 = false; @@ -24,7 +24,7 @@ index e261521d526cb2192761a0432b28f82c83258540..9ea6ee5a04c14a2d1b178c36d34b118a ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension()); if (worldserver1 != null) { Optional optional; -@@ -805,6 +810,7 @@ public abstract class PlayerList { +@@ -812,6 +817,7 @@ public abstract class PlayerList { location = respawnEvent.getRespawnLocation(); if (!flag) entityplayer.reset(); // SPIGOT-4785 @@ -32,7 +32,7 @@ index e261521d526cb2192761a0432b28f82c83258540..9ea6ee5a04c14a2d1b178c36d34b118a } else { location.setWorld(worldserver.getWorld()); } -@@ -864,6 +870,13 @@ public abstract class PlayerList { +@@ -871,6 +877,13 @@ public abstract class PlayerList { if (entityplayer.connection.isDisconnected()) { this.save(entityplayer); } diff --git a/patches/unapplied/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/patches/server/0298-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch similarity index 94% rename from patches/unapplied/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch rename to patches/server/0298-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch index 075001f79d..6582099535 100644 --- a/patches/unapplied/server/0307-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch +++ b/patches/server/0298-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch @@ -6,7 +6,7 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items vanilla checks for == 0 diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 298dff12c511e8b767d5a7ee14f94fe0745e5338..007625b1a121f1e7241f7cbfba0b1f168e8be5df 100644 +index 04b4c7af20d6aa9924fb1d345f11cb51dcadc708..6938f996e7e6d394a54ef6dda2e09acb2021d87f 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -121,6 +121,7 @@ public class ItemEntity extends Entity implements TraceableEntity { diff --git a/patches/unapplied/server/0308-Server-Tick-Events.patch b/patches/server/0299-Server-Tick-Events.patch similarity index 85% rename from patches/unapplied/server/0308-Server-Tick-Events.patch rename to patches/server/0299-Server-Tick-Events.patch index 58307fa4aa..49fa329bc2 100644 --- a/patches/unapplied/server/0308-Server-Tick-Events.patch +++ b/patches/server/0299-Server-Tick-Events.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events Fires event at start and end of a server tick diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d11ba8d081861b852bf74662d5e963ac89c226ca..b647007dc94e2ea416ce4dc659c8b2d623426979 100644 +index 04b4173d33fc56e3ad3d958e7ffad967d4890bf0..9afe3e4af44ee0c648fcb8bd115809e358f07273 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1309,6 +1309,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> readChunk(ChunkPos chunkPos) { - return this.read(chunkPos).thenApplyAsync((optional) -> { @@ -28,7 +28,7 @@ index 27b646341bdae8918649c5e9fdf05708638ad835..299c7c60edf491cc44e609517474d824 } // CraftBukkit start -@@ -685,6 +689,63 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1181,6 +1185,63 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // CraftBukkit end } @@ -93,11 +93,11 @@ index 27b646341bdae8918649c5e9fdf05708638ad835..299c7c60edf491cc44e609517474d824 // Spigot start return this.anyPlayerCloseEnoughForSpawning(pos, false); 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 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fecbad81d77 100644 +index a628dd4a380b5c5089ad528fadf12d7036258a25..307cfa108c9ccb2012327910f8fe31b6a155761a 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 -@@ -51,6 +51,30 @@ public class RegionFile implements AutoCloseable { - public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(true); // Paper +@@ -50,6 +50,30 @@ public class RegionFile implements AutoCloseable { + protected final RegionBitmap usedSectors; public final Path regionFile; // Paper + // Paper start - Cache chunk status @@ -127,7 +127,7 @@ index 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fec public RegionFile(Path file, Path directory, boolean dsync) throws IOException { this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); } -@@ -398,6 +422,7 @@ public class RegionFile implements AutoCloseable { +@@ -397,11 +421,13 @@ public class RegionFile implements AutoCloseable { return this.getOffset(pos) != 0; } @@ -135,19 +135,17 @@ index 584985272a02eb5b61a22cf2404fbd97a55a3358..cda87a66fe80bf910f629c64e36c1fec private static int getOffsetIndex(ChunkPos pos) { return pos.getRegionLocalX() + pos.getRegionLocalZ() * 32; } -@@ -408,6 +433,7 @@ public class RegionFile implements AutoCloseable { - synchronized (this) { - try { - // Paper end + + public void close() throws IOException { + this.closed = true; // Paper try { this.padToFullSector(); } finally { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 8f729134d8f024678f3f5927059791e28ccb5b90..b294ef87fb93e7f4651dc04128124f297575860d 100644 +index b7a73c0d56e547db46f86a5d13cf6f1ee6cd3d09..867755f9a2c1245f9e3ec0028abee4b798c8b2d4 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -249,6 +249,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -212,6 +212,7 @@ public class RegionFileStorage implements AutoCloseable { try { NbtIo.write(nbt, (DataOutput) dataoutputstream); @@ -156,7 +154,7 @@ index 8f729134d8f024678f3f5927059791e28ccb5b90..b294ef87fb93e7f4651dc04128124f29 } catch (Throwable throwable) { if (dataoutputstream != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 901799f0d222b2f1934436467e73ff80c26aef4a..87efc9c4d63b7c413b37f1a1a58100bf17615509 100644 +index 3a052597cacb898d6fc76b52ea984e5f2a534a6b..76054a4fc036b1f9577aa8da215388c5137f3611 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -308,9 +308,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -185,7 +183,7 @@ index 901799f0d222b2f1934436467e73ff80c26aef4a..87efc9c4d63b7c413b37f1a1a58100bf throw new RuntimeException(ex); } } -@@ -424,20 +438,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -421,20 +435,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot diff --git a/patches/unapplied/server/0320-Show-blockstate-location-if-we-failed-to-read-it.patch b/patches/server/0311-Show-blockstate-location-if-we-failed-to-read-it.patch similarity index 100% rename from patches/unapplied/server/0320-Show-blockstate-location-if-we-failed-to-read-it.patch rename to patches/server/0311-Show-blockstate-location-if-we-failed-to-read-it.patch diff --git a/patches/unapplied/server/0321-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/patches/server/0312-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch similarity index 100% rename from patches/unapplied/server/0321-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch rename to patches/server/0312-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch diff --git a/patches/unapplied/server/0322-Configurable-projectile-relative-velocity.patch b/patches/server/0313-Configurable-projectile-relative-velocity.patch similarity index 87% rename from patches/unapplied/server/0322-Configurable-projectile-relative-velocity.patch rename to patches/server/0313-Configurable-projectile-relative-velocity.patch index ca5ee9c66e..2bdc731feb 100644 --- a/patches/unapplied/server/0322-Configurable-projectile-relative-velocity.patch +++ b/patches/server/0313-Configurable-projectile-relative-velocity.patch @@ -25,15 +25,15 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this server-internal fix makes this change future-proof. diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index a85175190c1ebb14b496a0bfe2f7136e06d0072c..ae0e422ee7e1dcf01b4c7b64b23afdbbbe19819e 100644 +index e5da57b35cd82ee7b4e844cfe74289a71d38779a..62b111b83dedd145d678e592b9ffdc286bfb7486 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -@@ -164,7 +164,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -165,7 +165,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { this.shoot((double) f5, (double) f6, (double) f7, speed, divergence); Vec3 vec3d = shooter.getDeltaMovement(); -- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); -+ if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity +- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); ++ if (!shooter.level.paperConfig().misc.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity } // CraftBukkit start - call projectile hit event diff --git a/patches/unapplied/server/0323-offset-item-frame-ticking.patch b/patches/server/0314-offset-item-frame-ticking.patch similarity index 84% rename from patches/unapplied/server/0323-offset-item-frame-ticking.patch rename to patches/server/0314-offset-item-frame-ticking.patch index b9d4075476..fadad91d8e 100644 --- a/patches/unapplied/server/0323-offset-item-frame-ticking.patch +++ b/patches/server/0314-offset-item-frame-ticking.patch @@ -5,10 +5,10 @@ Subject: [PATCH] offset item frame ticking diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java -index 46946473713f08ef0304a49b017a8970f1957e88..f7d031e9a5aa533d78a49ed6147dd47dd0f27f01 100644 +index 760e9e96cb567861f40a0b3debb58dc867be4026..d19bf87596e574150c7ebd58c9a132363f5f1e54 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java -@@ -39,7 +39,7 @@ public abstract class HangingEntity extends Entity { +@@ -38,7 +38,7 @@ public abstract class HangingEntity extends Entity { protected static final Predicate HANGING_ENTITY = (entity) -> { return entity instanceof HangingEntity; }; diff --git a/patches/unapplied/server/0324-Fix-MC-158900.patch b/patches/server/0315-Fix-MC-158900.patch similarity index 90% rename from patches/unapplied/server/0324-Fix-MC-158900.patch rename to patches/server/0315-Fix-MC-158900.patch index ad116d0439..b960c79d1f 100644 --- a/patches/unapplied/server/0324-Fix-MC-158900.patch +++ b/patches/server/0315-Fix-MC-158900.patch @@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it was expired at that point, then it would be null. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9ea6ee5a04c14a2d1b178c36d34b118a43fa05b0..4efa85f9c18927248dc2397df0bd3cd0a9063347 100644 +index 405d574f9515c8239faf1e7f996446fbb2c66e11..94fbe7f2b0f18c3a533de3a4e486e985aa6f5153 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -635,8 +635,10 @@ public abstract class PlayerList { +@@ -642,8 +642,10 @@ public abstract class PlayerList { Player player = entity.getBukkitEntity(); PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress()); diff --git a/patches/unapplied/server/0325-Prevent-consuming-the-wrong-itemstack.patch b/patches/server/0316-Prevent-consuming-the-wrong-itemstack.patch similarity index 63% rename from patches/unapplied/server/0325-Prevent-consuming-the-wrong-itemstack.patch rename to patches/server/0316-Prevent-consuming-the-wrong-itemstack.patch index b1da08344d..2583fe14a9 100644 --- a/patches/unapplied/server/0325-Prevent-consuming-the-wrong-itemstack.patch +++ b/patches/server/0316-Prevent-consuming-the-wrong-itemstack.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent consuming the wrong itemstack diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 69fbbd2745008e2d9caf6a30dd0779339e1c685b..5eaedecd2e53bcdc30defbf56d6a70a0c49f03ec 100644 +index 724e4a870d0bbe4c1895ea6a745972ebdd9f5c52..f565b9a3643d0b457d10cc8a909aa975994f77fc 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3609,9 +3609,14 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3658,9 +3658,14 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void startUsingItem(InteractionHand hand) { @@ -23,23 +23,23 @@ index 69fbbd2745008e2d9caf6a30dd0779339e1c685b..5eaedecd2e53bcdc30defbf56d6a70a0 + if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag this.useItem = itemstack; this.useItemRemaining = itemstack.getUseDuration(); - if (!this.level.isClientSide) { -@@ -3691,6 +3696,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + if (!this.level().isClientSide) { +@@ -3740,6 +3745,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.releaseUsingItem(); } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { -+ this.startUsingItem(this.getUsedItemHand(), true); // Paper ++ this.startUsingItem(this.getUsedItemHand(), true); // Paper this.triggerItemUseEffects(this.useItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; -@@ -3726,8 +3732,8 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3774,8 +3780,8 @@ public abstract class LivingEntity extends Entity implements Attackable { } 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)) { -+ // Paper start -+ if (this instanceof ServerPlayer) { - ((ServerPlayer) this).getBukkitEntity().updateInventory(); - } - // Paper end +- // 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)) { ++ // Paper start ++ if (this instanceof ServerPlayer) { + ((ServerPlayer) this).getBukkitEntity().updateInventory(); + } + // Paper end diff --git a/patches/server/0317-Dont-send-unnecessary-sign-update.patch b/patches/server/0317-Dont-send-unnecessary-sign-update.patch new file mode 100644 index 0000000000..b5b27d8cc7 --- /dev/null +++ b/patches/server/0317-Dont-send-unnecessary-sign-update.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Sat, 11 Sep 2021 11:56:51 +0200 +Subject: [PATCH] Dont send unnecessary sign update + + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +index 584feb744bd2aa34f788de17d43c16a04c33a2c6..41c863a104d53b6c6feb4576d5b62cead229efec 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +@@ -185,6 +185,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C + this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3); + } else { + SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString()); ++ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper + ((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit + } + } diff --git a/patches/unapplied/server/0327-Add-option-to-disable-pillager-patrols.patch b/patches/server/0318-Add-option-to-disable-pillager-patrols.patch similarity index 100% rename from patches/unapplied/server/0327-Add-option-to-disable-pillager-patrols.patch rename to patches/server/0318-Add-option-to-disable-pillager-patrols.patch diff --git a/patches/unapplied/server/0328-Flat-bedrock-generator-settings.patch b/patches/server/0319-Flat-bedrock-generator-settings.patch similarity index 98% rename from patches/unapplied/server/0328-Flat-bedrock-generator-settings.patch rename to patches/server/0319-Flat-bedrock-generator-settings.patch index 8b5133e435..4e8dc82420 100644 --- a/patches/unapplied/server/0328-Flat-bedrock-generator-settings.patch +++ b/patches/server/0319-Flat-bedrock-generator-settings.patch @@ -114,11 +114,11 @@ index 06e1774dfbb667aca69bc30c9675ed472cb5728c..1d5bc86516df3781aea894c3afd34042 public static SurfaceRules.RuleSource end() { diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java -index ac2b7b5161eaaca3620268ae865d6f2a80227fde..a1192d1f6b99669f843e8d9a8928ff0e8c030559 100644 +index e6e2c63b19d010569fb70b629188be3eec28025d..e2393e31a008c78e7a593c1e36fc7fd40a443c73 100644 --- a/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java -@@ -71,6 +71,7 @@ public class Bootstrap { - CauldronInteraction.bootStrap(); +@@ -79,6 +79,7 @@ public class Bootstrap { + BuiltInRegistries.bootStrap(); // Paper start BuiltInRegistries.bootStrap(() -> { + net.minecraft.core.Registry.register(net.minecraft.core.registries.BuiltInRegistries.MATERIAL_CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC.codec()); @@ -126,7 +126,7 @@ index ac2b7b5161eaaca3620268ae865d6f2a80227fde..a1192d1f6b99669f843e8d9a8928ff0e }); // Paper end diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index 4f3387d1b128bc98614cfabfb5306781bdcd93be..0d8fd4eaf912eb4d40bb9f600dd2a8d5c21ab572 100644 +index 54308f1decc3982f30bf8b7a8a9d8865bfdbb9fd..0fca35ac82a1854260980b7c2664be82033e3bad 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java @@ -207,7 +207,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { diff --git a/patches/unapplied/server/0329-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/patches/server/0320-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch similarity index 100% rename from patches/unapplied/server/0329-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch rename to patches/server/0320-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch diff --git a/patches/unapplied/server/0330-MC-145656-Fix-Follow-Range-Initial-Target.patch b/patches/server/0321-MC-145656-Fix-Follow-Range-Initial-Target.patch similarity index 93% rename from patches/unapplied/server/0330-MC-145656-Fix-Follow-Range-Initial-Target.patch rename to patches/server/0321-MC-145656-Fix-Follow-Range-Initial-Target.patch index 44844fef0d..598284cea0 100644 --- a/patches/unapplied/server/0330-MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/patches/server/0321-MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -5,7 +5,7 @@ Subject: [PATCH] MC-145656 Fix Follow Range Initial Target diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java -index 638942d54c6ea2d305350a330ac9fb8b82294f53..7f4fb6ad4b3b3da52a111b0c58499f27d8443124 100644 +index 0dad5be671f990d0edf0a155e2534b3812438902..63cd37a5e1a44cae269c9f25e1b6a730bc265de8 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java @@ -38,6 +38,7 @@ public class NearestAttackableTargetGoal extends TargetG @@ -17,7 +17,7 @@ index 638942d54c6ea2d305350a330ac9fb8b82294f53..7f4fb6ad4b3b3da52a111b0c58499f27 @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index 9f65f6cdbcc054bde03c42d7d3b16f65b93e5deb..a7575b5ef56af6f53448d391abb4956e130148ca 100644 +index f29823f2e8a54bd4e81e2940b5c505b152f23e88..58422f00c7d64dbd1cf6d7211c9838875cbe7778 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java @@ -76,7 +76,7 @@ public class TargetingConditions { diff --git a/patches/unapplied/server/0331-Duplicate-UUID-Resolve-Option.patch b/patches/server/0322-Duplicate-UUID-Resolve-Option.patch similarity index 91% rename from patches/unapplied/server/0331-Duplicate-UUID-Resolve-Option.patch rename to patches/server/0322-Duplicate-UUID-Resolve-Option.patch index 219c1a4609..ccd7450a03 100644 --- a/patches/unapplied/server/0331-Duplicate-UUID-Resolve-Option.patch +++ b/patches/server/0322-Duplicate-UUID-Resolve-Option.patch @@ -33,10 +33,10 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA It is recommended you regenerate the entities, as these were legit entities, and deserve your love. diff --git a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java -index 0dc94dec1317b3f86d38074c6cbe41ab828cab1d..0e45a340ae534caf676b7f9d0adcbcee5829925e 100644 +index 8a5e93961dac4d87c81c0e70b6f4124a1f1d2556..bb5870e5f6949790e97cde83665caac8c384ccd2 100644 --- a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java +++ b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java -@@ -73,7 +73,17 @@ public final class ChunkSystem { +@@ -223,7 +223,17 @@ public final class ChunkSystem { } public static void onEntityPreAdd(final ServerLevel level, final Entity entity) { @@ -56,10 +56,10 @@ index 0dc94dec1317b3f86d38074c6cbe41ab828cab1d..0e45a340ae534caf676b7f9d0adcbcee public static void onChunkHolderCreate(final ServerLevel level, final ChunkHolder holder) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 299c7c60edf491cc44e609517474d8247fb6c724..430be10a2b0487dc26f21793592ca08d01a39e53 100644 +index d28710dca4b9e8110f85e5e9412fd8f29b3425fe..97f8336108b1b96a99eb5e5650feb5832aee89fa 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -537,6 +537,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -874,6 +874,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.discard(); needsRemoval = true; } @@ -67,8 +67,8 @@ index 299c7c60edf491cc44e609517474d8247fb6c724..430be10a2b0487dc26f21793592ca08d return !needsRemoval; })); // CraftBukkit end -@@ -548,6 +549,49 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - throw new UnsupportedOperationException(); // Paper - rewrite chunk system +@@ -924,6 +925,49 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + }); } + // Paper start @@ -115,5 +115,5 @@ index 299c7c60edf491cc44e609517474d8247fb6c724..430be10a2b0487dc26f21793592ca08d + } + // Paper end public CompletableFuture> prepareTickingChunk(ChunkHolder holder) { - throw new UnsupportedOperationException(); // Paper - rewrite chunk system - } + CompletableFuture, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkRangeFuture(holder, 1, (i) -> { + return ChunkStatus.FULL; diff --git a/patches/unapplied/server/0332-PlayerDeathEvent-shouldDropExperience.patch b/patches/server/0323-PlayerDeathEvent-shouldDropExperience.patch similarity index 85% rename from patches/unapplied/server/0332-PlayerDeathEvent-shouldDropExperience.patch rename to patches/server/0323-PlayerDeathEvent-shouldDropExperience.patch index 7b1dcd7f1a..5bb10a2456 100644 --- a/patches/unapplied/server/0332-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/server/0323-PlayerDeathEvent-shouldDropExperience.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index dd2607bc1388bf59bed3635c336e733414bf8e96..c93ede55cdd575f0c928bc9bf90c47480e52f91b 100644 +index ec841a36977c20389a8ab158b942d066e6cad346..47d4fa864531684135dc1856ae9a4ff76c0328bd 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -926,7 +926,7 @@ public class ServerPlayer extends Player { +@@ -925,7 +925,7 @@ public class ServerPlayer extends Player { this.tellNeutralMobsThatIDied(); } // SPIGOT-5478 must be called manually now diff --git a/patches/unapplied/server/0333-Prevent-bees-loading-chunks-checking-hive-position.patch b/patches/server/0324-Prevent-bees-loading-chunks-checking-hive-position.patch similarity index 61% rename from patches/unapplied/server/0333-Prevent-bees-loading-chunks-checking-hive-position.patch rename to patches/server/0324-Prevent-bees-loading-chunks-checking-hive-position.patch index b8b3046483..735de5103e 100644 --- a/patches/unapplied/server/0333-Prevent-bees-loading-chunks-checking-hive-position.patch +++ b/patches/server/0324-Prevent-bees-loading-chunks-checking-hive-position.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Prevent bees loading chunks checking hive position diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index f7bd3e5b30b19e56d16fbc86f40dc851da99c63b..78fe610d69db727411bf685127c39d009090ee14 100644 +index 17d8332356c9611d6a4b1ea2c8e160b46fa704ba..b4d5a33bfc5616d69a3570c99ea0af52397f8ffb 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -498,6 +498,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -497,6 +497,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } else if (this.isTooFarAway(this.hivePos)) { return false; } else { -+ if (level.getChunkIfLoadedImmediately(hivePos.getX() >> 4, hivePos.getZ() >> 4) == null) return true; // Paper - just assume the hive is still there, no need to load the chunk(s) - BlockEntity tileentity = this.level.getBlockEntity(this.hivePos); ++ if (this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) == null) return true; // Paper - just assume the hive is still there, no need to load the chunk(s) + BlockEntity tileentity = this.level().getBlockEntity(this.hivePos); return tileentity != null && tileentity.getType() == BlockEntityType.BEEHIVE; diff --git a/patches/unapplied/server/0334-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/patches/server/0325-Don-t-load-Chunks-from-Hoppers-and-other-things.patch similarity index 100% rename from patches/unapplied/server/0334-Don-t-load-Chunks-from-Hoppers-and-other-things.patch rename to patches/server/0325-Don-t-load-Chunks-from-Hoppers-and-other-things.patch diff --git a/patches/unapplied/server/0336-Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/0326-Optimise-EntityGetter-getPlayerByUUID.patch similarity index 79% rename from patches/unapplied/server/0336-Optimise-EntityGetter-getPlayerByUUID.patch rename to patches/server/0326-Optimise-EntityGetter-getPlayerByUUID.patch index cada89959c..0d173a015e 100644 --- a/patches/unapplied/server/0336-Optimise-EntityGetter-getPlayerByUUID.patch +++ b/patches/server/0326-Optimise-EntityGetter-getPlayerByUUID.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID Use the PlayerList map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2a2e795923ecaa300c7fc26fd71444711bd43535..dcdf59d18c0336f766bd320b2d536c115df3435d 100644 +index bfa12c4e44b089c4c1b03c7b8ec80774e29bd4ae..a4a48f602010b88423cc8135c98d416b26640022 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -424,6 +424,15 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -326,6 +326,15 @@ public class ServerLevel extends Level implements WorldGenLevel { } - // Paper end - rewrite chunk system + // Paper end + // Paper start - optimise getPlayerByUUID + @Nullable @@ -23,5 +23,5 @@ index 2a2e795923ecaa300c7fc26fd71444711bd43535..dcdf59d18c0336f766bd320b2d536c11 + // Paper end + // Add env and gen to constructor, IWorldDataServer -> WorldDataServer - public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error diff --git a/patches/unapplied/server/0337-Fix-items-not-falling-correctly.patch b/patches/server/0327-Fix-items-not-falling-correctly.patch similarity index 77% rename from patches/unapplied/server/0337-Fix-items-not-falling-correctly.patch rename to patches/server/0327-Fix-items-not-falling-correctly.patch index 02603be6a5..3b6a6f7039 100644 --- a/patches/unapplied/server/0337-Fix-items-not-falling-correctly.patch +++ b/patches/server/0327-Fix-items-not-falling-correctly.patch @@ -15,23 +15,23 @@ This patch resolves the conflict by offsetting checking Spigot's entity activation range check from an item's move method. diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 007625b1a121f1e7241f7cbfba0b1f168e8be5df..6836288bd380651007f3aa76e608767f612f6644 100644 +index 6938f996e7e6d394a54ef6dda2e09acb2021d87f..b85d0c7252a32210e4cb29c3e4fff4c080537451 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -149,7 +149,7 @@ public class ItemEntity extends Entity implements TraceableEntity { } } -- if (!this.onGround || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { -+ if (!this.onGround || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change +- if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { ++ if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change this.move(MoverType.SELF, this.getDeltaMovement()); float f1 = 0.98F; diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index e2dfc4d9a16a738dd0fe91838603e1d4370afa56..08bf9f85fe02a3f89640a2f3ae23089a119a394a 100644 +index 66dbfabdb104d272d48588a4773d198d3938f1ef..9527b702fa823f00852e409a53cae772943dbe09 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -257,7 +257,7 @@ public class ActivationRange +@@ -251,7 +251,7 @@ public class ActivationRange isActive = true; } // Add a little performance juice to active entities. Skip 1/4 if not immune. diff --git a/patches/unapplied/server/0339-Optimize-call-to-getFluid-for-explosions.patch b/patches/server/0328-Optimize-call-to-getFluid-for-explosions.patch similarity index 91% rename from patches/unapplied/server/0339-Optimize-call-to-getFluid-for-explosions.patch rename to patches/server/0328-Optimize-call-to-getFluid-for-explosions.patch index b77f7af0be..b6478baf2d 100644 --- a/patches/unapplied/server/0339-Optimize-call-to-getFluid-for-explosions.patch +++ b/patches/server/0328-Optimize-call-to-getFluid-for-explosions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize call to getFluid for explosions diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index e09e6be4f7c8b6c3761b38e181e4c0288a5c1871..83b2b56dbb6d74b58c43bf375ae7d1df9805037b 100644 +index 401076c5350429052994d98c414a83a21f908010..75d827f1eecb24f7ab985bdea2bbf65b8478fc8c 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -168,7 +168,7 @@ public class Explosion { diff --git a/patches/unapplied/server/0340-Fix-last-firework-in-stack-not-having-effects-when-d.patch b/patches/server/0329-Fix-last-firework-in-stack-not-having-effects-when-d.patch similarity index 90% rename from patches/unapplied/server/0340-Fix-last-firework-in-stack-not-having-effects-when-d.patch rename to patches/server/0329-Fix-last-firework-in-stack-not-having-effects-when-d.patch index b8c578f5e6..7ee698a4d4 100644 --- a/patches/unapplied/server/0340-Fix-last-firework-in-stack-not-having-effects-when-d.patch +++ b/patches/server/0329-Fix-last-firework-in-stack-not-having-effects-when-d.patch @@ -9,10 +9,10 @@ dispensed. The resulting item would have size == 0 and therefore be convertered to air, hence why the effects disappeared. diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 18e746e064f8e39e070a51218357f54c6b16fb7b..abd20f9495c315e73c1eb6572b8fc47db27450d7 100644 +index b13944a7a688ed9013e4c7dfdad6523738b9c35c..cec6ee5d31f2a86a61fd142035af853fa512e211 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -516,7 +516,7 @@ public interface DispenseItemBehavior { +@@ -515,7 +515,7 @@ public interface DispenseItemBehavior { } itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); diff --git a/patches/unapplied/server/0341-Entity-Activation-Range-2.0.patch b/patches/server/0330-Entity-Activation-Range-2.0.patch similarity index 92% rename from patches/unapplied/server/0341-Entity-Activation-Range-2.0.patch rename to patches/server/0330-Entity-Activation-Range-2.0.patch index f1a2570ac6..96221a4b3e 100644 --- a/patches/unapplied/server/0341-Entity-Activation-Range-2.0.patch +++ b/patches/server/0330-Entity-Activation-Range-2.0.patch @@ -18,7 +18,7 @@ public net.minecraft.world.entity.Entity isInsidePortal public net.minecraft.world.entity.LivingEntity jumping diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9afa0ff0cd9 100644 +index a4a48f602010b88423cc8135c98d416b26640022..af663f9318dceac52ad7b7fb71a1020208bbc5ee 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -29,7 +29,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.util.Pair; -@@ -1046,17 +1045,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -956,17 +955,17 @@ public class ServerLevel extends Level implements WorldGenLevel { ++TimingHistory.entityTicks; // Paper - timings // Spigot start co.aikar.timings.Timing timer; // Paper @@ -51,7 +51,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af try { // Paper end - timings entity.setOldPosAndRot(); -@@ -1067,9 +1066,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -977,9 +976,13 @@ public class ServerLevel extends Level implements WorldGenLevel { return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickNonPassenger"); @@ -65,7 +65,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af Iterator iterator = entity.getPassengers().iterator(); while (iterator.hasNext()) { -@@ -1077,13 +1080,18 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -987,13 +990,18 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } @@ -85,7 +85,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af passenger.setOldPosAndRot(); ++passenger.tickCount; ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -1092,8 +1100,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1002,8 +1010,17 @@ public class ServerLevel extends Level implements WorldGenLevel { return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); }); gameprofilerfiller.incrementCounter("tickPassenger"); @@ -103,7 +103,7 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af gameprofilerfiller.pop(); Iterator iterator = passenger.getPassengers().iterator(); -@@ -1103,6 +1120,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1013,6 +1030,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(passenger, entity2); } @@ -112,10 +112,10 @@ index dcdf59d18c0336f766bd320b2d536c115df3435d..5ad746ae673ef09f5581cf9fbbf1c9af } else { passenger.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7288d6d7f08b2e6b9696948d6c4451f479e419b6..8be765356261190a070715effbcaadfc83ab6c9c 100644 +index 08fa8e64af8074523c6e9478b443af38a97de65e..5ec0f3304b2ef352e3cdd73974716b1a18bb26e9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -386,6 +386,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -390,6 +390,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public void inactiveTick() { } // Spigot end // Paper start @@ -124,7 +124,7 @@ index 7288d6d7f08b2e6b9696948d6c4451f479e419b6..8be765356261190a070715effbcaadfc protected int numCollisions = 0; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @javax.annotation.Nullable -@@ -911,6 +913,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -910,6 +912,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } else { this.wasOnFire = this.isOnFire(); if (movementType == MoverType.PISTON) { @@ -133,7 +133,7 @@ index 7288d6d7f08b2e6b9696948d6c4451f479e419b6..8be765356261190a070715effbcaadfc movement = this.limitPistonMovement(movement); if (movement.equals(Vec3.ZERO)) { return; -@@ -923,6 +927,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -922,6 +926,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.stuckSpeedMultiplier = Vec3.ZERO; this.setDeltaMovement(Vec3.ZERO); } @@ -148,10 +148,10 @@ index 7288d6d7f08b2e6b9696948d6c4451f479e419b6..8be765356261190a070715effbcaadfc movement = this.maybeBackOffFromEdge(movement, movementType); Vec3 vec3d1 = this.collide(movement); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index dbf442e9686e59723ed0456f97e472cc663f8cc7..fa9cc50488d5044e13a97fb4aa9269fec999ad88 100644 +index b60714796725ba3dc0a17ff4ca7df8b344e838da..382bf998dba1fac7e4e4e93f8c262dc39ce6e459 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -215,6 +215,19 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -218,6 +218,19 @@ public abstract class Mob extends LivingEntity implements Targeting { return this.lookControl; } @@ -172,7 +172,7 @@ index dbf442e9686e59723ed0456f97e472cc663f8cc7..fa9cc50488d5044e13a97fb4aa9269fe Entity entity = this.getControlledVehicle(); diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index 6ae3f5cd42dfd424fc3741957995f47ad5ec8941..bffec7fdf49994f702ea4c378237dac0983d0a19 100644 +index d8ce7ea5fcb2785435ec1f530cb6e7114c01e4b7..5f3a14ca456e65894e824864ccf3cd5fabc9c6bd 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java @@ -19,6 +19,7 @@ public abstract class PathfinderMob extends Mob { @@ -182,7 +182,7 @@ index 6ae3f5cd42dfd424fc3741957995f47ad5ec8941..bffec7fdf49994f702ea4c378237dac0 + public BlockPos movingTarget = null; public BlockPos getMovingTarget() { return movingTarget; } // Paper public float getWalkTargetValue(BlockPos pos) { - return this.getWalkTargetValue(pos, this.level); + return this.getWalkTargetValue(pos, this.level()); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894fdacd556 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java @@ -217,7 +217,7 @@ index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894 this.availableGoals.stream().filter((wrappedGoal) -> { return wrappedGoal.getGoal() == goal; diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java -index 6efba52c2e5d7811ee329ed22c1c76f75d7ddbe1..26bf383caea68834c654b25653ced9017f1b1b22 100644 +index d27e5f9dac4703b839ab8444f6b54bf54d58af86..34f319ad09276c6f68dde449c79351de0d7d86f5 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java @@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal { @@ -245,33 +245,33 @@ index 6efba52c2e5d7811ee329ed22c1c76f75d7ddbe1..26bf383caea68834c654b25653ced901 this.mob = mob; @@ -114,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal { mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); - if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level, mutableBlockPos)) { + if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) { this.blockPos = mutableBlockPos; + setTargetPosition(mutableBlockPos.immutable()); // Paper return true; } } diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index caab72b733eabfe6a78c2a75e252817def49cbd0..ece23ee7812ca62ff8e763ffc29cda2711d2f2e1 100644 +index 73a5750dd47cf8869070f92594cfb926193c8761..3d36b121ca16f84efe9331c182a959227d35630e 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -225,17 +225,29 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -226,17 +226,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void inactiveTick() { // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( -- if (level.spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) { +- if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) { - this.customServerAiStep(); + // Paper start + if (this.getUnhappyCounter() > 0) { + this.setUnhappyCounter(this.getUnhappyCounter() - 1); -+ } + } + if (this.isEffectiveAi()) { + if (level.spigotConfig.tickInactiveVillagers) { + this.customServerAiStep(); + } else { + this.mobTick(true); + } - } ++ } + maybeDecayGossip(); + // Paper end + @@ -280,25 +280,29 @@ index caab72b733eabfe6a78c2a75e252817def49cbd0..ece23ee7812ca62ff8e763ffc29cda27 // Spigot End @Override -- protected void customServerAiStep() { -+ protected void customServerAiStep() { mobTick(false); } -+ protected void mobTick(boolean inactive) { - this.level.getProfiler().push("villagerBrain"); -- this.getBrain().tick((ServerLevel) this.level, this); -+ if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper - this.level.getProfiler().pop(); ++ @Deprecated // Paper + protected void customServerAiStep() { ++ // Paper start ++ this.customServerAiStep(false); ++ } ++ protected void customServerAiStep(final boolean inactive) { ++ // Paper end + this.level().getProfiler().push("villagerBrain"); +- this.getBrain().tick((ServerLevel) this.level(), this); ++ if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper + this.level().getProfiler().pop(); if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; -@@ -259,7 +271,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -260,7 +277,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.lastTradedPlayer = null; } - if (!this.isNoAi() && this.random.nextInt(100) == 0) { + if (!inactive && !this.isNoAi() && this.random.nextInt(100) == 0) { // Paper - Raid raid = ((ServerLevel) this.level).getRaidAt(this.blockPosition()); + Raid raid = ((ServerLevel) this.level()).getRaidAt(this.blockPosition()); if (raid != null && raid.isActive() && !raid.isOver()) { -@@ -270,6 +282,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -271,6 +288,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.isTrading()) { this.stopTrading(); } @@ -307,7 +311,7 @@ index caab72b733eabfe6a78c2a75e252817def49cbd0..ece23ee7812ca62ff8e763ffc29cda27 super.customServerAiStep(); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java -index 9b36bf3dbad7c31a20446208f3f410246f85eff6..1b8f22805af87dc08e0dea9fd93a5f93c0b05107 100644 +index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6e322091f 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java @@ -52,6 +52,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @@ -321,11 +325,11 @@ index 9b36bf3dbad7c31a20446208f3f410246f85eff6..1b8f22805af87dc08e0dea9fd93a5f93 @@ -89,10 +90,12 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper public boolean suckInItems() { - if (HopperBlockEntity.suckInItems(this.level, this)) { + if (HopperBlockEntity.suckInItems(this.level(), this)) { + this.immunize(); // Paper return true; } else { - for(ItemEntity itemEntity : this.level.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) { + for(ItemEntity itemEntity : this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) { if (HopperBlockEntity.addItem(this, itemEntity)) { + this.immunize(); // Paper return true; @@ -344,10 +348,10 @@ index 9b36bf3dbad7c31a20446208f3f410246f85eff6..1b8f22805af87dc08e0dea9fd93a5f93 + } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 24d167436dab54ad18875c3633b1246a21d63518..48aef158ace14d3ca1f05ba2c6e5681e3ef9be59 100644 +index c0920dfe011ec9b3be1018df3e8b13bea16dee87..f219546099c84ee262bb802631f86515a41cd7ca 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -161,6 +161,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -160,6 +160,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); @@ -361,7 +365,7 @@ index 24d167436dab54ad18875c3633b1246a21d63518..48aef158ace14d3ca1f05ba2c6e5681e public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot // Paper start 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 2f5f8e084c30bf654a19582e0b7baa9cde1b99b5..4f7b12d8f213d43f4ef5538b7e05809a1a106cbd 100644 +index 45f55c79a9d105f732054d61c4cf83eb5db49762..17a6327ab7b26dfab38881bbc0689b0b25f8f025 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 @@ -143,6 +143,10 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -376,7 +380,7 @@ index 2f5f8e084c30bf654a19582e0b7baa9cde1b99b5..4f7b12d8f213d43f4ef5538b7e05809a } } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e1742876edc80d5 100644 +index 9527b702fa823f00852e409a53cae772943dbe09..5f822417377b58f6952fa6e44a6e486047e354a2 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -1,39 +1,52 @@ @@ -560,9 +564,9 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287 + ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate( villagerActivationRange, worldHeight, villagerActivationRange ); + // Paper end - // Paper start - java.util.List entities = world.getEntities((Entity)null, maxBB, null); -@@ -172,60 +250,118 @@ public class ActivationRange + world.getEntities().get(maxBB, ActivationRange::activateEntity); + } +@@ -166,60 +244,118 @@ public class ActivationRange * @param entity * @return */ @@ -598,8 +602,8 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287 + // Paper end if ( !( entity instanceof AbstractArrow ) ) { -- if ( !entity.isOnGround() || !entity.passengers.isEmpty() || entity.isPassenger() ) -+ if ( (!entity.isOnGround() && !(entity instanceof FlyingMob)) ) // Paper - remove passengers logic +- if ( !entity.onGround() || !entity.passengers.isEmpty() || entity.isPassenger() ) ++ if ( (!entity.onGround() && !(entity instanceof FlyingMob)) ) // Paper - remove passengers logic { - return true; + return 10; // Paper @@ -624,7 +628,8 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287 { - return true; + return 20; // Paper -+ } + } +- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() ) + // Paper start + if (entity instanceof Bee) { + Bee bee = (Bee)entity; @@ -652,8 +657,7 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287 + return config.villagersWorkImmunityFor; + } + } - } -- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() ) ++ } + if ( entity instanceof Llama && ( (Llama) entity ).inCaravan() ) { - return true; @@ -681,11 +685,11 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287 + // Paper start + if (entity instanceof Mob && ((Mob) entity).targetSelector.hasTasks() ) { + return 0; - } ++ } + if (entity instanceof Pillager) { + Pillager pillager = (Pillager) entity; + // TODO:? -+ } + } + // Paper end } // SPIGOT-6644: Otherwise the target refresh tick will be missed @@ -698,7 +702,7 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287 } /** -@@ -240,8 +376,19 @@ public class ActivationRange +@@ -234,8 +370,19 @@ public class ActivationRange if ( entity instanceof FireworkRocketEntity ) { return true; } @@ -719,7 +723,7 @@ index 08bf9f85fe02a3f89640a2f3ae23089a119a394a..f158fc8a151272428a33dc5f6e174287 // Should this entity tick? if ( !isActive ) -@@ -249,15 +396,19 @@ public class ActivationRange +@@ -243,15 +390,19 @@ public class ActivationRange if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 ) { // Check immunities every 20 ticks. diff --git a/patches/unapplied/server/0326-Dont-send-unnecessary-sign-update.patch b/patches/unapplied/server/0326-Dont-send-unnecessary-sign-update.patch deleted file mode 100644 index da55b6f133..0000000000 --- a/patches/unapplied/server/0326-Dont-send-unnecessary-sign-update.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Sat, 11 Sep 2021 11:56:51 +0200 -Subject: [PATCH] Dont send unnecessary sign update - - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 574ff62d6ae3b44a95cc9a08e7cc684acaab5057..0bf9726714697a192cdd1e4c74330b2a0acf8920 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3237,6 +3237,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - - if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) { - ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString()); -+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32) // Paper - this.send(tileentity.getUpdatePacket()); // CraftBukkit - return; - }