diff --git a/patches/unapplied/server/API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch similarity index 100% rename from patches/unapplied/server/API-to-get-a-BlockState-without-a-snapshot.patch rename to patches/server/API-to-get-a-BlockState-without-a-snapshot.patch diff --git a/patches/unapplied/server/Ability-to-apply-mending-to-XP-API.patch b/patches/server/Ability-to-apply-mending-to-XP-API.patch similarity index 100% rename from patches/unapplied/server/Ability-to-apply-mending-to-XP-API.patch rename to patches/server/Ability-to-apply-mending-to-XP-API.patch diff --git a/patches/unapplied/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/patches/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch similarity index 95% rename from patches/unapplied/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch rename to patches/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 3e1a3a154a..5af1e9d64c 100644 --- a/patches/unapplied/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/patches/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); + java.util.UUID uniqueId = gameprofile.getId(); final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); diff --git a/patches/unapplied/server/Add-ArmorStand-Item-Meta.patch b/patches/server/Add-ArmorStand-Item-Meta.patch similarity index 100% rename from patches/unapplied/server/Add-ArmorStand-Item-Meta.patch rename to patches/server/Add-ArmorStand-Item-Meta.patch diff --git a/patches/unapplied/server/Add-PlayerArmorChangeEvent.patch b/patches/server/Add-PlayerArmorChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerArmorChangeEvent.patch rename to patches/server/Add-PlayerArmorChangeEvent.patch diff --git a/patches/unapplied/server/Add-setPlayerProfile-API-for-Skulls.patch b/patches/server/Add-setPlayerProfile-API-for-Skulls.patch similarity index 100% rename from patches/unapplied/server/Add-setPlayerProfile-API-for-Skulls.patch rename to patches/server/Add-setPlayerProfile-API-for-Skulls.patch diff --git a/patches/unapplied/server/AsyncTabCompleteEvent.patch b/patches/server/AsyncTabCompleteEvent.patch similarity index 96% rename from patches/unapplied/server/AsyncTabCompleteEvent.patch rename to patches/server/AsyncTabCompleteEvent.patch index 229ff6a3ac..5920aca062 100644 --- a/patches/unapplied/server/AsyncTabCompleteEvent.patch +++ b/patches/server/AsyncTabCompleteEvent.patch @@ -19,7 +19,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } @@ -37,10 +37,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper return; } - // Paper start -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - // Paper end // CraftBukkit end + // Paper start - async tab completion + TAB_COMPLETE_EXECUTOR.execute(() -> { @@ -54,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { - if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer -- this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); +- this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); + final String command = packet.getCommand(); + final com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), command, true, null); + event.callEvent(); diff --git a/patches/unapplied/server/Disable-Explicit-Network-Manager-Flushing.patch b/patches/server/Disable-Explicit-Network-Manager-Flushing.patch similarity index 100% rename from patches/unapplied/server/Disable-Explicit-Network-Manager-Flushing.patch rename to patches/server/Disable-Explicit-Network-Manager-Flushing.patch diff --git a/patches/unapplied/server/Extend-Player-Interact-cancellation.patch b/patches/server/Extend-Player-Interact-cancellation.patch similarity index 100% rename from patches/unapplied/server/Extend-Player-Interact-cancellation.patch rename to patches/server/Extend-Player-Interact-cancellation.patch diff --git a/patches/unapplied/server/Fill-Profile-Property-Events.patch b/patches/server/Fill-Profile-Property-Events.patch similarity index 100% rename from patches/unapplied/server/Fill-Profile-Property-Events.patch rename to patches/server/Fill-Profile-Property-Events.patch diff --git a/patches/unapplied/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch similarity index 100% rename from patches/unapplied/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch rename to patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch diff --git a/patches/unapplied/server/Implement-extended-PaperServerListPingEvent.patch b/patches/server/Implement-extended-PaperServerListPingEvent.patch similarity index 100% rename from patches/unapplied/server/Implement-extended-PaperServerListPingEvent.patch rename to patches/server/Implement-extended-PaperServerListPingEvent.patch diff --git a/patches/unapplied/server/Improved-Async-Task-Scheduler.patch b/patches/server/Improved-Async-Task-Scheduler.patch similarity index 100% rename from patches/unapplied/server/Improved-Async-Task-Scheduler.patch rename to patches/server/Improved-Async-Task-Scheduler.patch diff --git a/patches/unapplied/server/Player.setPlayerProfile-API.patch b/patches/server/Player.setPlayerProfile-API.patch similarity index 99% rename from patches/unapplied/server/Player.setPlayerProfile-API.patch rename to patches/server/Player.setPlayerProfile-API.patch index 3916213724..c21766683f 100644 --- a/patches/unapplied/server/Player.setPlayerProfile-API.patch +++ b/patches/server/Player.setPlayerProfile-API.patch @@ -12,7 +12,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet()); } diff --git a/patches/unapplied/server/PlayerAdvancementCriterionGrantEvent.patch b/patches/server/PlayerAdvancementCriterionGrantEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerAdvancementCriterionGrantEvent.patch rename to patches/server/PlayerAdvancementCriterionGrantEvent.patch diff --git a/patches/unapplied/server/PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/PlayerNaturallySpawnCreaturesEvent.patch similarity index 91% rename from patches/unapplied/server/PlayerNaturallySpawnCreaturesEvent.patch rename to patches/server/PlayerNaturallySpawnCreaturesEvent.patch index 57399c6792..a3012a5726 100644 --- a/patches/unapplied/server/PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/PlayerNaturallySpawnCreaturesEvent.patch @@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + //double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D; // Paper - use from event + double blockRange = 16384.0D; // Paper // Spigot end - long i = chunkcoordintpair.toLong(); - + if (!this.distanceManager.hasPlayersNearby(chunkcoordintpair.toLong())) { + return false; @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -76,5 +76,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper + public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - private final java.util.concurrent.atomic.AtomicReference viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1)); - public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader; + public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) { + super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); diff --git a/patches/unapplied/server/PlayerPickupExperienceEvent.patch b/patches/server/PlayerPickupExperienceEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerPickupExperienceEvent.patch rename to patches/server/PlayerPickupExperienceEvent.patch diff --git a/patches/unapplied/server/PreCreatureSpawnEvent.patch b/patches/server/PreCreatureSpawnEvent.patch similarity index 98% rename from patches/unapplied/server/PreCreatureSpawnEvent.patch rename to patches/server/PreCreatureSpawnEvent.patch index 71ea4941b3..f01034f65c 100644 --- a/patches/unapplied/server/PreCreatureSpawnEvent.patch +++ b/patches/server/PreCreatureSpawnEvent.patch @@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 }).limit(5L).collect(Collectors.toList()); if (list1.size() >= requiredCount) { -- if (SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isPresent()) { // CraftBukkit +- if (!SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit + if (SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE, () -> {GolemSensor.golemDetected(this);}).isPresent()) { // CraftBukkit // Paper - Set Golem Last Seen to stop it from spawning another one list.forEach(GolemSensor::golemDetected); } diff --git a/patches/unapplied/server/Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/Prevent-logins-from-being-processed-when-the-player-.patch similarity index 59% rename from patches/unapplied/server/Prevent-logins-from-being-processed-when-the-player-.patch rename to patches/server/Prevent-logins-from-being-processed-when-the-player-.patch index da7c035fcb..37da157d74 100644 --- a/patches/unapplied/server/Prevent-logins-from-being-processed-when-the-player-.patch +++ b/patches/server/Prevent-logins-from-being-processed-when-the-player-.patch @@ -12,13 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, } // Paper end - if (this.state == ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT) { -- this.handleAcceptedLogin(); -+ // Paper start - prevent logins to be processed even though disconnect was called -+ if (connection.isConnected()) { -+ this.handleAcceptedLogin(); -+ } -+ // Paper end - } else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) { - ServerPlayer entityplayer = this.server.getPlayerList().getPlayer(this.gameProfile.getId()); + if (this.state == ServerLoginPacketListenerImpl.State.VERIFYING) { ++ if (this.connection.isConnected()) { // Paper - prevent logins to be processed even though disconnect was called + this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile)); ++ } // Paper + } + if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) { diff --git a/patches/unapplied/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch similarity index 100% rename from patches/unapplied/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch rename to patches/server/Send-attack-SoundEffects-only-to-players-who-can-see.patch diff --git a/patches/unapplied/server/Tameable-getOwnerUniqueId-API.patch b/patches/server/Tameable-getOwnerUniqueId-API.patch similarity index 100% rename from patches/unapplied/server/Tameable-getOwnerUniqueId-API.patch rename to patches/server/Tameable-getOwnerUniqueId-API.patch diff --git a/patches/unapplied/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch b/patches/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch similarity index 100% rename from patches/unapplied/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch rename to patches/server/Toggleable-player-crits-helps-mitigate-hacked-client.patch diff --git a/patches/unapplied/server/getPlayerUniqueId-API.patch b/patches/server/getPlayerUniqueId-API.patch similarity index 100% rename from patches/unapplied/server/getPlayerUniqueId-API.patch rename to patches/server/getPlayerUniqueId-API.patch diff --git a/patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch b/patches/server/revert-serverside-behavior-of-keepalives.patch similarity index 65% rename from patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch rename to patches/server/revert-serverside-behavior-of-keepalives.patch index df66e1d6c9..edf15084fd 100644 --- a/patches/unapplied/server/revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/revert-serverside-behavior-of-keepalives.patch @@ -16,37 +16,32 @@ whereas higher values will make this less sensitive to issues such as spikes from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - public ServerPlayer player; - private int tickCount; - private int ackBlockChangesUpTo = -1; +--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout"); + protected final MinecraftServer server; + public final Connection connection; // Paper - private long keepAliveTime; -+ private long keepAliveTime = Util.getMillis(); ++ private long keepAliveTime = Util.getMillis(); // Paper private boolean keepAlivePending; private long keepAliveChallenge; - // CraftBukkit start - multithreaded fields -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - private final LastSeenMessagesValidator lastSeenMessages; - private final MessageSignatureCache messageSignatureCache; - private final FutureChain chatMessageChain; + private int latency; + private volatile boolean suspendFlushingOnServerThread = false; + private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit - public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { - this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } + public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit + this.server = minecraftserver; +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + protected void keepConnectionAlive() { this.server.getProfiler().push("keepAlive"); - long i = Util.getMillis(); - - if (i - this.keepAliveTime >= 25000L) { // CraftBukkit - if (this.keepAlivePending) { -- this.disconnect(Component.translatable("disconnect.timeout")); -- } else { + // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + long currentTime = Util.getMillis(); @@ -55,7 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.keepAlivePending) { + if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected + ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info -+ this.disconnect(Component.translatable("disconnect.timeout", new Object[0])); + this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); +- } else { + } + } else { + if (elapsedTime >= 15000L) { // 15 seconds @@ -70,4 +66,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end this.server.getProfiler().pop(); - // CraftBukkit start + } diff --git a/patches/unapplied/server/use-CB-BlockState-implementations-for-captured-block.patch b/patches/server/use-CB-BlockState-implementations-for-captured-block.patch similarity index 100% rename from patches/unapplied/server/use-CB-BlockState-implementations-for-captured-block.patch rename to patches/server/use-CB-BlockState-implementations-for-captured-block.patch diff --git a/patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch b/patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch index 49203f3802..f7987bbc88 100644 --- a/patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch +++ b/patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } } - + + // Paper start - move open sign method to HumanEntity + @Override + public void openSign(final org.bukkit.block.Sign sign, final org.bukkit.block.sign.Side side) { diff --git a/patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch b/patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch index 6e87855cfb..782c9de524 100644 --- a/patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch +++ b/patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - + public void onTickingEnd(Entity entity) { ServerLevel.this.entityTickList.remove(entity); + // Paper start - Reset pearls when they stop being ticked @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } - + public void onTrackingStart(Entity entity) { 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -42,5 +42,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.cachedOwner = null; + if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit } - + this.leftOwner = nbt.getBoolean("LeftOwner"); diff --git a/patches/unapplied/server/Configurable-sprint-interruption-on-attack.patch b/patches/unapplied/server/Configurable-sprint-interruption-on-attack.patch index 0f7d80c74f..fcb3946b0b 100644 --- a/patches/unapplied/server/Configurable-sprint-interruption-on-attack.patch +++ b/patches/unapplied/server/Configurable-sprint-interruption-on-attack.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { } - + this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); - this.setSprinting(false); + // Paper start - Configuration option to disable automatic sprint interruption @@ -20,5 +20,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } - + if (flag3) { diff --git a/patches/unapplied/server/Enderman.teleportRandomly.patch b/patches/unapplied/server/Enderman.teleportRandomly.patch index 401ce56230..6ccedc4a74 100644 --- a/patches/unapplied/server/Enderman.teleportRandomly.patch +++ b/patches/unapplied/server/Enderman.teleportRandomly.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftEnderman extends CraftMonster implements Enderman { super(server, entity); } - + + @Override public boolean teleportRandomly() { return getHandle().teleport(); } // Paper @Override public MaterialData getCarriedMaterial() { diff --git a/patches/unapplied/server/EndermanAttackPlayerEvent.patch b/patches/unapplied/server/EndermanAttackPlayerEvent.patch index f7000ae0ea..72e97e5299 100644 --- a/patches/unapplied/server/EndermanAttackPlayerEvent.patch +++ b/patches/unapplied/server/EndermanAttackPlayerEvent.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { this.readPersistentAngerSaveData(this.level(), nbt); } - + - boolean isLookingAtMe(Player player) { + // Paper start - EndermanAttackPlayerEvent + private boolean isLookingAtMe(Player player) { @@ -26,5 +26,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean isLookingAtMe_check(Player player) { + // Paper end ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3); - + if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) { diff --git a/patches/unapplied/server/EndermanEscapeEvent.patch b/patches/unapplied/server/EndermanEscapeEvent.patch index 21976b9f4f..8a1e6ba822 100644 --- a/patches/unapplied/server/EndermanEscapeEvent.patch +++ b/patches/unapplied/server/EndermanEscapeEvent.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true); } - + + // Paper start + private boolean tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason reason) { + return new com.destroystokyo.paper.event.entity.EndermanEscapeEvent((org.bukkit.craftbukkit.entity.CraftEnderman) this.getBukkitEntity(), reason).callEvent(); @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) { float f = this.getLightLevelDependentMagicValue(); - + - if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { + if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper this.setTarget((LivingEntity) null); @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { } else { flag1 = flag && this.hurtWithCleanWater(source, (ThrownPotion) source.getDirectEntity(), amount); - + + if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start for (int i = 0; i < 64; ++i) { if (this.teleport()) { @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } + } // Paper end - + return flag1; } @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { @@ -55,4 +55,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.enderman.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper this.enderman.teleport(); } - + diff --git a/patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch index a6997032bd..aaeccd1bb7 100644 --- a/patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { } - + public int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { + // Paper start - Particle API Expansion + return sendParticles(players, sender, t0, d0, d1, d2, i, d3, d4, d5, d6, force); @@ -25,20 +25,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ClientboundLevelParticlesPacket packetplayoutworldparticles = new ClientboundLevelParticlesPacket(t0, force, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i); // CraftBukkit end int j = 0; - + - for (int k = 0; k < this.players.size(); ++k) { - ServerPlayer entityplayer = (ServerPlayer) this.players.get(k); + for (Player entityhuman : receivers) { // Paper - Particle API Expansion + ServerPlayer entityplayer = (ServerPlayer) entityhuman; // Paper - Particle API Expansion if (sender != null && !entityplayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit - + if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - + @Override public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { - if (data != null) { diff --git a/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch index 1abb23d4e9..3049ac44a4 100644 --- a/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java @@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C Style chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle(); - + if (entityhuman.isTextFilteringEnabled()) { - signtext = signtext.setMessage(i, Component.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier)); + signtext = signtext.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only @@ -19,4 +19,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + signtext = signtext.setMessage(i, Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.raw())).setStyle(chatmodifier), Component.literal(net.minecraft.SharedConstants.filterText(filteredtext.filteredOrEmpty())).setStyle(chatmodifier)); // Paper - filter sign text to chat only } } - + diff --git a/patches/unapplied/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/patches/unapplied/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch index 5d4b50178e..e79041e9d6 100644 --- a/patches/unapplied/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ b/patches/unapplied/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java @@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock { - + for(Direction direction : Direction.values()) { mutableBlockPos.setWithOffset(pos, direction); - BlockState blockState = world.getBlockState(mutableBlockPos); @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - use configurable min/max delay } @@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock { - + for(Direction direction : Direction.values()) { mutableBlockPos.setWithOffset(pos, direction); - if (world.getBlockState(mutableBlockPos).is(this)) { diff --git a/patches/unapplied/server/WitchConsumePotionEvent.patch b/patches/unapplied/server/WitchConsumePotionEvent.patch index c6402c6777..522dbf6915 100644 --- a/patches/unapplied/server/WitchConsumePotionEvent.patch +++ b/patches/unapplied/server/WitchConsumePotionEvent.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/Witch.java +++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java @@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob { - + this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); if (itemstack.is(Items.POTION)) { - List list = PotionUtils.getMobEffects(itemstack); @@ -19,6 +19,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + List list = event.callEvent() ? PotionUtils.getMobEffects(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion())) : null; + // Paper end - + if (list != null) { Iterator iterator = list.iterator(); diff --git a/patches/unapplied/server/WitchThrowPotionEvent.patch b/patches/unapplied/server/WitchThrowPotionEvent.patch index 98c23bf492..6d1f4d5da2 100644 --- a/patches/unapplied/server/WitchThrowPotionEvent.patch +++ b/patches/unapplied/server/WitchThrowPotionEvent.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob { potionregistry = Potions.WEAKNESS; } - + + // Paper start + ItemStack potion = PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry); + com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));