From 5e262c16917bde3168c601024ce21a2076bc8018 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Wed, 23 Oct 2024 15:02:51 +0200 Subject: [PATCH] 298 --- patches/server/0005-Paper-config-files.patch | 12 +- .../0276-Limit-Client-Sign-length-more.patch} | 6 +- ...ggleEvent-when-whitelist-is-toggled.patch} | 4 +- ...d-additions-to-the-spawn-reason-API.patch} | 148 ++++++++++++------ .../0279-Fire-event-on-GS4-query.patch} | 0 .../0280-Add-PlayerPostRespawnEvent.patch} | 32 ++-- .../0281-Server-Tick-Events.patch} | 12 +- ...282-PlayerDeathEvent-getItemsToKeep.patch} | 8 +- ...ptimize-Captured-BlockEntity-Lookup.patch} | 4 +- .../0284-Mob-Spawner-API-Enhancements.patch} | 2 +- ...-to-changed-postToMainThread-method.patch} | 4 +- ...-item-frames-are-modified-MC-123450.patch} | 4 +- ...0287-Implement-CraftBlockSoundGroup.patch} | 2 +- ...88-Expose-the-internal-current-tick.patch} | 4 +- ...te-location-if-we-failed-to-read-it.patch} | 2 +- ...l-Spawned-mobs-towards-natural-spaw.patch} | 4 +- ...urable-projectile-relative-velocity.patch} | 6 +- .../0292-offset-item-frame-ticking.patch} | 4 +- ...event-consuming-the-wrong-itemstack.patch} | 10 +- ...4-Dont-send-unnecessary-sign-update.patch} | 4 +- ...-option-to-disable-pillager-patrols.patch} | 2 +- ...k-loads-when-villagers-try-to-find-.patch} | 0 .../0297-Duplicate-UUID-Resolve-Option.patch} | 4 +- ...ayerDeathEvent-shouldDropExperience.patch} | 8 +- ...5656-Fix-Follow-Range-Initial-Target.patch | 50 ------ 25 files changed, 172 insertions(+), 164 deletions(-) rename patches/{unapplied/server/0278-Limit-Client-Sign-length-more.patch => server/0276-Limit-Client-Sign-length-more.patch} (92%) rename patches/{unapplied/server/0279-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch => server/0277-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch} (83%) rename patches/{unapplied/server/0280-Fixes-and-additions-to-the-spawn-reason-API.patch => server/0278-Fixes-and-additions-to-the-spawn-reason-API.patch} (59%) rename patches/{unapplied/server/0281-Fire-event-on-GS4-query.patch => server/0279-Fire-event-on-GS4-query.patch} (100%) rename patches/{unapplied/server/0282-Add-PlayerPostRespawnEvent.patch => server/0280-Add-PlayerPostRespawnEvent.patch} (58%) rename patches/{unapplied/server/0283-Server-Tick-Events.patch => server/0281-Server-Tick-Events.patch} (78%) rename patches/{unapplied/server/0284-PlayerDeathEvent-getItemsToKeep.patch => server/0282-PlayerDeathEvent-getItemsToKeep.patch} (89%) rename patches/{unapplied/server/0285-Optimize-Captured-BlockEntity-Lookup.patch => server/0283-Optimize-Captured-BlockEntity-Lookup.patch} (90%) rename patches/{unapplied/server/0286-Mob-Spawner-API-Enhancements.patch => server/0284-Mob-Spawner-API-Enhancements.patch} (99%) rename patches/{unapplied/server/0287-Fix-CB-call-to-changed-postToMainThread-method.patch => server/0285-Fix-CB-call-to-changed-postToMainThread-method.patch} (85%) rename patches/{unapplied/server/0288-Fix-sounds-when-item-frames-are-modified-MC-123450.patch => server/0286-Fix-sounds-when-item-frames-are-modified-MC-123450.patch} (85%) rename patches/{unapplied/server/0289-Implement-CraftBlockSoundGroup.patch => server/0287-Implement-CraftBlockSoundGroup.patch} (96%) rename patches/{unapplied/server/0290-Expose-the-internal-current-tick.patch => server/0288-Expose-the-internal-current-tick.patch} (82%) rename patches/{unapplied/server/0291-Show-blockstate-location-if-we-failed-to-read-it.patch => server/0289-Show-blockstate-location-if-we-failed-to-read-it.patch} (94%) rename patches/{unapplied/server/0292-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch => server/0290-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch} (91%) rename patches/{unapplied/server/0293-Configurable-projectile-relative-velocity.patch => server/0291-Configurable-projectile-relative-velocity.patch} (85%) rename patches/{unapplied/server/0294-offset-item-frame-ticking.patch => server/0292-offset-item-frame-ticking.patch} (85%) rename patches/{unapplied/server/0295-Prevent-consuming-the-wrong-itemstack.patch => server/0293-Prevent-consuming-the-wrong-itemstack.patch} (86%) rename patches/{unapplied/server/0296-Dont-send-unnecessary-sign-update.patch => server/0294-Dont-send-unnecessary-sign-update.patch} (89%) rename patches/{unapplied/server/0297-Add-option-to-disable-pillager-patrols.patch => server/0295-Add-option-to-disable-pillager-patrols.patch} (91%) rename patches/{unapplied/server/0298-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch => server/0296-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch} (100%) rename patches/{unapplied/server/0300-Duplicate-UUID-Resolve-Option.patch => server/0297-Duplicate-UUID-Resolve-Option.patch} (96%) rename patches/{unapplied/server/0301-PlayerDeathEvent-shouldDropExperience.patch => server/0298-PlayerDeathEvent-shouldDropExperience.patch} (69%) delete mode 100644 patches/unapplied/server/0299-MC-145656-Fix-Follow-Range-Initial-Target.patch diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index e7ff1d0a22..eb69aa8d12 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -1335,10 +1335,10 @@ index 0000000000000000000000000000000000000000..1029b6de6f36b08bf634b4056ef57013 +} diff --git a/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java new file mode 100644 -index 0000000000000000000000000000000000000000..990d1bb46e0f9719f4e9af928d80ac6f8dff23b5 +index 0000000000000000000000000000000000000000..279b24c689b9979884b65df7eb1f059024f0feac --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java -@@ -0,0 +1,82 @@ +@@ -0,0 +1,83 @@ +package io.papermc.paper.configuration; + +import org.spongepowered.configurate.NodePath; @@ -1393,7 +1393,8 @@ index 0000000000000000000000000000000000000000..990d1bb46e0f9719f4e9af928d80ac6f + path("entities", "spawning", "despawn-ranges", "soft"), + path("entities", "spawning", "despawn-ranges", "hard"), + path("fixes", "fix-curing-zombie-villager-discount-exploit"), -+ path("entities", "mob-effects", "undead-immune-to-certain-effects") ++ path("entities", "mob-effects", "undead-immune-to-certain-effects"), ++ path("entities", "entities-target-with-follow-range") + }; + // spawn.keep-spawn-loaded and spawn.keep-spawn-loaded-range are no longer used, but kept + // in the world default config for compatibility with old worlds being migrated to use the gamerule @@ -1423,10 +1424,10 @@ index 0000000000000000000000000000000000000000..990d1bb46e0f9719f4e9af928d80ac6f +} diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..fd3b1c10695634f65c7291016bf671c084bc4d57 +index 0000000000000000000000000000000000000000..a81a332ffb80e67d7f886295099b5cd2ae8994c5 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -0,0 +1,581 @@ +@@ -0,0 +1,580 @@ +package io.papermc.paper.configuration; + +import com.google.common.collect.HashBasedTable; @@ -1568,7 +1569,6 @@ index 0000000000000000000000000000000000000000..fd3b1c10695634f65c7291016bf671c0 + public Entities entities; + + public class Entities extends ConfigurationPart { -+ public boolean entitiesTargetWithFollowRange = false; + public MobEffects mobEffects; + + public class MobEffects extends ConfigurationPart { diff --git a/patches/unapplied/server/0278-Limit-Client-Sign-length-more.patch b/patches/server/0276-Limit-Client-Sign-length-more.patch similarity index 92% rename from patches/unapplied/server/0278-Limit-Client-Sign-length-more.patch rename to patches/server/0276-Limit-Client-Sign-length-more.patch index a5c3397ebe..082d51bacd 100644 --- a/patches/unapplied/server/0278-Limit-Client-Sign-length-more.patch +++ b/patches/server/0276-Limit-Client-Sign-length-more.patch @@ -22,10 +22,10 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e786d4b940a6fcd6d5ce66c5e13f52ff001b8367..0ed2d0f5ec9d107e8049aa9e803479ffd341639f 100644 +index 0552007b5f12055b72b01ddeef17c30236642eaf..0b7e47418aa7a9891ee4a070430de6b2599f66e3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -299,6 +299,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -307,6 +307,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault(); private final FutureChain chatMessageChain; private boolean waitingForSwitchToConfig; @@ -33,7 +33,7 @@ index e786d4b940a6fcd6d5ce66c5e13f52ff001b8367..0ed2d0f5ec9d107e8049aa9e803479ff public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) { super(server, connection, clientData, player); // CraftBukkit -@@ -3149,7 +3150,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3197,7 +3198,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleSignUpdate(ServerboundSignUpdatePacket packet) { diff --git a/patches/unapplied/server/0279-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/0277-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch similarity index 83% rename from patches/unapplied/server/0279-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch rename to patches/server/0277-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 36ca904431..9ca53b7c59 100644 --- a/patches/unapplied/server/0279-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/patches/server/0277-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 7f8081446704ea9642275cb2bc139fed174a2f1f..0bac75f111398fd22df978a09dcd4cdc22998894 100644 +index d013e72511d1763a55e5e0837b682d02f87aff63..ceaf7bfbe4bf686780135c5c5dfe75d852fcb6cf 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1128,6 +1128,7 @@ public abstract class PlayerList { +@@ -1097,6 +1097,7 @@ public abstract class PlayerList { } public void setUsingWhiteList(boolean whitelistEnabled) { diff --git a/patches/unapplied/server/0280-Fixes-and-additions-to-the-spawn-reason-API.patch b/patches/server/0278-Fixes-and-additions-to-the-spawn-reason-API.patch similarity index 59% rename from patches/unapplied/server/0280-Fixes-and-additions-to-the-spawn-reason-API.patch rename to patches/server/0278-Fixes-and-additions-to-the-spawn-reason-API.patch index a8fda4a8d7..6dc2b28b31 100644 --- a/patches/unapplied/server/0280-Fixes-and-additions-to-the-spawn-reason-API.patch +++ b/patches/server/0278-Fixes-and-additions-to-the-spawn-reason-API.patch @@ -14,22 +14,22 @@ Co-authored-by: Jake Potrebic Co-authored-by: Doc diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java -index bf72cf288ade52ee8cc41ca978f368b3ad575951..798999be50d26be357ef3c6d5b9383ce4d1048c1 100644 +index f55832ce841621daab4d3a910650ab6562cefcda..f635da34335cd2901adf975fcd74c5c6f9785836 100644 --- a/src/main/java/net/minecraft/server/commands/SummonCommand.java +++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java @@ -57,6 +57,7 @@ public class SummonCommand { ServerLevel worldserver = source.getLevel(); - Entity entity = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (entity1) -> { + Entity entity = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, EntitySpawnReason.COMMAND, (entity1) -> { entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot()); + entity1.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND; // Paper - Entity#getEntitySpawnReason return entity1; }); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e9d08662c065d04a67918f0aa2cd4fde5798f2a6..a6a21def1ae0d35fa106da6242c49a0928e4eda5 100644 +index 3f4d3e2f45c2b2228a333076ec1f34228560593e..64c1fd62a865adb1e11edd326a1a5ccdc98f13ed 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1207,6 +1207,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1202,6 +1202,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return true; } // Paper end - extra debug info @@ -37,11 +37,24 @@ index e9d08662c065d04a67918f0aa2cd4fde5798f2a6..a6a21def1ae0d35fa106da6242c49a09 if (entity.isRemoved()) { // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit return false; +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index 9cfd0b457f6c462921667b9439a7b3e32d019758..62412b37d4f7d37b3fec0966ab700c2ae4d8cada 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -716,7 +716,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { + ServerLevel worldserver = (ServerLevel) world; + CompoundTag nbttagcompound = ((CompoundTag) nbt.get()).getCompound("RootVehicle"); + Entity entity = EntityType.loadEntityRecursive(nbttagcompound.getCompound("Entity"), worldserver, EntitySpawnReason.LOAD, (entity1) -> { +- return !worldserver.addWithUUID(entity1) ? null : entity1; ++ return !worldserver.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // CraftBukkit - decompile error // Paper - Entity#getEntitySpawnReason + }); + + if (entity == null) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 2f1d075b8dbcf173c51f3e6396ccbc61b64f75df..79203d0e5cdb86d9e2fb22cdaeb8cf3a93e43dcc 100644 +index ceaf7bfbe4bf686780135c5c5dfe75d852fcb6cf..dffc7f0c9c730bc629ee169eca3a7a997c2cc7b1 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -223,6 +223,11 @@ public abstract class PlayerList { +@@ -224,6 +224,11 @@ public abstract class PlayerList { worldserver1 = worldserver; } @@ -53,20 +66,11 @@ index 2f1d075b8dbcf173c51f3e6396ccbc61b64f75df..79203d0e5cdb86d9e2fb22cdaeb8cf3a player.setServerLevel(worldserver1); String s1 = connection.getLoggableAddress(this.server.logIPs()); -@@ -348,7 +353,7 @@ public abstract class PlayerList { - CompoundTag nbttagcompound = ((CompoundTag) optional.get()).getCompound("RootVehicle"); - ServerLevel finalWorldServer = worldserver1; // CraftBukkit - decompile error - Entity entity = EntityType.loadEntityRecursive(nbttagcompound.getCompound("Entity"), worldserver1, (entity1) -> { -- return !finalWorldServer.addWithUUID(entity1) ? null : entity1; // CraftBukkit - decompile error -+ return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // CraftBukkit - decompile error // Paper - Entity#getEntitySpawnReason - }); - - if (entity != null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f330ddca00ed11bf76ae825820423b94920013b9..9d56aff2766b684f0fb20e93d504de1a7a564b11 100644 +index 5d551a50e1043e369ebf3ddfe181be1e24cfd068..463d34e7b54efd503c4879d1386b2439474863dd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -247,6 +247,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -255,6 +255,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } // Paper end - Share random for entities to make them more random @@ -74,7 +78,7 @@ index f330ddca00ed11bf76ae825820423b94920013b9..9d56aff2766b684f0fb20e93d504de1a private CraftEntity bukkitEntity; -@@ -2274,6 +2275,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2390,6 +2391,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -84,7 +88,7 @@ index f330ddca00ed11bf76ae825820423b94920013b9..9d56aff2766b684f0fb20e93d504de1a // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbttagcompound.putBoolean("Paper.FromMobSpawner", true); -@@ -2420,6 +2424,26 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2537,6 +2541,26 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -112,36 +116,54 @@ index f330ddca00ed11bf76ae825820423b94920013b9..9d56aff2766b684f0fb20e93d504de1a } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 69a661f01e43d17262fd2845dde5528416bbe456..c0062c8f83641ff30e79a309c0bb9930ba4b422a 100644 +index 7fb2155b8d320f8871556083aef9ed8e1e91e6e7..ab02f4ca0bb8cd4939f167b410db208e38f7102b 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -366,7 +366,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -443,7 +443,7 @@ public class EntityType implements FeatureElement, EntityTypeT @Nullable - public T spawn(ServerLevel world, @Nullable ItemStack stack, @Nullable Player player, BlockPos pos, MobSpawnType spawnReason, boolean alignPosition, boolean invertY) { + public T spawn(ServerLevel world, @Nullable ItemStack stack, @Nullable Player player, BlockPos pos, EntitySpawnReason spawnReason, boolean alignPosition, boolean invertY) { // CraftBukkit start - return this.spawn(world, stack, player, pos, spawnReason, alignPosition, invertY, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); -+ return this.spawn(world, stack, player, pos, spawnReason, alignPosition, invertY, spawnReason == MobSpawnType.DISPENSER ? org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG : org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // Paper - use correct spawn reason for dispenser spawn eggs ++ return this.spawn(world, stack, player, pos, spawnReason, alignPosition, invertY, spawnReason == EntitySpawnReason.DISPENSER ? org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG : org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // Paper - use correct spawn reason for dispenser spawn eggs } @Nullable diff --git a/src/main/java/net/minecraft/world/entity/OminousItemSpawner.java b/src/main/java/net/minecraft/world/entity/OminousItemSpawner.java -index 146cbec9e64b6c77759aadd0d0c4e989018e9aef..4c4545b3732d4c08afdb7bc1913169a96e82825c 100644 +index 1fc9f883305e150f4bdf478bf0f43e301460cbf2..7b75dbb79e0d2a92cc10838a6e4da973e69125fb 100644 --- a/src/main/java/net/minecraft/world/entity/OminousItemSpawner.java +++ b/src/main/java/net/minecraft/world/entity/OminousItemSpawner.java -@@ -89,7 +89,7 @@ public class OminousItemSpawner extends Entity { - entity = new ItemEntity(level, this.getX(), this.getY(), this.getZ(), itemStack); - } +@@ -76,7 +76,7 @@ public class OminousItemSpawner extends Entity { + entity = this.spawnProjectile(serverLevel, projectileItem, itemStack); + } else { + entity = new ItemEntity(serverLevel, this.getX(), this.getY(), this.getZ(), itemStack); +- serverLevel.addFreshEntity(entity); ++ serverLevel.addFreshEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OMINOUS_ITEM_SPAWNER); // Paper - fixes and addition to spawn reason API + } -- level.addFreshEntity(entity); -+ level.addFreshEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OMINOUS_ITEM_SPAWNER); // Paper - Fixes and additions to the SpawnReason API - level.levelEvent(3021, this.blockPosition(), 1); - level.gameEvent(entity, GameEvent.ENTITY_PLACE, this.position()); - this.setItem(ItemStack.EMPTY); + serverLevel.levelEvent(3021, this.blockPosition(), 1); +@@ -90,7 +90,7 @@ public class OminousItemSpawner extends Entity { + ProjectileItem.DispenseConfig dispenseConfig = item.createDispenseConfig(); + dispenseConfig.overrideDispenseEvent().ifPresent(dispenseEvent -> world.levelEvent(dispenseEvent, this.blockPosition(), 0)); + Direction direction = Direction.DOWN; +- Projectile projectile = Projectile.spawnProjectileUsingShoot( ++ Projectile projectile = Projectile.spawnProjectileUsingShootDelayed( // Paper - fixes and addition to spawn reason API + item.asProjectile(world, this.position(), stack, direction), + world, + stack, +@@ -99,7 +99,7 @@ public class OminousItemSpawner extends Entity { + (double)direction.getStepZ(), + dispenseConfig.power(), + dispenseConfig.uncertainty() +- ); ++ ).spawn(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OMINOUS_ITEM_SPAWNER); // Paper - fixes and addition to spawn reason API + projectile.setOwner(this); + return projectile; + } diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java -index 1dade7a4fbdf190661e4431496349444467509cc..3e869620db35d38db39fbeed715b898ef9d2743c 100644 +index 2eecdcbea3d51b1fb6e0c3db0667464a699ca0df..c68ddccd5fbe27f6a62cedbdc2337f1b6e4d3273 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java -@@ -65,7 +65,7 @@ public class DragonFireball extends AbstractHurtingProjectile { +@@ -64,7 +64,7 @@ public class DragonFireball extends AbstractHurtingProjectile { if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(LivingEntity::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper - EnderDragon Events this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1); @@ -150,8 +172,44 @@ index 1dade7a4fbdf190661e4431496349444467509cc..3e869620db35d38db39fbeed715b898e } else entityareaeffectcloud.discard(null); // Paper - EnderDragon Events this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause } +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 e7fe338572a8bb740d6023c688d8c84ea04a2169..7c8f92b7e5eb66d26e6c46dc2ed86c68dbe97ae9 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +@@ -214,7 +214,12 @@ public abstract class Projectile extends Entity implements TraceableEntity { + } + + public static T spawnProjectileUsingShoot(T projectile, ServerLevel world, ItemStack projectileStack, double velocityX, double velocityY, double velocityZ, float power, float divergence) { +- return Projectile.spawnProjectile(projectile, world, projectileStack, (iprojectile) -> { ++ // Paper start - fixes and addition to spawn reason API ++ return spawnProjectileUsingShootDelayed(projectile, world, projectileStack, velocityX, velocityY, velocityZ, power, divergence).spawn(); ++ } ++ public static Delayed spawnProjectileUsingShootDelayed(T projectile, ServerLevel world, ItemStack projectileStack, double velocityX, double velocityY, double velocityZ, float power, float divergence) { ++ return Projectile.spawnProjectileDelayed(projectile, world, projectileStack, (iprojectile) -> { ++ // Paper end - fixes and addition to spawn reason API + projectile.shoot(velocityX, velocityY, velocityZ, power, divergence); + }); + } +@@ -241,6 +246,17 @@ public abstract class Projectile extends Entity implements TraceableEntity { + this.attemptSpawn(); + return projectile(); + } ++ ++ public boolean attemptSpawn(final org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { ++ if (!world.addFreshEntity(projectile, reason)) return false; ++ projectile.applyOnProjectileSpawned(this.world, this.projectileStack); ++ return true; ++ } ++ ++ public T spawn(final org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { ++ this.attemptSpawn(reason); ++ return projectile(); ++ } + } + // Paper end - delayed projectile spawning + diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index ee897b8c9462dbb3d7be9a2994753155065ce205..1d0964a7f544735a0213d5c7832c71f53db139a9 100644 +index 261de9ea37d22023da6a306b58b1b62a54dc03da..299137519dba07c8b2cb35437742b5d40eb9e5d2 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -191,6 +191,7 @@ public abstract class BaseSpawner { @@ -163,10 +221,10 @@ index ee897b8c9462dbb3d7be9a2994753155065ce205..1d0964a7f544735a0213d5c7832c71f5 // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -index 211b7809f099678bc3bd64bd29fd9c4d19e3ab0d..b968129b9a93fdf771caba5f768456070543ba6a 100644 +index 524f94a00f7b76a3847b68f0ab0cf82cc524b01e..aee71779f31def5f1ef7438cf06219d1de7092ec 100644 --- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -@@ -111,7 +111,7 @@ public class FrogspawnBlock extends Block { +@@ -121,7 +121,7 @@ public class FrogspawnBlock extends Block { int k = random.nextInt(1, 361); tadpole.moveTo(d, (double)pos.getY() - 0.5, e, (float)k, 0.0F); tadpole.setPersistenceRequired(); @@ -176,10 +234,10 @@ index 211b7809f099678bc3bd64bd29fd9c4d19e3ab0d..b968129b9a93fdf771caba5f76845607 } } diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 1eda49c9ce8ee009cb08b18f02f59b37c2118628..14a5cd54820243f4ca59857b0d67c1e86457d590 100644 +index fc26713a869d0c1fad1634ef4a6c6282fef5aa31..4f8224841865f956aaa969ab7f543c80b3c24319 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -73,7 +73,7 @@ public class SnifferEggBlock extends Block { +@@ -74,7 +74,7 @@ public class SnifferEggBlock extends Block { Vec3 vec3 = pos.getCenter(); sniffer.setBaby(true); sniffer.moveTo(vec3.x(), vec3.y(), vec3.z(), Mth.wrapDegrees(world.random.nextFloat() * 360.0F), 0.0F); @@ -189,20 +247,20 @@ index 1eda49c9ce8ee009cb08b18f02f59b37c2118628..14a5cd54820243f4ca59857b0d67c1e8 } } diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -index dbc0b69603dcffbf3d41d79719aa0f2b7da4a131..dd86f5ec5b2051aeea4e19ff97146362b1e8d019 100644 +index dc6b18527222d23e9719e2210b684a1aa797c70d..ea53c25c350c0cf8e0360ea409cd1f69a62054a8 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java @@ -189,7 +189,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi private boolean trySummonWarden(ServerLevel world) { return this.warningLevel >= 4 -- && SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER) -+ && SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null) // Paper - Entity#getEntitySpawnReason +- && SpawnUtil.trySpawnMob(EntityType.WARDEN, EntitySpawnReason.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER) ++ && SpawnUtil.trySpawnMob(EntityType.WARDEN, EntitySpawnReason.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null) // Paper - Entity#getEntitySpawnReason .isPresent(); } diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java -index c3f6522a7dc0777c5b3fa2bac63a8901f96d9f38..9b336f651ead8111a0b2c0fedad9331f594b2990 100644 +index f0163b7fa8b27823db9df5b8d2b6adcb63023164..de9d00ec932c8d07b28dd68ac9b8e6d5b94f7a8d 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java +++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java @@ -231,6 +231,7 @@ public final class TrialSpawner { @@ -214,10 +272,10 @@ index c3f6522a7dc0777c5b3fa2bac63a8901f96d9f38..9b336f651ead8111a0b2c0fedad9331f if (org.bukkit.craftbukkit.event.CraftEventFactory.callTrialSpawnerSpawnEvent(entity, pos).isCancelled()) { return Optional.empty(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index bddf98bdf60473eb1d2e533cf533ed7eee797aaa..ce70c8fddbe63d0af2b1f988ce9a2b40c5d48066 100644 +index 0e5cc680ee2418ec2af5fc3e215618ad4e768ed0..7fb04535b8c0744d0fa4b0c0a933234134486956 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1018,4 +1018,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1019,4 +1019,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return this.getHandle().spawnedViaMobSpawner; } // Paper end - Entity#fromMobSpawner diff --git a/patches/unapplied/server/0281-Fire-event-on-GS4-query.patch b/patches/server/0279-Fire-event-on-GS4-query.patch similarity index 100% rename from patches/unapplied/server/0281-Fire-event-on-GS4-query.patch rename to patches/server/0279-Fire-event-on-GS4-query.patch diff --git a/patches/unapplied/server/0282-Add-PlayerPostRespawnEvent.patch b/patches/server/0280-Add-PlayerPostRespawnEvent.patch similarity index 58% rename from patches/unapplied/server/0282-Add-PlayerPostRespawnEvent.patch rename to patches/server/0280-Add-PlayerPostRespawnEvent.patch index 946a6be171..5adb0c50ef 100644 --- a/patches/unapplied/server/0282-Add-PlayerPostRespawnEvent.patch +++ b/patches/server/0280-Add-PlayerPostRespawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 79203d0e5cdb86d9e2fb22cdaeb8cf3a93e43dcc..8cd80ea83ddcfd5052c8d8c19d3edb42538d1e15 100644 +index dffc7f0c9c730bc629ee169eca3a7a997c2cc7b1..29110c0b950c3073ab699d8ad1523ece2e8d3408 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -738,6 +738,10 @@ public abstract class PlayerList { +@@ -705,6 +705,10 @@ public abstract class PlayerList { entityplayer1.addTag(s); } @@ -18,38 +18,38 @@ index 79203d0e5cdb86d9e2fb22cdaeb8cf3a93e43dcc..8cd80ea83ddcfd5052c8d8c19d3edb42 + // Paper end - Add PlayerPostRespawnEvent // CraftBukkit start - fire PlayerRespawnEvent - DimensionTransition dimensiontransition; -@@ -745,11 +749,16 @@ public abstract class PlayerList { - dimensiontransition = entityplayer.findRespawnPositionAndUseSpawnBlock(flag, DimensionTransition.DO_NOTHING, reason); + TeleportTransition teleporttransition; +@@ -712,11 +716,16 @@ public abstract class PlayerList { + teleporttransition = entityplayer.findRespawnPositionAndUseSpawnBlock(!flag, TeleportTransition.DO_NOTHING, reason); if (!flag) entityplayer.reset(); // SPIGOT-4785 -+ // Paper start - Add PlayerPostRespawnEvent -+ if (dimensiontransition == null) return entityplayer; // Early exit, mirrors belows early return for disconnected players in respawn event -+ isRespawn = true; -+ location = CraftLocation.toBukkit(dimensiontransition.pos(), dimensiontransition.newLevel().getWorld(), dimensiontransition.yRot(), dimensiontransition.xRot()); -+ // Paper end - Add PlayerPostRespawnEvent ++ // Paper start - Add PlayerPostRespawnEvent ++ if (teleporttransition == null) return entityplayer; // Early exit, mirrors belows early return for disconnected players in respawn event ++ isRespawn = true; ++ location = CraftLocation.toBukkit(teleporttransition.position(), teleporttransition.newLevel().getWorld(), teleporttransition.yRot(), teleporttransition.xRot()); ++ // Paper end - Add PlayerPostRespawnEvent } else { - dimensiontransition = new DimensionTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), DimensionTransition.DO_NOTHING); + teleporttransition = new TeleportTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), TeleportTransition.DO_NOTHING); } // Spigot Start -- if (dimensiontransition == null) { -+ if (dimensiontransition == null) { // Paper - Add PlayerPostRespawnEvent - diff on change - spigot early returns if respawn pos is null, that is how they handle disconnected player in respawn event +- if (teleporttransition == null) { ++ if (teleporttransition == null) { // Paper - Add PlayerPostRespawnEvent - diff on change - spigot early returns if respawn pos is null, that is how they handle disconnected player in respawn event return entityplayer; } // Spigot End -@@ -795,6 +804,11 @@ public abstract class PlayerList { +@@ -764,6 +773,11 @@ public abstract class PlayerList { if (iblockdata.is(Blocks.RESPAWN_ANCHOR)) { entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F, worldserver.getRandom().nextLong())); } + // Paper start - Add PlayerPostRespawnEvent -+ if (iblockdata.is(net.minecraft.tags.BlockTags.BEDS) && !dimensiontransition.missingRespawnBlock()) { ++ if (iblockdata.is(net.minecraft.tags.BlockTags.BEDS) && !teleporttransition.missingRespawnBlock()) { + isBedSpawn = true; + } + // Paper end - Add PlayerPostRespawnEvent } // Added from changeDimension this.sendAllPlayerInfo(entityplayer); // Update health, etc... -@@ -816,6 +830,13 @@ public abstract class PlayerList { +@@ -785,6 +799,13 @@ public abstract class PlayerList { if (entityplayer.connection.isDisconnected()) { this.save(entityplayer); } diff --git a/patches/unapplied/server/0283-Server-Tick-Events.patch b/patches/server/0281-Server-Tick-Events.patch similarity index 78% rename from patches/unapplied/server/0283-Server-Tick-Events.patch rename to patches/server/0281-Server-Tick-Events.patch index 5c5d419332..20aa43f7b4 100644 --- a/patches/unapplied/server/0283-Server-Tick-Events.patch +++ b/patches/server/0281-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 8ecfd7a3daa99dabe796d28d27790fb8b45c628b..ddc3da84c5a55d2cd977fcdb18121351606a6b3c 100644 +index 8030c00bc3783582aafbda934bb653b0b21d1fb9..5f84618775d66d50557fa71f77fa322c2d1da791 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1433,6 +1433,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop extends CraftBlockStat diff --git a/patches/unapplied/server/0292-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/patches/server/0290-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch similarity index 91% rename from patches/unapplied/server/0292-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch rename to patches/server/0290-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index cb2e502f71..6f292a58b4 100644 --- a/patches/unapplied/server/0292-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/patches/server/0290-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -17,10 +17,10 @@ This should fully solve all of the issues around it so that only natural influences natural spawns. diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 41eef8bfd1572aecaf086bfbec300abeae2df794..58ea6a1f95a09c22125a8262b1b221004ebce0e4 100644 +index be2412ef8f8c331a881e442577cf05aec43f52bb..485c6044d603f15878f9413a644a538dab68db3e 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -83,6 +83,13 @@ public final class NaturalSpawner { +@@ -87,6 +87,13 @@ public final class NaturalSpawner { MobCategory enumcreaturetype = entity.getType().getCategory(); if (enumcreaturetype != MobCategory.MISC) { diff --git a/patches/unapplied/server/0293-Configurable-projectile-relative-velocity.patch b/patches/server/0291-Configurable-projectile-relative-velocity.patch similarity index 85% rename from patches/unapplied/server/0293-Configurable-projectile-relative-velocity.patch rename to patches/server/0291-Configurable-projectile-relative-velocity.patch index 29613c9f00..3ca413377f 100644 --- a/patches/unapplied/server/0293-Configurable-projectile-relative-velocity.patch +++ b/patches/server/0291-Configurable-projectile-relative-velocity.patch @@ -25,10 +25,10 @@ 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 30eb86b52f00cfa61af4f93aca50ffc3547c95e8..d27e17ebf25cd842a943cf82bde05b2248c74414 100644 +index 7c8f92b7e5eb66d26e6c46dc2ed86c68dbe97ae9..2cb77d0b6e6ba880a2a76488a870a20ed883b15a 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -@@ -182,8 +182,11 @@ public abstract class Projectile extends Entity implements TraceableEntity { +@@ -192,8 +192,11 @@ public abstract class Projectile extends Entity implements TraceableEntity { this.shoot((double) f5, (double) f6, (double) f7, speed, divergence); Vec3 vec3d = shooter.getKnownMovement(); @@ -40,4 +40,4 @@ index 30eb86b52f00cfa61af4f93aca50ffc3547c95e8..d27e17ebf25cd842a943cf82bde05b22 + // Paper end - allow disabling relative velocity } - // CraftBukkit start - call projectile hit event + public static T spawnProjectileFromRotation(Projectile.ProjectileFactory creator, ServerLevel world, ItemStack projectileStack, LivingEntity shooter, float roll, float power, float divergence) { diff --git a/patches/unapplied/server/0294-offset-item-frame-ticking.patch b/patches/server/0292-offset-item-frame-ticking.patch similarity index 85% rename from patches/unapplied/server/0294-offset-item-frame-ticking.patch rename to patches/server/0292-offset-item-frame-ticking.patch index 3db1ffe305..f8748a09cc 100644 --- a/patches/unapplied/server/0294-offset-item-frame-ticking.patch +++ b/patches/server/0292-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/BlockAttachedEntity.java b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java -index e4eece7bbd14514ec60da26a8744672baa8956f9..7bc612890f941177da11da0ce047d5a74d8ebb33 100644 +index cd0a2270b58b6c0dba67270e7e1d1ba253eb7953..608acb4f3cb8f9a0dc10b819ed4bf577c229dd2c 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java -@@ -26,7 +26,7 @@ import org.bukkit.event.hanging.HangingBreakEvent; +@@ -29,7 +29,7 @@ import org.bukkit.event.hanging.HangingBreakEvent; public abstract class BlockAttachedEntity extends Entity { private static final Logger LOGGER = LogUtils.getLogger(); diff --git a/patches/unapplied/server/0295-Prevent-consuming-the-wrong-itemstack.patch b/patches/server/0293-Prevent-consuming-the-wrong-itemstack.patch similarity index 86% rename from patches/unapplied/server/0295-Prevent-consuming-the-wrong-itemstack.patch rename to patches/server/0293-Prevent-consuming-the-wrong-itemstack.patch index c0dbff9a6b..87d7bf2e28 100644 --- a/patches/unapplied/server/0295-Prevent-consuming-the-wrong-itemstack.patch +++ b/patches/server/0293-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 a23baa42fd3bb09f619fd6528a8a4f97d189cde6..8ee6d25c3860fe7f2e5039c74c736d82eefda237 100644 +index 34f66931dec00809ed58569e24431762a1acd56f..f720d4d93ed13b1b9287a1ee7dc8bc4794834e1a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3855,9 +3855,14 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3995,9 +3995,14 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void startUsingItem(InteractionHand hand) { @@ -24,15 +24,15 @@ index a23baa42fd3bb09f619fd6528a8a4f97d189cde6..8ee6d25c3860fe7f2e5039c74c736d82 this.useItem = itemstack; this.useItemRemaining = itemstack.getUseDuration(this); if (!this.level().isClientSide) { -@@ -3942,6 +3947,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -4068,6 +4073,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.releaseUsingItem(); } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { + this.startUsingItem(this.getUsedItemHand(), true); // Paper - Prevent consuming the wrong itemstack - this.triggerItemUseEffects(this.useItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; -@@ -3979,8 +3985,8 @@ public abstract class LivingEntity extends Entity implements Attackable { + PlayerItemConsumeEvent event = null; // Paper +@@ -4105,8 +4111,8 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.stopUsingItem(); diff --git a/patches/unapplied/server/0296-Dont-send-unnecessary-sign-update.patch b/patches/server/0294-Dont-send-unnecessary-sign-update.patch similarity index 89% rename from patches/unapplied/server/0296-Dont-send-unnecessary-sign-update.patch rename to patches/server/0294-Dont-send-unnecessary-sign-update.patch index afca8562db..cccd627a78 100644 --- a/patches/unapplied/server/0296-Dont-send-unnecessary-sign-update.patch +++ b/patches/server/0294-Dont-send-unnecessary-sign-update.patch @@ -5,10 +5,10 @@ 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 394d0b03f18d55b43f091a9ae1a47e06a6fa4c0d..87e272cfb145c37d26b0bf56f97ec784a9bfd98e 100644 +index 469d0046ba98289e98aa0f3f66e3ed27026a98a2..3339130f3a02e6e395bcd8e3047b35f6f4eca9a9 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 +@@ -185,6 +185,7 @@ public class SignBlockEntity extends BlockEntity { 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()); diff --git a/patches/unapplied/server/0297-Add-option-to-disable-pillager-patrols.patch b/patches/server/0295-Add-option-to-disable-pillager-patrols.patch similarity index 91% rename from patches/unapplied/server/0297-Add-option-to-disable-pillager-patrols.patch rename to patches/server/0295-Add-option-to-disable-pillager-patrols.patch index 3021a1f6c8..dd3c57ff12 100644 --- a/patches/unapplied/server/0297-Add-option-to-disable-pillager-patrols.patch +++ b/patches/server/0295-Add-option-to-disable-pillager-patrols.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to disable pillager patrols diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java -index 7522c40ab352d3b3ce1540f043b4b5f0d411060b..7b5db53d4cf97e41175896de47303526198fb8f6 100644 +index 04e108633068c2a1a88a35995c2999701ef7bc3b..8837db46ced2412942949a3c6f81ec7d9a0bacda 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java @@ -24,6 +24,7 @@ public class PatrolSpawner implements CustomSpawner { diff --git a/patches/unapplied/server/0298-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/patches/server/0296-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch similarity index 100% rename from patches/unapplied/server/0298-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch rename to patches/server/0296-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch diff --git a/patches/unapplied/server/0300-Duplicate-UUID-Resolve-Option.patch b/patches/server/0297-Duplicate-UUID-Resolve-Option.patch similarity index 96% rename from patches/unapplied/server/0300-Duplicate-UUID-Resolve-Option.patch rename to patches/server/0297-Duplicate-UUID-Resolve-Option.patch index 0139752e8e..502d6dcc28 100644 --- a/patches/unapplied/server/0300-Duplicate-UUID-Resolve-Option.patch +++ b/patches/server/0297-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/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java -index 82fc5133325a127890984d51c1381883759eb444..ae16cf5c803caae636860dd9b1a83abe479ca5a4 100644 +index 3f552ee8f90566edddb5943311a14309e4bebb61..f18c2b85ed9541f646f157184221e333d0ae58bd 100644 --- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java -@@ -189,10 +189,51 @@ public class ChunkStatusTasks { +@@ -178,10 +178,51 @@ public class ChunkStatusTasks { entity.discard(null); // CraftBukkit - add Bukkit remove cause needsRemoval = true; } diff --git a/patches/unapplied/server/0301-PlayerDeathEvent-shouldDropExperience.patch b/patches/server/0298-PlayerDeathEvent-shouldDropExperience.patch similarity index 69% rename from patches/unapplied/server/0301-PlayerDeathEvent-shouldDropExperience.patch rename to patches/server/0298-PlayerDeathEvent-shouldDropExperience.patch index b48dcea61d..22cdda6c79 100644 --- a/patches/unapplied/server/0301-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/server/0298-PlayerDeathEvent-shouldDropExperience.patch @@ -5,15 +5,15 @@ 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 cba123f40d72ebd39305a76694be508510997d1e..4ccb5ba03d19223d25aee4cebd4b8bec2838a3e0 100644 +index c5eb4766d95b1ed91be8e8631200f56096a17766..099a9aa7e64da22e720fa527cac8750991ee8562 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1018,7 +1018,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -1278,7 +1278,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.tellNeutralMobsThatIDied(); } // SPIGOT-5478 must be called manually now -- this.dropExperience(damageSource.getEntity()); -+ if (event.shouldDropExperience()) this.dropExperience(damageSource.getEntity()); // Paper - tie to event +- this.dropExperience(this.serverLevel(), damageSource.getEntity()); ++ if (event.shouldDropExperience()) this.dropExperience(this.serverLevel(), damageSource.getEntity()); // Paper - tie to event // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. if (!event.getKeepInventory()) { // Paper start - PlayerDeathEvent#getItemsToKeep diff --git a/patches/unapplied/server/0299-MC-145656-Fix-Follow-Range-Initial-Target.patch b/patches/unapplied/server/0299-MC-145656-Fix-Follow-Range-Initial-Target.patch deleted file mode 100644 index 528cf153ea..0000000000 --- a/patches/unapplied/server/0299-MC-145656-Fix-Follow-Range-Initial-Target.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Wed, 18 Dec 2019 22:21:35 -0600 -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 0dad5be671f990d0edf0a155e2534b3812438902..175ba1184fc997f562f0834b172e17dc1b5b3027 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 - this.randomInterval = reducedTickDelay(reciprocalChance); - this.setFlags(EnumSet.of(Goal.Flag.TARGET)); - this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate); -+ if (mob.level().paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper - Fix MC-145656 - } - - @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 bc4b9a46056e83762e29bb04485ad7c754a20336..aecb0ad814586bfc5e56755ee14379a69388b38c 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 -@@ -77,7 +77,7 @@ public class TargetingConditions { - - if (this.range > 0.0) { - double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0; -- double e = Math.max(this.range * d, 2.0); -+ double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0); // Paper - Fix MC-145656 - double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); - if (f > e * e) { - return false; -@@ -92,4 +92,18 @@ public class TargetingConditions { - return true; - } - } -+ -+ // Paper start - Fix MC-145656 -+ private boolean useFollowRange = false; -+ -+ public TargetingConditions useFollowRange() { -+ this.useFollowRange = true; -+ return this; -+ } -+ -+ private double getFollowRange(LivingEntity entityliving) { -+ net.minecraft.world.entity.ai.attributes.AttributeInstance attributeinstance = entityliving.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.FOLLOW_RANGE); -+ return attributeinstance == null ? 16.0D : attributeinstance.getValue(); -+ } -+ // Paper end - Fix MC-145656 - }