From 9eb0b381571a2a3c8db78ac938cb596d3890a08f Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 22 Jan 2024 19:01:10 +0100 Subject: [PATCH] [ci skip] Add more patch identifying comments --- ...r-redstone-torch-rapid-clock-removal.patch | 14 +++---- ...blocking-on-Network-Manager-creation.patch | 16 ++++---- ...ptimise-BlockState-s-hashCode-equals.patch | 16 ++++---- ...onfigurable-packet-in-spam-threshold.patch | 6 +-- patches/server/0109-Add-EntityZapEvent.patch | 10 ++--- ...entity-nbt-data-from-falling-blocks.patch} | 6 +-- ...111-Cache-user-authenticator-threads.patch | 6 +-- ...ze-Level.hasChunkAt-BlockPosition-Z.patch} | 6 +-- ...-Bound-Treasure-Maps-to-World-Border.patch | 10 ++--- ...figurable-Cartographer-Treasure-Maps.patch | 14 +++---- ...to-control-if-armor-stands-can-move.patch} | 2 +- ...21-Properly-fix-item-duplication-bug.patch | 8 ++-- ...rovide-E-TE-Chunk-count-stat-methods.patch | 8 ++-- ...PI-for-Reason-Source-Triggering-play.patch | 30 ++++++--------- .../server/0127-Cap-Entity-Collisions.patch | 14 +++---- ...ke-parrots-stay-on-shoulders-despite.patch | 10 ++--- ...urable-option-to-disable-creeper-lin.patch | 4 +- .../server/0134-Item-canEntityPickup.patch | 10 ++--- ...PlayerPickupItemEvent-setFlyAtPlayer.patch | 4 +- .../0136-PlayerAttemptPickupItemEvent.patch | 6 +-- ...-profile-lookups-to-worldgen-threads.patch | 12 +++--- .../server/0139-Add-UnknownCommandEvent.patch | 38 ++++++++----------- ...player-logins-during-server-shutdown.patch | 4 +- .../server/0143-Entity-fromMobSpawner.patch | 4 +- ...=> 0145-ensureServerConversions-API.patch} | 2 +- .../0147-ProfileWhitelistVerifyEvent.patch | 8 ++-- ...dle-ServerboundKeepAlivePacket-async.patch | 4 +- ...rom-being-processed-when-the-player-.patch | 4 +- ...34-Use-ConcurrentHashMap-in-JsonList.patch | 4 +- .../0286-Async-command-map-building.patch | 8 ++-- .../server/0287-Brigadier-Mojang-API.patch | 12 +++--- ...-Manager-and-add-advanced-packet-sup.patch | 14 +++---- .../0327-Entity-Activation-Range-2.0.patch | 18 ++++----- .../0329-Alternative-item-despawn-rate.patch | 4 +- ...n-to-nerf-pigmen-from-nether-portals.patch | 10 ++--- ...Add-Channel-initialization-listeners.patch | 6 +-- ...mmands-if-tab-completion-is-disabled.patch | 4 +- ...x-and-optimise-world-force-upgrading.patch | 8 ++-- .../0594-Add-PlayerKickEvent-causes.patch | 8 ++-- ...653-Vanilla-command-permission-fixes.patch | 4 +- ...y-type-tags-suggestions-in-selectors.patch | 8 ++-- .../0784-Add-support-for-Proxy-Protocol.patch | 4 +- patches/server/0858-Friction-API.patch | 6 +-- patches/server/0937-Fix-BanList-API.patch | 4 +- ...predicate-for-blocks-when-raytracing.patch | 6 +-- 45 files changed, 195 insertions(+), 209 deletions(-) rename patches/server/{0110-Filter-bad-tile-entity-nbt-data-from-falling-blocks.patch => 0110-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch} (77%) rename patches/server/{0116-Optimize-World.isLoaded-BlockPosition-Z.patch => 0116-Optimize-Level.hasChunkAt-BlockPosition-Z.patch} (81%) rename patches/server/{0119-Add-API-methods-to-control-if-armour-stands-can-move.patch => 0119-Add-API-methods-to-control-if-armor-stands-can-move.patch} (96%) rename patches/server/{0145-Implement-ensureServerConversions-API.patch => 0145-ensureServerConversions-API.patch} (97%) diff --git a/patches/server/0100-Faster-redstone-torch-rapid-clock-removal.patch b/patches/server/0100-Faster-redstone-torch-rapid-clock-removal.patch index 24bb6dff26..90e326013b 100644 --- a/patches/server/0100-Faster-redstone-torch-rapid-clock-removal.patch +++ b/patches/server/0100-Faster-redstone-torch-rapid-clock-removal.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Faster redstone torch rapid clock removal Only resize the the redstone torch list once, since resizing arrays / lists is costly diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 9bb380e7c8973b4728b5d4aad663af9e477dda0c..48d3da58820c1d9259bc023ddd74e9632b3f62d1 100644 +index cd3a99585a471981b9fa1f614ddddfce570ee0e7..244c28cd52a177e798153bc6151f0fb0e5c51841 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -176,6 +176,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { private org.spigotmc.TickLimiter tileLimiter; private int tileTickPosition; public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions -+ public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here ++ public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here public CraftWorld getWorld() { return this.world; diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java -index 68da47c3ec59518a4bbeb03c196ef0e7c6b5d049..6c49962e8f9e2a5fca50b33f3e3fff76fa36f907 100644 +index 68da47c3ec59518a4bbeb03c196ef0e7c6b5d049..1ec5f1e984b428b125f919576686c92538f34c8b 100644 --- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java @@ -24,7 +24,7 @@ public class RedstoneTorchBlock extends BaseTorchBlock { @@ -26,7 +26,7 @@ index 68da47c3ec59518a4bbeb03c196ef0e7c6b5d049..6c49962e8f9e2a5fca50b33f3e3fff76 public static final MapCodec CODEC = simpleCodec(RedstoneTorchBlock::new); public static final BooleanProperty LIT = BlockStateProperties.LIT; - private static final Map> RECENT_TOGGLES = new WeakHashMap(); -+ // Paper - Move the mapped list to World ++ // Paper - Faster redstone torch rapid clock removal; Move the mapped list to World public static final int RECENT_TOGGLE_TIMER = 60; public static final int MAX_RECENT_TOGGLES = 8; public static final int RESTART_DELAY = 160; @@ -38,7 +38,7 @@ index 68da47c3ec59518a4bbeb03c196ef0e7c6b5d049..6c49962e8f9e2a5fca50b33f3e3fff76 - - while (list != null && !list.isEmpty() && world.getGameTime() - ((RedstoneTorchBlock.Toggle) list.get(0)).when > 60L) { - list.remove(0); -+ // Paper start ++ // Paper start - Faster redstone torch rapid clock removal + java.util.ArrayDeque redstoneUpdateInfos = world.redstoneUpdateInfos; + if (redstoneUpdateInfos != null) { + RedstoneTorchBlock.Toggle curr; @@ -46,7 +46,7 @@ index 68da47c3ec59518a4bbeb03c196ef0e7c6b5d049..6c49962e8f9e2a5fca50b33f3e3fff76 + redstoneUpdateInfos.poll(); + } } -+ // Paper end ++ // Paper end - Faster redstone torch rapid clock removal // CraftBukkit start org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager(); @@ -57,7 +57,7 @@ index 68da47c3ec59518a4bbeb03c196ef0e7c6b5d049..6c49962e8f9e2a5fca50b33f3e3fff76 - List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.computeIfAbsent(world, (iblockaccess) -> { - return Lists.newArrayList(); - }); -+ // Paper start ++ // Paper start - Faster redstone torch rapid clock removal + java.util.ArrayDeque list = world.redstoneUpdateInfos; + if (list == null) { + list = world.redstoneUpdateInfos = new java.util.ArrayDeque<>(); diff --git a/patches/server/0103-Avoid-blocking-on-Network-Manager-creation.patch b/patches/server/0103-Avoid-blocking-on-Network-Manager-creation.patch index 8a8d5530d3..16784d8691 100644 --- a/patches/server/0103-Avoid-blocking-on-Network-Manager-creation.patch +++ b/patches/server/0103-Avoid-blocking-on-Network-Manager-creation.patch @@ -6,22 +6,22 @@ Subject: [PATCH] Avoid blocking on Network Manager creation Per Paper issue 294 diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index dbbca784fe45b7099f683745b36f5c195ca4c2af..d870fbec236a3660f12e0f45cf9431067b18468b 100644 +index dbbca784fe45b7099f683745b36f5c195ca4c2af..187b2cf175ba5cea94158d29b53993dc5a7c5b94 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -61,6 +61,15 @@ public class ServerConnectionListener { public volatile boolean running; private final List channels = Collections.synchronizedList(Lists.newArrayList()); final List connections = Collections.synchronizedList(Lists.newArrayList()); -+ // Paper start - prevent blocking on adding a new network manager while the server is ticking ++ // Paper start - prevent blocking on adding a new connection while the server is ticking + private final java.util.Queue pending = new java.util.concurrent.ConcurrentLinkedQueue<>(); + private final void addPending() { -+ Connection manager = null; -+ while ((manager = pending.poll()) != null) { -+ connections.add(manager); ++ Connection connection; ++ while ((connection = pending.poll()) != null) { ++ connections.add(connection); + } + } -+ // Paper end ++ // Paper end - prevent blocking on adding a new connection while the server is ticking public ServerConnectionListener(MinecraftServer server) { this.server = server; @@ -31,7 +31,7 @@ index dbbca784fe45b7099f683745b36f5c195ca4c2af..d870fbec236a3660f12e0f45cf943106 - ServerConnectionListener.this.connections.add(object); + //ServerConnectionListener.this.connections.add(object); // Paper -+ pending.add(object); // Paper ++ pending.add(object); // Paper - prevent blocking on adding a new connection while the server is ticking ((Connection) object).configurePacketHandler(channelpipeline); ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); } @@ -39,7 +39,7 @@ index dbbca784fe45b7099f683745b36f5c195ca4c2af..d870fbec236a3660f12e0f45cf943106 synchronized (this.connections) { // Spigot Start -+ this.addPending(); // Paper ++ this.addPending(); // Paper - prevent blocking on adding a new connection while the server is ticking // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 ) { diff --git a/patches/server/0106-Optimise-BlockState-s-hashCode-equals.patch b/patches/server/0106-Optimise-BlockState-s-hashCode-equals.patch index c2a7785d05..b303f4e71f 100644 --- a/patches/server/0106-Optimise-BlockState-s-hashCode-equals.patch +++ b/patches/server/0106-Optimise-BlockState-s-hashCode-equals.patch @@ -9,7 +9,7 @@ object identity checks safely. Use a simpler optimized hashcode diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java -index 3084343b724098de9791bb74ffb037a499c0c430..bf7ed22094ac92a152e522bafccffb9589f84343 100644 +index 3084343b724098de9791bb74ffb037a499c0c430..8da64429eaf083578c672cd34f52dd42389ff396 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java @@ -30,8 +30,7 @@ public class BooleanProperty extends Property { @@ -18,12 +18,12 @@ index 3084343b724098de9791bb74ffb037a499c0c430..bf7ed22094ac92a152e522bafccffb95 - @Override - public boolean equals(Object object) { -+ public boolean equals_unused(Object object) { // Paper ++ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals if (this == object) { return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -index 647e295c7761b95db6da28f6fd043ec963f27872..2d69d1c17f734ee38667d51e6fd0a268211ec595 100644 +index 647e295c7761b95db6da28f6fd043ec963f27872..0a7a6c0e7635d0ada101074d4229df7edc6dd31b 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java @@ -45,8 +45,7 @@ public class EnumProperty & StringRepresentable> extends Prope @@ -32,12 +32,12 @@ index 647e295c7761b95db6da28f6fd043ec963f27872..2d69d1c17f734ee38667d51e6fd0a268 - @Override - public boolean equals(Object object) { -+ public boolean equals_unused(Object object) { // Paper ++ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals if (this == object) { return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java -index d6c1b1817ba79a652c4094f003a7d899d4939971..33268d953b30d384564eee6dfab2a37fa722e465 100644 +index d6c1b1817ba79a652c4094f003a7d899d4939971..cbe6e4579cc55a427dd8f8fe403478faf6d35b8f 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java @@ -35,8 +35,7 @@ public class IntegerProperty extends Property { @@ -46,12 +46,12 @@ index d6c1b1817ba79a652c4094f003a7d899d4939971..33268d953b30d384564eee6dfab2a37f - @Override - public boolean equals(Object object) { -+ public boolean equals_unused(Object object) { // Paper ++ public boolean equals_unused(Object object) { // Paper - Perf: Optimize hashCode/equals if (this == object) { return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -index d1f2e29623b15fdb99ba082fd757a54fd4713761..66b8e23d799adaf872233ea44c54330d75135544 100644 +index d1f2e29623b15fdb99ba082fd757a54fd4713761..08c2e4ba9147fbea41e0fce26ad20586832a525b 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java @@ -70,14 +70,7 @@ public abstract class Property> { @@ -66,7 +66,7 @@ index d1f2e29623b15fdb99ba082fd757a54fd4713761..66b8e23d799adaf872233ea44c54330d - Property property = (Property)object; - return this.clazz.equals(property.clazz) && this.name.equals(property.name); - } -+ return this == object; // Paper ++ return this == object; // Paper - Perf: Optimize hashCode/equals } @Override diff --git a/patches/server/0107-Configurable-packet-in-spam-threshold.patch b/patches/server/0107-Configurable-packet-in-spam-threshold.patch index aa06bfc28f..b23494003a 100644 --- a/patches/server/0107-Configurable-packet-in-spam-threshold.patch +++ b/patches/server/0107-Configurable-packet-in-spam-threshold.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable packet in spam threshold diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fe6a995331ba489911886047130861496d75979a..4300fd30f782a2fe32519f7e27edff292ca46ef6 100644 +index 21d3b837b6875dd9833a70f6f8bca2070016c5a0..9d23e60b166caf31856b2592f844af7d6ac68469 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1536,13 +1536,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -16,12 +16,12 @@ index fe6a995331ba489911886047130861496d75979a..4300fd30f782a2fe32519f7e27edff29 private boolean checkLimit(long timestamp) { - if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < 30 && this.limitedPackets++ >= 4) { -+ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < getSpamThreshold() && this.limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8 ++ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < getSpamThreshold() && this.limitedPackets++ >= 8) { // Paper - Configurable threshold; raise packet limit to 8 return false; } - if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= 30) { -+ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= getSpamThreshold()) { // Paper ++ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= getSpamThreshold()) { // Paper - Configurable threshold this.lastLimitedPacket = timestamp; this.limitedPackets = 0; return true; diff --git a/patches/server/0109-Add-EntityZapEvent.patch b/patches/server/0109-Add-EntityZapEvent.patch index 93b813b3f6..c1935787f4 100644 --- a/patches/server/0109-Add-EntityZapEvent.patch +++ b/patches/server/0109-Add-EntityZapEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityZapEvent 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 22f7318711041bfc2847d519933c46b9fd523d01..505e0031f2783192f1146b1b00249e7891c4f1ef 100644 +index 22f7318711041bfc2847d519933c46b9fd523d01..4034b8e7503f611dc9be121d8da2020ae7155b8c 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -851,10 +851,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -13,22 +13,22 @@ index 22f7318711041bfc2847d519933c46b9fd523d01..505e0031f2783192f1146b1b00249e78 public void thunderHit(ServerLevel world, LightningBolt lightning) { if (world.getDifficulty() != Difficulty.PEACEFUL) { - Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); -+ // Paper - move log down, event can cancel ++ // Paper - Add EntityZapEvent; move log down, event can cancel Witch entitywitch = (Witch) EntityType.WITCH.create(world); if (entitywitch != null) { -+ // Paper start ++ // Paper start - Add EntityZapEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, lightning, entitywitch).isCancelled()) { + return; + } + if (org.spigotmc.SpigotConfig.logVillagerDeaths) Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); // Move down -+ // Paper end ++ // Paper end - Add EntityZapEvent + entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null); entitywitch.setNoAi(this.isNoAi()); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 54c4a45d5f67c7ed6ce751b4985d9e920cf62008..6436da99daa22ace3cdee794d0dab09894c1d92c 100644 +index a0dc52c805a82e267b66502a480cf76bc82a20d4..18cd6963863d030e3c360f5e00e8786f28ee04b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1265,6 +1265,14 @@ public class CraftEventFactory { diff --git a/patches/server/0110-Filter-bad-tile-entity-nbt-data-from-falling-blocks.patch b/patches/server/0110-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch similarity index 77% rename from patches/server/0110-Filter-bad-tile-entity-nbt-data-from-falling-blocks.patch rename to patches/server/0110-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch index 4586c9d069..e97386237d 100644 --- a/patches/server/0110-Filter-bad-tile-entity-nbt-data-from-falling-blocks.patch +++ b/patches/server/0110-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch @@ -1,11 +1,11 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sat, 12 Nov 2016 23:25:22 -0600 -Subject: [PATCH] Filter bad tile entity nbt data from falling blocks +Subject: [PATCH] Filter bad block entity nbt data from falling blocks diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 6c4224e4752b655710c5b992d9acf9563b183483..9be45ff8139c9d385c1deb1200e3718ed3add801 100644 +index 6c4224e4752b655710c5b992d9acf9563b183483..ffed5f2295f60416535015a28635975aa2d211dd 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -334,7 +334,7 @@ public class FallingBlockEntity extends Entity { @@ -13,7 +13,7 @@ index 6c4224e4752b655710c5b992d9acf9563b183483..9be45ff8139c9d385c1deb1200e3718e } - if (nbt.contains("TileEntityData", 10)) { -+ if (nbt.contains("TileEntityData", 10) && !(this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock)) { // Paper ++ if (nbt.contains("TileEntityData", 10) && !(this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock)) { // Paper - Filter bad block entity nbt data from falling blocks this.blockData = nbt.getCompound("TileEntityData").copy(); } diff --git a/patches/server/0111-Cache-user-authenticator-threads.patch b/patches/server/0111-Cache-user-authenticator-threads.patch index caf58cd14f..ca76a3254f 100644 --- a/patches/server/0111-Cache-user-authenticator-threads.patch +++ b/patches/server/0111-Cache-user-authenticator-threads.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Cache user authenticator threads diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 55c15d942ddd230dec073039b7c5f95a14ff937c..d4e709b3e3df489d125ab20a98dc4b34bf61dcc9 100644 +index 55c15d942ddd230dec073039b7c5f95a14ff937c..c5b451a706240dbd6719e001825c6859fc1b2a49 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -49,6 +49,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -35,7 +35,7 @@ index 55c15d942ddd230dec073039b7c5f95a14ff937c..d4e709b3e3df489d125ab20a98dc4b34 - thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(ServerLoginPacketListenerImpl.LOGGER)); - thread.start(); + }); -+ // Paper end ++ // Paper end - Cache authenticator threads // CraftBukkit end } @@ -58,7 +58,7 @@ index 55c15d942ddd230dec073039b7c5f95a14ff937c..d4e709b3e3df489d125ab20a98dc4b34 - thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(ServerLoginPacketListenerImpl.LOGGER)); - thread.start(); + }); -+ // Paper end ++ // Paper end - Cache authenticator threads } // CraftBukkit start diff --git a/patches/server/0116-Optimize-World.isLoaded-BlockPosition-Z.patch b/patches/server/0116-Optimize-Level.hasChunkAt-BlockPosition-Z.patch similarity index 81% rename from patches/server/0116-Optimize-World.isLoaded-BlockPosition-Z.patch rename to patches/server/0116-Optimize-Level.hasChunkAt-BlockPosition-Z.patch index 0a165f9805..11679e1ff1 100644 --- a/patches/server/0116-Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/patches/server/0116-Optimize-Level.hasChunkAt-BlockPosition-Z.patch @@ -1,12 +1,12 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 2 Dec 2016 00:11:43 -0500 -Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z +Subject: [PATCH] Optimize Level.hasChunkAt(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 48d3da58820c1d9259bc023ddd74e9632b3f62d1..e774f7930090e10889f13e8193d15e44a3b7637f 100644 +index f9e89722d50accecceea26aa12c312b9f331339a..7a5865f10b87022317b5eb3a1d711a0864da9a7f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -430,6 +430,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -15,7 +15,7 @@ index 48d3da58820c1d9259bc023ddd74e9632b3f62d1..e774f7930090e10889f13e8193d15e44 + @Override + public final boolean hasChunkAt(BlockPos pos) { -+ return getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4) != null; // Paper ++ return getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4) != null; // Paper - Perf: Optimize Level.hasChunkAt(BlockPosition)Z + } + public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline diff --git a/patches/server/0117-Bound-Treasure-Maps-to-World-Border.patch b/patches/server/0117-Bound-Treasure-Maps-to-World-Border.patch index a546d2ee4a..2154e105ae 100644 --- a/patches/server/0117-Bound-Treasure-Maps-to-World-Border.patch +++ b/patches/server/0117-Bound-Treasure-Maps-to-World-Border.patch @@ -11,14 +11,14 @@ that is outside happens to be closer, but unreachable, yet another reachable one is in border that would of been missed. diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -index 52325a99ea38530ad69a39ac0215233139f35268..dd74e8a034022fe72a1652f92712182b4910f651 100644 +index 52325a99ea38530ad69a39ac0215233139f35268..bf5ac907507bf3b5bfcef45b566c0bc12626e2c0 100644 --- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java +++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java @@ -37,6 +37,18 @@ public class WorldBorder { return (double) (pos.getX() + 1) > this.getMinX() && (double) pos.getX() < this.getMaxX() && (double) (pos.getZ() + 1) > this.getMinZ() && (double) pos.getZ() < this.getMaxZ(); } -+ // Paper start ++ // Paper start - Bound treasure maps to world border + private final BlockPos.MutableBlockPos mutPos = new BlockPos.MutableBlockPos(); + public boolean isBlockInBounds(int chunkX, int chunkZ) { + this.mutPos.set(chunkX, 64, chunkZ); @@ -28,20 +28,20 @@ index 52325a99ea38530ad69a39ac0215233139f35268..dd74e8a034022fe72a1652f92712182b + this.mutPos.set(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15); + return this.isWithinBounds(this.mutPos); + } -+ // Paper end ++ // Paper end - Bound treasure maps to world border + public boolean isWithinBounds(ChunkPos pos) { return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ(); } diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 5f4fa76fe3a1a0a4fc11064fcf57bfab20bd9729..4da303d7e15496f04f0e27bfb613176bc2a72b76 100644 +index e124ae2711bcd4681fe0b41bd266de67bef8344f..1eacb6998f99833441dd1dcb8301f25759675f53 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -217,6 +217,7 @@ public abstract class ChunkGenerator { while (iterator.hasNext()) { ChunkPos chunkcoordintpair = (ChunkPos) iterator.next(); -+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper ++ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper - Bound treasure maps to world border blockposition_mutableblockposition.set(SectionPos.sectionToBlockCoord(chunkcoordintpair.x, 8), 32, SectionPos.sectionToBlockCoord(chunkcoordintpair.z, 8)); double d1 = blockposition_mutableblockposition.distSqr(center); diff --git a/patches/server/0118-Configurable-Cartographer-Treasure-Maps.patch b/patches/server/0118-Configurable-Cartographer-Treasure-Maps.patch index 66b8976899..61fc245ddd 100644 --- a/patches/server/0118-Configurable-Cartographer-Treasure-Maps.patch +++ b/patches/server/0118-Configurable-Cartographer-Treasure-Maps.patch @@ -9,7 +9,7 @@ Also allow turning off treasure maps all together as they can eat up Map ID's which are limited in quantity. diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -index 43fb44b8cd164b0815335a32f04879b301a54728..8d0ff6e820af9a3f67e25298b34d1539841339d8 100644 +index 43fb44b8cd164b0815335a32f04879b301a54728..318b7c7cb2a88e8d4dc4456154431fe7bfe2e0dc 100644 --- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java @@ -451,7 +451,8 @@ public class VillagerTrades { @@ -17,13 +17,13 @@ index 43fb44b8cd164b0815335a32f04879b301a54728..8d0ff6e820af9a3f67e25298b34d1539 } else { ServerLevel serverLevel = (ServerLevel)entity.level(); - BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, true); -+ if (!serverLevel.paperConfig().environment.treasureMaps.enabled) return null; // Paper -+ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredVillager); // Paper ++ if (!serverLevel.paperConfig().environment.treasureMaps.enabled) return null; // Paper - Configurable cartographer treasure maps ++ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, entity.blockPosition(), 100, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredVillager); // Paper - Configurable cartographer treasure maps if (blockPos != null) { ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true); MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -index dcc6da6641e78cd80bd148ba644475811a1fbf4d..d03d9451044bddd8403fccb9eb412c5d6803a518 100644 +index dcc6da6641e78cd80bd148ba644475811a1fbf4d..76b6544e75e52f931bed5bd9b25eda41957beaf7 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java @@ -75,7 +75,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { @@ -31,7 +31,7 @@ index dcc6da6641e78cd80bd148ba644475811a1fbf4d..d03d9451044bddd8403fccb9eb412c5d if (vec3 != null) { ServerLevel serverLevel = context.getLevel(); - BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures); -+ // Paper start ++ // Paper start - Configurable cartographer treasure maps + if (!serverLevel.paperConfig().environment.treasureMaps.enabled) { + /* + * NOTE: I fear users will just get a plain map as their "treasure" @@ -39,8 +39,8 @@ index dcc6da6641e78cd80bd148ba644475811a1fbf4d..d03d9451044bddd8403fccb9eb412c5d + */ + return stack; + } -+ // Paper end -+ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); // Paper ++ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); ++ // Paper end - Configurable cartographer treasure maps if (blockPos != null) { ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true); MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/patches/server/0119-Add-API-methods-to-control-if-armour-stands-can-move.patch b/patches/server/0119-Add-API-methods-to-control-if-armor-stands-can-move.patch similarity index 96% rename from patches/server/0119-Add-API-methods-to-control-if-armour-stands-can-move.patch rename to patches/server/0119-Add-API-methods-to-control-if-armor-stands-can-move.patch index 08f24fad48..d2511f7abe 100644 --- a/patches/server/0119-Add-API-methods-to-control-if-armour-stands-can-move.patch +++ b/patches/server/0119-Add-API-methods-to-control-if-armor-stands-can-move.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: kashike Date: Wed, 21 Dec 2016 11:47:25 -0600 -Subject: [PATCH] Add API methods to control if armour stands can move +Subject: [PATCH] Add API methods to control if armor stands can move diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java diff --git a/patches/server/0121-Properly-fix-item-duplication-bug.patch b/patches/server/0121-Properly-fix-item-duplication-bug.patch index cfd0b688a1..a4ee97b784 100644 --- a/patches/server/0121-Properly-fix-item-duplication-bug.patch +++ b/patches/server/0121-Properly-fix-item-duplication-bug.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d986c09392182335112040d4b6feae6a1a740d84..75d2213aadcbd1d0a49fd4c8cef2d4d51669c73d 100644 +index ac0b8d569a71098f92aa3d02f1f3d459e20755ab..ede3afab5c2a1d175a5beea85ffa362a3481a857 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2495,7 +2495,7 @@ public class ServerPlayer extends Player { @@ -14,12 +14,12 @@ index d986c09392182335112040d4b6feae6a1a740d84..75d2213aadcbd1d0a49fd4c8cef2d4d5 @Override public boolean isImmobile() { - return super.isImmobile() || !this.getBukkitEntity().isOnline(); -+ return super.isImmobile() || (this.connection != null && this.connection.isDisconnected()); // Paper ++ return super.isImmobile() || (this.connection != null && this.connection.isDisconnected()); // Paper - Fix duplication bugs } @Override diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 57a865c606a234556bf57486bbaa69ef54ce1370..1135da391523c464447198ce5e3743b8bd9d66e8 100644 +index 66497960995dc30abe60d26200979a78513ff2c6..4ff58939269f420fab18fea8fc3887e86297b99e 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -146,7 +146,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -27,7 +27,7 @@ index 57a865c606a234556bf57486bbaa69ef54ce1370..1135da391523c464447198ce5e3743b8 public final boolean isDisconnected() { - return !this.player.joining && !this.connection.isConnected(); -+ return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper ++ return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper - Fix duplication bugs } // CraftBukkit end diff --git a/patches/server/0124-Provide-E-TE-Chunk-count-stat-methods.patch b/patches/server/0124-Provide-E-TE-Chunk-count-stat-methods.patch index d88b54d76a..2759e67157 100644 --- a/patches/server/0124-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/patches/server/0124-Provide-E-TE-Chunk-count-stat-methods.patch @@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 720d1f9efffbc5fc74c31899f103e599aa4d3acf..2afa7c73836ddbad936cb98bde241cb91acc11b2 100644 +index 7a5865f10b87022317b5eb3a1d711a0864da9a7f..35a87775736a40ba7b4c04116c8fe007512d6161 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -119,7 +119,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -15,12 +15,12 @@ index 720d1f9efffbc5fc74c31899f103e599aa4d3acf..2afa7c73836ddbad936cb98bde241cb9 public static final int MAX_ENTITY_SPAWN_Y = 20000000; public static final int MIN_ENTITY_SPAWN_Y = -20000000; - protected final List blockEntityTickers = Lists.newArrayList(); -+ protected final List blockEntityTickers = Lists.newArrayList(); public final int getTotalTileEntityTickers() { return this.blockEntityTickers.size(); } // Paper ++ public final List blockEntityTickers = Lists.newArrayList(); // Paper - public protected final NeighborUpdater neighborUpdater; private final List pendingBlockEntityTickers = Lists.newArrayList(); private boolean tickingBlockEntities; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0a7774c4b10e6b53a78d0e7f8fdc9dceb4c95a0e..5652d7b30c7c22daef128fa49dc9dda20d2ca96b 100644 +index 3c7fdf150f39a75794a6927bd545c3eb9c480d6f..e60992a618f05174f887ce85741a127161cef408 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -157,6 +157,56 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -55,7 +55,7 @@ index 0a7774c4b10e6b53a78d0e7f8fdc9dceb4c95a0e..5652d7b30c7c22daef128fa49dc9dda2 + + @Override + public int getTickableTileEntityCount() { -+ return world.getTotalTileEntityTickers(); ++ return world.blockEntityTickers.size(); + } + + @Override diff --git a/patches/server/0126-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0126-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 8ba21c023a..af577e50e9 100644 --- a/patches/server/0126-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0126-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -21,10 +21,10 @@ index 4f3c82f1b5ae24d5f70318fa96fae2a58ce7fd9f..45236a077d798d6a257a2e982b589011 return true; diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 59bad6c92cc421dd05c7315e2ab694a669433ab4..b49e48fa6dd37b5eddb45877be90018ec9d23b0e 100644 +index 59bad6c92cc421dd05c7315e2ab694a669433ab4..ae70ad9d6c02fcb5631a3c45db283b29844bbb0d 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -39,13 +39,67 @@ public class ExperienceOrb extends Entity { +@@ -39,9 +39,63 @@ public class ExperienceOrb extends Entity { public int value; private int count; private Player followingPlayer; @@ -35,11 +35,11 @@ index 59bad6c92cc421dd05c7315e2ab694a669433ab4..b49e48fa6dd37b5eddb45877be90018e + public java.util.UUID triggerEntityId; + public org.bukkit.entity.ExperienceOrb.SpawnReason spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN; + -+ private void loadPaperNBT(CompoundTag nbttagcompound) { -+ if (!nbttagcompound.contains("Paper.ExpData", net.minecraft.nbt.Tag.TAG_COMPOUND)) { ++ private void loadPaperNBT(CompoundTag tag) { ++ if (!tag.contains("Paper.ExpData", net.minecraft.nbt.Tag.TAG_COMPOUND)) { + return; + } -+ CompoundTag comp = nbttagcompound.getCompound("Paper.ExpData"); ++ CompoundTag comp = tag.getCompound("Paper.ExpData"); + if (comp.hasUUID("source")) { + this.sourceEntityId = comp.getUUID("source"); + } @@ -55,7 +55,7 @@ index 59bad6c92cc421dd05c7315e2ab694a669433ab4..b49e48fa6dd37b5eddb45877be90018e + } + } + } -+ private void savePaperNBT(CompoundTag nbttagcompound) { ++ private void savePaperNBT(CompoundTag tag) { + CompoundTag comp = new CompoundTag(); + if (this.sourceEntityId != null) { + comp.putUUID("source", this.sourceEntityId); @@ -66,7 +66,7 @@ index 59bad6c92cc421dd05c7315e2ab694a669433ab4..b49e48fa6dd37b5eddb45877be90018e + if (this.spawnReason != null && this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) { + comp.putString("reason", this.spawnReason.name()); + } -+ nbttagcompound.put("Paper.ExpData", comp); ++ tag.put("Paper.ExpData", comp); + } + @io.papermc.paper.annotation.DoNotUse @@ -75,25 +75,19 @@ index 59bad6c92cc421dd05c7315e2ab694a669433ab4..b49e48fa6dd37b5eddb45877be90018e + this(world, x, y, z, amount, null, null); + } + -+ public ExperienceOrb(Level world, double d0, double d1, double d2, int i, @javax.annotation.Nullable org.bukkit.entity.ExperienceOrb.SpawnReason reason, @javax.annotation.Nullable Entity triggerId) { -+ this(world, d0, d1, d2, i, reason, triggerId, null); ++ public ExperienceOrb(Level world, double x, double y, double z, int amount, @javax.annotation.Nullable org.bukkit.entity.ExperienceOrb.SpawnReason reason, @javax.annotation.Nullable Entity triggerId) { ++ this(world, x, y, z, amount, reason, triggerId, null); + } + -+ public ExperienceOrb(Level world, double d0, double d1, double d2, int i, @javax.annotation.Nullable org.bukkit.entity.ExperienceOrb.SpawnReason reason, @javax.annotation.Nullable Entity triggerId, @javax.annotation.Nullable Entity sourceId) { ++ public ExperienceOrb(Level world, double x, double y, double z, int amount, @javax.annotation.Nullable org.bukkit.entity.ExperienceOrb.SpawnReason reason, @javax.annotation.Nullable Entity triggerId, @javax.annotation.Nullable Entity sourceId) { this(EntityType.EXPERIENCE_ORB, world); -- this.setPos(x, y, z); + this.sourceEntityId = sourceId != null ? sourceId.getUUID() : null; + this.triggerEntityId = triggerId != null ? triggerId.getUUID() : null; + this.spawnReason = reason != null ? reason : org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN; + // Paper end -+ this.setPos(d0, d1, d2); + this.setPos(x, y, z); this.setYRot((float) (this.random.nextDouble() * 360.0D)); this.setDeltaMovement((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D); -- this.value = amount; -+ this.value = i; - } - - public ExperienceOrb(EntityType type, Level world) { @@ -160,12 +214,20 @@ public class ExperienceOrb extends Entity { } @@ -227,7 +221,7 @@ index 2471800014d1661c2f422e5a24f0f3b00fa838f2..f5ce6423b8146cc741023e15004fe981 if (this.dragonFight != null) { 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 505e0031f2783192f1146b1b00249e7891c4f1ef..a0a313fa5e7e4e1973c020d0262e34381a19dea7 100644 +index 4034b8e7503f611dc9be121d8da2020ae7155b8c..f0d5e45d0d6ac51106379d20690d34a032a24c39 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -638,7 +638,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler diff --git a/patches/server/0127-Cap-Entity-Collisions.patch b/patches/server/0127-Cap-Entity-Collisions.patch index 3a5642f78d..630d692f83 100644 --- a/patches/server/0127-Cap-Entity-Collisions.patch +++ b/patches/server/0127-Cap-Entity-Collisions.patch @@ -12,33 +12,33 @@ just as it does in Vanilla, but entity pushing logic will be capped. You can set this to 0 to disable collisions. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index edbfc7bc783833a62542a4515dde13034ae29c10..515d0f3a7ea6f19ce8f1cb16d798d898894be445 100644 +index edbfc7bc783833a62542a4515dde13034ae29c10..fbdb708379dc77ce90ca2ca90ebd0bd49ebec12f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -394,6 +394,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S public void inactiveTick() { } // Spigot end // Paper start -+ protected int numCollisions = 0; // Paper ++ protected int numCollisions = 0; // Paper - Cap entity collisions @javax.annotation.Nullable private org.bukkit.util.Vector origin; @javax.annotation.Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 77a4122cf5a11b29b14a7fc4ac6420ccea49af1b..202e3b66a81de2f76d5a8bba3538f1554b8debf3 100644 +index 77a4122cf5a11b29b14a7fc4ac6420ccea49af1b..e2635fc1a80629f8ea1ddd406785be8b07f4f140 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3348,10 +3348,12 @@ public abstract class LivingEntity extends Entity implements Attackable { } Iterator iterator1 = list.iterator(); -+ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper ++ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper - Cap entity collisions - while (iterator1.hasNext()) { -+ while (iterator1.hasNext() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions) { // Paper ++ while (iterator1.hasNext() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions) { // Paper - Cap entity collisions Entity entity1 = (Entity) iterator1.next(); - -+ entity1.numCollisions++; // Paper -+ this.numCollisions++; // Paper ++ entity1.numCollisions++; // Paper - Cap entity collisions ++ this.numCollisions++; // Paper - Cap entity collisions this.doPush(entity1); } } diff --git a/patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch index 4956a8d9a7..62d5f2a255 100644 --- a/patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch +++ b/patches/server/0130-Add-option-to-make-parrots-stay-on-shoulders-despite.patch @@ -14,7 +14,7 @@ To be converted into a Paper-API event at some point in the future? public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 121cbb94863b7bd6d47ff73ffafb2ef600ad6a96..c90bcd4df41c847c6a33a33efb4c6383894b8a67 100644 +index 4c689d2a794e53a2d9915f1ba46435c41bfa74e9..03bc7ae947360a721fef5a772ecadb4a18ac73b2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2184,6 +2184,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -22,24 +22,24 @@ index 121cbb94863b7bd6d47ff73ffafb2ef600ad6a96..c90bcd4df41c847c6a33a33efb4c6383 case PRESS_SHIFT_KEY: this.player.setShiftKeyDown(true); + -+ // Paper start - Hang on! ++ // Paper start - Add option to make parrots stay + if (this.player.level().paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) { + this.player.removeEntitiesOnShoulder(); + } -+ // Paper end ++ // Paper end - Add option to make parrots stay + break; case RELEASE_SHIFT_KEY: this.player.setShiftKeyDown(false); diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index c2725113b3ec36a79c88bcf9837c0ef2955b613e..09d5561deb40549ce6a7661ebfd9b9db24db0d12 100644 +index c2725113b3ec36a79c88bcf9837c0ef2955b613e..45b56ca0ec79669cb41d0a14603e2f9ba140c1f1 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -589,6 +589,7 @@ public abstract class Player extends LivingEntity { this.playShoulderEntityAmbientSound(this.getShoulderEntityLeft()); this.playShoulderEntityAmbientSound(this.getShoulderEntityRight()); if (!this.level().isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { -+ if (!this.level().paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) // Paper - Hang on! ++ if (!this.level().paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) // Paper - Add option to make parrots stay this.removeEntitiesOnShoulder(); } diff --git a/patches/server/0133-provide-a-configurable-option-to-disable-creeper-lin.patch b/patches/server/0133-provide-a-configurable-option-to-disable-creeper-lin.patch index f21ade656c..6b82339bcc 100644 --- a/patches/server/0133-provide-a-configurable-option-to-disable-creeper-lin.patch +++ b/patches/server/0133-provide-a-configurable-option-to-disable-creeper-lin.patch @@ -6,7 +6,7 @@ Subject: [PATCH] provide a configurable option to disable creeper lingering diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -index 25c4092d8d28b04b7ba5caee592b96530a08227c..6594d501f51d18f5850999cceb9febfe206ec596 100644 +index 1c6ebab20ac03f0553e2a25eff10171a39e06a3f..db7485806d90fe90f806736ac55143564488467d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java @@ -287,7 +287,7 @@ public class Creeper extends Monster implements PowerableMob { @@ -14,7 +14,7 @@ index 25c4092d8d28b04b7ba5caee592b96530a08227c..6594d501f51d18f5850999cceb9febfe Collection collection = this.getActiveEffects(); - if (!collection.isEmpty()) { -+ if (!collection.isEmpty() && !this.level().paperConfig().entities.behavior.disableCreeperLingeringEffect) { // Paper ++ if (!collection.isEmpty() && !this.level().paperConfig().entities.behavior.disableCreeperLingeringEffect) { // Paper - Option to disable creeper lingering effect AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ()); entityareaeffectcloud.setOwner(this); // CraftBukkit diff --git a/patches/server/0134-Item-canEntityPickup.patch b/patches/server/0134-Item-canEntityPickup.patch index 5494504d8d..67309fbb0b 100644 --- a/patches/server/0134-Item-canEntityPickup.patch +++ b/patches/server/0134-Item-canEntityPickup.patch @@ -5,30 +5,30 @@ Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 3d054cfa5050f4b75eab4a18035655c1bfd9290b..fa0e96fd884a0338b44f68506b1d3ee6c42f17b1 100644 +index 3d054cfa5050f4b75eab4a18035655c1bfd9290b..374a91e712c2a6a8ad87d1047bb07d44eaa9908a 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -670,6 +670,11 @@ public abstract class Mob extends LivingEntity implements Targeting { ItemEntity entityitem = (ItemEntity) iterator.next(); if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) { -+ // Paper start ++ // Paper start - Item#canEntityPickup + if (!entityitem.canMobPickup) { + continue; + } -+ // Paper end ++ // Paper end - Item#canEntityPickup this.pickUpItem(entityitem); } } 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 5bb26ca5c81635d27ca59352d5184d8b4300e0b5..6905090f030c86f640e841e94c32ad90acb75d2a 100644 +index 5bb26ca5c81635d27ca59352d5184d8b4300e0b5..6c2e22f1b2b1ce2903c0ee1d2dbde96b40bd1624 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -54,6 +54,7 @@ public class ItemEntity extends Entity implements TraceableEntity { public UUID target; public final float bobOffs; private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit -+ public boolean canMobPickup = true; // Paper ++ public boolean canMobPickup = true; // Paper - Item#canEntityPickup public ItemEntity(EntityType type, Level world) { super(type, world); diff --git a/patches/server/0135-PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/server/0135-PlayerPickupItemEvent-setFlyAtPlayer.patch index 1619a5d255..ced79db4dd 100644 --- a/patches/server/0135-PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/patches/server/0135-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer 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 6905090f030c86f640e841e94c32ad90acb75d2a..afb01096f41ed76e431848466d02aaefdc0c69c7 100644 +index 6c2e22f1b2b1ce2903c0ee1d2dbde96b40bd1624..1d7d3a7e3b4153b97d69eb1ae6e43a43a4ebabd4 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -423,6 +423,7 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -35,7 +35,7 @@ index 6905090f030c86f640e841e94c32ad90acb75d2a..afb01096f41ed76e431848466d02aaef // CraftBukkit end if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemstack)) { -+ if (flyAtPlayer) // Paper ++ if (flyAtPlayer) // Paper - PlayerPickupItemEvent player.take(this, i); if (itemstack.isEmpty()) { this.discard(); diff --git a/patches/server/0136-PlayerAttemptPickupItemEvent.patch b/patches/server/0136-PlayerAttemptPickupItemEvent.patch index c0836a703c..55df96a705 100644 --- a/patches/server/0136-PlayerAttemptPickupItemEvent.patch +++ b/patches/server/0136-PlayerAttemptPickupItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent 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 6847d100a6fe2b57d7986b121f5ce0f981cfa415..18c9c7c2b0605bee2936fbb084108dd9791f7ebe 100644 +index 1d7d3a7e3b4153b97d69eb1ae6e43a43a4ebabd4..1523be0c9f7ae3b8015b8017797601489c068e8c 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -36,6 +36,7 @@ import org.bukkit.entity.Player; @@ -20,7 +20,7 @@ index 6847d100a6fe2b57d7986b121f5ce0f981cfa415..18c9c7c2b0605bee2936fbb084108dd9 int remaining = i - canHold; boolean flyAtPlayer = false; // Paper -+ // Paper start ++ // Paper start - PlayerAttemptPickupItemEvent + if (this.pickupDelay <= 0) { + PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); + this.level().getCraftServer().getPluginManager().callEvent(attemptEvent); @@ -34,7 +34,7 @@ index 6847d100a6fe2b57d7986b121f5ce0f981cfa415..18c9c7c2b0605bee2936fbb084108dd9 + return; + } + } -+ // Paper end ++ // Paper end - PlayerAttemptPickupItemEvent + if (this.pickupDelay <= 0 && canHold > 0) { itemstack.setCount(canHold); diff --git a/patches/server/0137-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0137-Do-not-submit-profile-lookups-to-worldgen-threads.patch index 42071875fc..36723921bc 100644 --- a/patches/server/0137-Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/0137-Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -37,7 +37,7 @@ index 114f4017c4133042178c57d424f10079163835dd..aa52b271bd556a29f774fde375b713d0 private static final int LINEAR_LOOKUP_THRESHOLD = 8; public static final long NANOS_PER_MILLI = 1000000L; diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 09de1ca3802e97442bc090db0cc87fd833ad3a9f..9c500642eb2b59bf9aabd6b5d563e5fb15603056 100644 +index 64f7c3180a745a62bb5d71a42668cc67b5d56c3a..bbd8cf8b9f51cb5ca881a54df2e6d6227c0bfd6c 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -169,7 +169,7 @@ public class GameProfileCache { @@ -45,12 +45,12 @@ index 09de1ca3802e97442bc090db0cc87fd833ad3a9f..9c500642eb2b59bf9aabd6b5d563e5fb CompletableFuture> completablefuture1 = CompletableFuture.supplyAsync(() -> { return this.get(username); - }, Util.backgroundExecutor()).whenCompleteAsync((optional, throwable) -> { -+ }, Util.PROFILE_EXECUTOR).whenCompleteAsync((optional, throwable) -> { // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor ++ }, Util.PROFILE_EXECUTOR).whenCompleteAsync((optional, throwable) -> { // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread this.requests.remove(username); }, this.executor); diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -index bffc770105800ba78c6d9bfb56ad9ad425f19910..92b770d10f34596ce52392a0db1ccd825108730b 100644 +index bffc770105800ba78c6d9bfb56ad9ad425f19910..d0b3a836de9830a4da534bedd9f94a16a82ef9c6 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java @@ -80,7 +80,7 @@ public class SkullBlockEntity extends BlockEntity { @@ -58,12 +58,12 @@ index bffc770105800ba78c6d9bfb56ad9ad425f19910..92b770d10f34596ce52392a0db1ccd82 return Optional.empty(); } - }, Util.backgroundExecutor()); -+ }, Util.PROFILE_EXECUTOR); // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor ++ }, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java -index 358af0121ce3d87a9f51da2bae0699034c1560b4..91e913f8652584ffab44c44d10c0e0c47707e261 100644 +index 358af0121ce3d87a9f51da2bae0699034c1560b4..edd340c66ea8cec1c76ba29f1deab14c4784a7e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java +++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java @@ -122,7 +122,7 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -71,7 +71,7 @@ index 358af0121ce3d87a9f51da2bae0699034c1560b4..91e913f8652584ffab44c44d10c0e0c4 @Override public CompletableFuture update() { - return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.backgroundExecutor()); -+ return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.PROFILE_EXECUTOR); // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor ++ return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread } private CraftPlayerProfile getUpdatedProfile() { diff --git a/patches/server/0139-Add-UnknownCommandEvent.patch b/patches/server/0139-Add-UnknownCommandEvent.patch index 79dd3b5bba..38cfb8b04d 100644 --- a/patches/server/0139-Add-UnknownCommandEvent.patch +++ b/patches/server/0139-Add-UnknownCommandEvent.patch @@ -6,33 +6,33 @@ Subject: [PATCH] Add UnknownCommandEvent Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index b836a85ce3a4374e94061fe9368e86a61522615d..ae7be8678ab2859b8eb5e04bc31d76271a74c66b 100644 +index f6938c35ac6f6116084d3e7ec9cdc918f20b6f61..edf49f2d9921b4517fb98929d842f7a62c5549df 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -334,8 +334,13 @@ public class CommandSourceStack implements ExecutionCommandSource dispatcher = new com.mojang.brigadier.CommandDispatcher(); -+ public final java.util.List> vanillaCommandNodes = new java.util.ArrayList<>(); // Paper ++ public final java.util.List> vanillaCommandNodes = new java.util.ArrayList<>(); // Paper - Add UnknownCommandEvent public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) { this(); // CraftBukkit @@ -40,7 +40,7 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..5a1accff1a7dc2ab40224ec0952a287c if (environment.includeIntegrated) { PublishCommand.register(this.dispatcher); } -+ this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper ++ this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper - Add UnknownCommandEvent // CraftBukkit start } @@ -49,7 +49,7 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..5a1accff1a7dc2ab40224ec0952a287c return "/" + s; }); - ContextChain contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit -+ ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - make finishParsing not static ++ ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent try { if (contextchain != null) { @@ -58,7 +58,7 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..5a1accff1a7dc2ab40224ec0952a287c @Nullable - private static ContextChain finishParsing(ParseResults parseresults, String s, CommandSourceStack commandlistenerwrapper, String label) { // CraftBukkit -+ private ContextChain finishParsing(ParseResults parseresults, String s, CommandSourceStack commandlistenerwrapper, String label) { // CraftBukkit // Paper - make not static ++ private ContextChain finishParsing(ParseResults parseresults, String s, CommandSourceStack commandlistenerwrapper, String label) { // CraftBukkit // Paper - Add UnknownCommandEvent try { Commands.validateParseResults(parseresults); return (ContextChain) ContextChain.tryFlatten(parseresults.getContext().build(s)).orElseThrow(() -> { @@ -66,7 +66,7 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..5a1accff1a7dc2ab40224ec0952a287c }); } catch (CommandSyntaxException commandsyntaxexception) { - commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage())); -+ // Paper start ++ // Paper start - Add UnknownCommandEvent + final net.kyori.adventure.text.TextComponent.Builder builder = net.kyori.adventure.text.Component.text(); + if ((parseresults.getContext().getNodes().isEmpty() || !this.vanillaCommandNodes.contains(parseresults.getContext().getNodes().get(0).getNode()))) { + if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { @@ -75,24 +75,16 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..5a1accff1a7dc2ab40224ec0952a287c + } else { + // commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage())); + builder.color(net.kyori.adventure.text.format.NamedTextColor.RED).append(io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(commandsyntaxexception.getRawMessage())); -+ // Paper end ++ // Paper end - Add UnknownCommandEvent if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) { int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor()); MutableComponent ichatmutablecomponent = Component.empty().withStyle(ChatFormatting.GRAY).withStyle((chatmodifier) -> { -@@ -380,6 +391,7 @@ public class Commands { - ichatmutablecomponent.append(CommonComponents.ELLIPSIS); - } - -+ - ichatmutablecomponent.append(commandsyntaxexception.getInput().substring(Math.max(0, i - 10), i)); - if (i < commandsyntaxexception.getInput().length()) { - MutableComponent ichatmutablecomponent1 = Component.literal(commandsyntaxexception.getInput().substring(i)).withStyle(ChatFormatting.RED, ChatFormatting.UNDERLINE); -@@ -388,7 +400,18 @@ public class Commands { +@@ -388,7 +399,18 @@ public class Commands { } ichatmutablecomponent.append((Component) Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC)); - commandlistenerwrapper.sendFailure(ichatmutablecomponent); -+ // Paper start ++ // Paper start - Add UnknownCommandEvent + // commandlistenerwrapper.sendFailure(ichatmutablecomponent); + builder + .append(net.kyori.adventure.text.Component.newline()) @@ -103,12 +95,12 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..5a1accff1a7dc2ab40224ec0952a287c + org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event); + if (event.message() != null) { + commandlistenerwrapper.sendFailure(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false); -+ // Paper end ++ // Paper end - Add UnknownCommandEvent } return null; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a4426373070ca065884ae80e6aa9215df89c741d..a41b39a7b8f6011327584d5556ddb304a6e32e4b 100644 +index f06afed5f786aad4415cd369903d97a0912dfac7..b56bfa447a15d56bf24c1bb4c05f74584cf37ad3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -527,6 +527,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0142-Block-player-logins-during-server-shutdown.patch b/patches/server/0142-Block-player-logins-during-server-shutdown.patch index 85cf55389a..3de7220f12 100644 --- a/patches/server/0142-Block-player-logins-during-server-shutdown.patch +++ b/patches/server/0142-Block-player-logins-during-server-shutdown.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Block player logins during server shutdown diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index db07502d4d7b73c0e74814334be6603121f60673..a738f70c9c2f8832277a239e6d79d91d663d4cf9 100644 +index c5b451a706240dbd6719e001825c6859fc1b2a49..33bd60b5ef7383061acf2da24cfee35b495ebfc7 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -74,6 +74,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -17,7 +17,7 @@ index db07502d4d7b73c0e74814334be6603121f60673..a738f70c9c2f8832277a239e6d79d91d + this.disconnect(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(org.spigotmc.SpigotConfig.restartMessage)[0]); + return; + } -+ // Paper end ++ // Paper end - Do not allow logins while the server is shutting down if (this.state == ServerLoginPacketListenerImpl.State.VERIFYING) { this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile)); } diff --git a/patches/server/0143-Entity-fromMobSpawner.patch b/patches/server/0143-Entity-fromMobSpawner.patch index de3adaf377..130ee5def8 100644 --- a/patches/server/0143-Entity-fromMobSpawner.patch +++ b/patches/server/0143-Entity-fromMobSpawner.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 515d0f3a7ea6f19ce8f1cb16d798d898894be445..d66d30a016ac04d5f051e59ca168a6c2bb8794ab 100644 +index fbdb708379dc77ce90ca2ca90ebd0bd49ebec12f..4ccdb5ca52700249cb0a24dff186e8cf047df2bb 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -395,6 +395,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S // Spigot end // Paper start - protected int numCollisions = 0; // Paper + protected int numCollisions = 0; // Paper - Cap entity collisions + public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @javax.annotation.Nullable private org.bukkit.util.Vector origin; diff --git a/patches/server/0145-Implement-ensureServerConversions-API.patch b/patches/server/0145-ensureServerConversions-API.patch similarity index 97% rename from patches/server/0145-Implement-ensureServerConversions-API.patch rename to patches/server/0145-ensureServerConversions-API.patch index c4acab74e4..976464eb54 100644 --- a/patches/server/0145-Implement-ensureServerConversions-API.patch +++ b/patches/server/0145-ensureServerConversions-API.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 May 2016 22:43:12 -0400 -Subject: [PATCH] Implement ensureServerConversions API +Subject: [PATCH] ensureServerConversions API This will take a Bukkit ItemStack and run it through any conversions a server process would perform on it, to ensure it meets latest minecraft expectations. diff --git a/patches/server/0147-ProfileWhitelistVerifyEvent.patch b/patches/server/0147-ProfileWhitelistVerifyEvent.patch index 46edc414f4..1ac23dfe60 100644 --- a/patches/server/0147-ProfileWhitelistVerifyEvent.patch +++ b/patches/server/0147-ProfileWhitelistVerifyEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index ea7effdb4274c7e2c19d737a74b1fc5847b9888c..6e0a21935f9d5f35cbce72b32e0a89bb636804e2 100644 +index ea7effdb4274c7e2c19d737a74b1fc5847b9888c..29b4399e0f78067ee84748bb15b3978aa6bcd719 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -631,9 +631,9 @@ public abstract class PlayerList { @@ -15,7 +15,7 @@ index ea7effdb4274c7e2c19d737a74b1fc5847b9888c..6e0a21935f9d5f35cbce72b32e0a89bb - } else if (!this.isWhiteListed(gameprofile)) { - ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure -+ } else if (!this.isWhiteListed(gameprofile, event)) { // Paper ++ } else if (!this.isWhiteListed(gameprofile, event)) { // Paper - ProfileWhitelistVerifyEvent + //ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); // Paper + //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure - moved to isWhitelisted } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { @@ -26,7 +26,7 @@ index ea7effdb4274c7e2c19d737a74b1fc5847b9888c..6e0a21935f9d5f35cbce72b32e0a89bb public boolean isWhiteListed(GameProfile profile) { - return !this.doWhiteList || this.ops.contains(profile) || this.whitelist.contains(profile); -+ // Paper start ++ // Paper start - ProfileWhitelistVerifyEvent + return isWhiteListed(profile, null); + } + public boolean isWhiteListed(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) { @@ -42,7 +42,7 @@ index ea7effdb4274c7e2c19d737a74b1fc5847b9888c..6e0a21935f9d5f35cbce72b32e0a89bb + return false; + } + return true; -+ // Paper end ++ // Paper end - ProfileWhitelistVerifyEvent } public boolean isOp(GameProfile profile) { diff --git a/patches/server/0156-handle-ServerboundKeepAlivePacket-async.patch b/patches/server/0156-handle-ServerboundKeepAlivePacket-async.patch index f3a7c75441..0075be7038 100644 --- a/patches/server/0156-handle-ServerboundKeepAlivePacket-async.patch +++ b/patches/server/0156-handle-ServerboundKeepAlivePacket-async.patch @@ -15,7 +15,7 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 7947a1d2e5f66c29dc11f9966233604adae71a86..0fcedb954c20d9777d27d896e29cea7f6eebffd3 100644 +index 4ff58939269f420fab18fea8fc3887e86297b99e..156cb6a00a2580eb16e05c80bc3267128b5804a3 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -84,14 +84,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -35,7 +35,7 @@ index 7947a1d2e5f66c29dc11f9966233604adae71a86..0fcedb954c20d9777d27d896e29cea7f + server.submit(() -> { + this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); + }); -+ // Paper endg - This needs to be handled on the main thread for plugins ++ // Paper end - This needs to be handled on the main thread for plugins } } diff --git a/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch index 2c62fd9c88..28f5efe52b 100644 --- a/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/patches/server/0161-Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index e15c5886b1cc80b5da2ad8e536507a48cea77d2a..e84b0a6e3767605b7af3e7120517808e25039702 100644 +index c01596f87efd316816b597b83c3cac1dbddc22c2..abfeaa9485b71d0b802c41bfd8e113d0bc9e9773 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -81,7 +81,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, } - // Paper end + // Paper end - Do not allow logins while the server is shutting down 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)); diff --git a/patches/server/0234-Use-ConcurrentHashMap-in-JsonList.patch b/patches/server/0234-Use-ConcurrentHashMap-in-JsonList.patch index 118f8ba7bb..7e2c9a02b1 100644 --- a/patches/server/0234-Use-ConcurrentHashMap-in-JsonList.patch +++ b/patches/server/0234-Use-ConcurrentHashMap-in-JsonList.patch @@ -23,11 +23,11 @@ Modified isEmpty to use the isEmpty() method instead of the slightly confusing s The point of this is readability, but does have a side-benefit of a small microptimization diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b4643717c98193884a43089ec7a7e362b7153d20..af26a2b45cba7083f3bd7ddbbfde5bcfb30f1907 100644 +index a0779dfcbcfad3807163bc309ac4003114898394..88f27be746b5ca02bde3001d57a105f779271bdb 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -634,7 +634,7 @@ public abstract class PlayerList { - } else if (!this.isWhiteListed(gameprofile, event)) { // Paper + } else if (!this.isWhiteListed(gameprofile, event)) { // Paper - ProfileWhitelistVerifyEvent //ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); // Paper //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure - moved to isWhitelisted - } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { diff --git a/patches/server/0286-Async-command-map-building.patch b/patches/server/0286-Async-command-map-building.patch index 3ab586b43b..5ed527dc5a 100644 --- a/patches/server/0286-Async-command-map-building.patch +++ b/patches/server/0286-Async-command-map-building.patch @@ -9,10 +9,10 @@ commands if the server is restarting. Using the default async pool caused issues due to the shutdown logic generally being much later. diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 5a1accff1a7dc2ab40224ec0952a287cd6099aee..2b722091920116ded43ff54c413d4dd47da65ed4 100644 +index 15a5059994371da4850adcf726034a715b80efba..af7cb518a32a4d550eae833fdd5bb17fd4058717 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -458,6 +458,24 @@ public class Commands { +@@ -457,6 +457,24 @@ public class Commands { if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot // CraftBukkit start // Register Vanilla commands into builtRoot as before @@ -37,7 +37,7 @@ index 5a1accff1a7dc2ab40224ec0952a287cd6099aee..2b722091920116ded43ff54c413d4dd4 Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues RootCommandNode vanillaRoot = new RootCommandNode(); -@@ -475,7 +493,14 @@ public class Commands { +@@ -474,7 +492,14 @@ public class Commands { for (CommandNode node : rootcommandnode.getChildren()) { bukkit.add(node.getName()); } @@ -53,7 +53,7 @@ index 5a1accff1a7dc2ab40224ec0952a287cd6099aee..2b722091920116ded43ff54c413d4dd4 event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bfcb155b1e8b04edfdbd26f4cc3bc2b4a7cbf5ea..06d70213a9f19bbd2a0f22a26af2dbb989bca5ce 100644 +index ee21ba8a6cd3e02bddbf090180b0e3186151813b..04e00e02848e15cad4efe8818da46de5d2f14080 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -926,6 +926,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { runSync(player, bukkit, rootcommandnode); }); -@@ -501,6 +502,7 @@ public class Commands { +@@ -500,6 +501,7 @@ public class Commands { private void runSync(ServerPlayer player, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Perf: Async command map building @@ -118,7 +118,7 @@ index 2b722091920116ded43ff54c413d4dd47da65ed4..867f22bdeed5f1c3f063a5815a3477d1 PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); event.getPlayer().getServer().getPluginManager().callEvent(event); -@@ -519,6 +521,11 @@ public class Commands { +@@ -518,6 +520,11 @@ public class Commands { while (iterator.hasNext()) { CommandNode commandnode2 = (CommandNode) iterator.next(); @@ -131,7 +131,7 @@ index 2b722091920116ded43ff54c413d4dd47da65ed4..867f22bdeed5f1c3f063a5815a3477d1 if (commandnode2.canUse(source)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c522763bd17205d31f3c37b5e582a449b2b7e06f..7b373eb64752e03227beedd41c1a7cb271d814f1 100644 +index 4d907d43015b9a8aa5298ec9a641580f82058f1d..2d00a3d669bf76c2aba12cf258dcd43d90ad8c82 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -740,8 +740,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0293-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0293-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 66a3fbc5b9..895e2138ad 100644 --- a/patches/server/0293-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0293-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -368,22 +368,22 @@ index cc658a61065d5c0021a4b88fa58b40211b94f8ec..da11266a0a23f446196e6facf2c358cf return false; } diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index d870fbec236a3660f12e0f45cf9431067b18468b..caeead6c6082855f1651ee28263cc9f60423ca0c 100644 +index 187b2cf175ba5cea94158d29b53993dc5a7c5b94..9db7fc8c053aa9e929fa6dddf70290a8f7ad5273 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -63,10 +63,12 @@ public class ServerConnectionListener { final List connections = Collections.synchronizedList(Lists.newArrayList()); - // Paper start - prevent blocking on adding a new network manager while the server is ticking + // Paper start - prevent blocking on adding a new connection while the server is ticking private final java.util.Queue pending = new java.util.concurrent.ConcurrentLinkedQueue<>(); + private static final boolean disableFlushConsolidation = Boolean.getBoolean("Paper.disableFlushConsolidate"); // Paper - Optimize network private final void addPending() { - Connection manager = null; - while ((manager = pending.poll()) != null) { - connections.add(manager); -+ manager.isPending = false; // Paper - Optimize network + Connection connection; + while ((connection = pending.poll()) != null) { + connections.add(connection); ++ connection.isPending = false; // Paper - Optimize network } } - // Paper end + // Paper end - prevent blocking on adding a new connection while the server is ticking @@ -103,6 +105,7 @@ public class ServerConnectionListener { ; } diff --git a/patches/server/0327-Entity-Activation-Range-2.0.patch b/patches/server/0327-Entity-Activation-Range-2.0.patch index c81b7c9271..64934fdb10 100644 --- a/patches/server/0327-Entity-Activation-Range-2.0.patch +++ b/patches/server/0327-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 b3e1ac038eba2153b3358f6d79861ee73b576fe8..5f6eca4e652ab96a8697e908d11a66e4eb551409 100644 +index e29c63bb29a07259c23acdb700a680344bd22672..68d6274d9b78138da228f6ce74a6c6b34eced2b0 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; @@ -112,18 +112,18 @@ index b3e1ac038eba2153b3358f6d79861ee73b576fe8..5f6eca4e652ab96a8697e908d11a66e4 } 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 546f1ba9bb5e4c6135d8205d7421aeae0a3bbd89..31c1e5c5e0ccd1c7bd65e5f52121f0af444f73fa 100644 +index 8d1f1c694a6ad073597934531db57fa11c99fc1c..0d51b57a302d908cfc40ff3a2e0b7c616a1a6113 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -396,6 +396,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S - public void inactiveTick() { } +@@ -397,6 +397,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S // Spigot end // Paper start + protected int numCollisions = 0; // Paper - Cap entity collisions + public long activatedImmunityTick = Integer.MIN_VALUE; // Paper -+ public boolean isTemporarilyActive = false; // Paper - protected int numCollisions = 0; // Paper ++ public boolean isTemporarilyActive; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @javax.annotation.Nullable + private org.bukkit.util.Vector origin; @@ -968,6 +970,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } else { this.wasOnFire = this.isOnFire(); @@ -148,7 +148,7 @@ index 546f1ba9bb5e4c6135d8205d7421aeae0a3bbd89..31c1e5c5e0ccd1c7bd65e5f52121f0af 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 40becb18c6afae979875b684c1816e84970babb5..321076a70653b5b499eb56ce3d9b2b0a4a8b92dc 100644 +index 7d0ccdd4b144afed8a93256941b3d8618c847f4d..a04240f64541009f342bcdeb725ccb04c65b697b 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -221,6 +221,19 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -244,7 +244,7 @@ index 9fc374c17f6b3ee4ab3c582d05e96321b772f2d6..07519c817cc6de04a98198c43a0c2b02 } } 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 0429b927e63ec12f53a6ce1ebe1e64d99bf7e129..c0aa370367856a159412dd141f683b7d51e11c8b 100644 +index bfd156acbae31619234fffb1804726090802fbae..7956c1ec7bf6b9fe224ec14bb695c0b8ca9dcf2d 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -227,17 +227,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -340,7 +340,7 @@ index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6 + } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1b5b703350a5c3645658429b0cd5d8aa56f647fe..12d9bcbd37b7ef67f2b922a13da7dbc3ba9838c1 100644 +index 92c85ed4eb72b950fc819b5d47ca379697ff864b..d86f158bdaefe6a71c8f48fe44c7370de158e2ea 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -162,6 +162,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0329-Alternative-item-despawn-rate.patch b/patches/server/0329-Alternative-item-despawn-rate.patch index 2928674288..ea7f7848df 100644 --- a/patches/server/0329-Alternative-item-despawn-rate.patch +++ b/patches/server/0329-Alternative-item-despawn-rate.patch @@ -6,13 +6,13 @@ Subject: [PATCH] Alternative item-despawn-rate Co-authored-by: Noah van der Aa 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 16c30342ac9ebf5cffa0bf23ab9700b6704a1ec0..ffbeea768cbb09b6f828ef1a9394c9fe50e99914 100644 +index 7d12bedc4b80b9bcf50f468a9204191bea0894c1..7f8b35d6ae27086fa128abfe9b2369bb6c91ce60 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -56,6 +56,7 @@ public class ItemEntity extends Entity implements TraceableEntity { public final float bobOffs; private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit - public boolean canMobPickup = true; // Paper + public boolean canMobPickup = true; // Paper - Item#canEntityPickup + private int despawnRate = -1; // Paper - Alternative item-despawn-rate public ItemEntity(EntityType type, Level world) { diff --git a/patches/server/0341-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0341-Add-option-to-nerf-pigmen-from-nether-portals.patch index b2c02c4223..5dd4de2336 100644 --- a/patches/server/0341-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0341-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -5,17 +5,17 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2c8e2ed7199c33f5c4fe25faa9f60fa74982de35..9efddedbe5feebf2f91eb674a9224054dba6cff3 100644 +index d19e64b6c1b85829b62854abef0987f62c616d54..b6b4be7f49ae756ebbda59e55dee98000aec2314 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -398,6 +398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S - // Paper start +@@ -399,6 +399,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S + protected int numCollisions = 0; // Paper - Cap entity collisions public long activatedImmunityTick = Integer.MIN_VALUE; // Paper - public boolean isTemporarilyActive = false; // Paper + public boolean isTemporarilyActive; // Paper + public boolean fromNetherPortal; // Paper - Add option to nerf pigmen from nether portals - protected int numCollisions = 0; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @javax.annotation.Nullable + private org.bukkit.util.Vector origin; @@ -2232,6 +2233,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S if (spawnedViaMobSpawner) { nbttagcompound.putBoolean("Paper.FromMobSpawner", true); diff --git a/patches/server/0572-Add-Channel-initialization-listeners.patch b/patches/server/0572-Add-Channel-initialization-listeners.patch index 79b5424dbb..b863a22fc3 100644 --- a/patches/server/0572-Add-Channel-initialization-listeners.patch +++ b/patches/server/0572-Add-Channel-initialization-listeners.patch @@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..0d7e7db9e37ef0183c32b217bd944fb4 + COMPRESSION_DISABLED +} diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 751d24a29cf3797234adbb1eb3b64b7fb261b24e..18228713d61cbc4b6fad881ace991e5e6c64e57d 100644 +index dd7deb9175059857c59c85c745053cc88a922d3b..6e75a5e7eb51a5bbb7b73436bbd37df1519cb0fc 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -717,6 +717,7 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -142,11 +142,11 @@ index 751d24a29cf3797234adbb1eb3b64b7fb261b24e..18228713d61cbc4b6fad881ace991e5e } diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index b2bfb3893200362ac35ae60982f203f86a1148ec..4414b12218a5693fecaa8c1e7c7676a58bcad324 100644 +index dfa07c9ede9d748a05ee47826bdbcf7390ec8219..b69483e248cd84293b9d4b9df2f5ccd2a80c14cd 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -116,6 +116,7 @@ public class ServerConnectionListener { - pending.add(object); // Paper + pending.add(object); // Paper - prevent blocking on adding a new connection while the server is ticking ((Connection) object).configurePacketHandler(channelpipeline); ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); + io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper - Add Channel initialization listeners diff --git a/patches/server/0573-Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/0573-Send-empty-commands-if-tab-completion-is-disabled.patch index 30839f96f4..f385186300 100644 --- a/patches/server/0573-Send-empty-commands-if-tab-completion-is-disabled.patch +++ b/patches/server/0573-Send-empty-commands-if-tab-completion-is-disabled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Send empty commands if tab completion is disabled diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index f844f7ae935b55d254c422b702a8ca2a81119baa..7802e72152628d1e853e5494ec1061fe01fefa5f 100644 +index 0741c0f85536c5188d8552e999943a9c771a548e..c11977dceeba4120cdb63972c4ec486640d8114e 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -456,7 +456,12 @@ public class Commands { +@@ -455,7 +455,12 @@ public class Commands { } public void sendCommands(ServerPlayer player) { diff --git a/patches/server/0586-Fix-and-optimise-world-force-upgrading.patch b/patches/server/0586-Fix-and-optimise-world-force-upgrading.patch index ac253f3a9b..31350fb93e 100644 --- a/patches/server/0586-Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/0586-Fix-and-optimise-world-force-upgrading.patch @@ -267,7 +267,7 @@ index 1cad3585ca122a465572b16d4ecbb7231e87c7de..b0a0909fa9501dfacfbe70dc4118062d Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dimensionOptionsRegistry, eraseCache); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d99217292a094713287cd597c9d7c01f04b9c7c7..748a5d8add76d4533fae2647c6e2439f518ac211 100644 +index 4a270f4a59be4dfe7d9f6baf7388a0d8d70e1bf6..2a000635c18878377b2f434929e460e809b02cc4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -586,11 +586,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions - public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here + public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here + // Paper start - fix and optimise world upgrading + // copied from below @@ -352,7 +352,7 @@ index 8563383d45f89ee01dd5df13af5bd0cf1b3d7b01..9e30b47ece5549c30f487e5542ae65d5 return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ())); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 05868e37b03ac912ac902b105f3956f9351b1209..08d43545262e2be74566c270f3dd2c600b773616 100644 +index 6fff086f1a6ffd02945ac30d5041b61d289e8478..ffc6e2a5e2b6e3f4595249d470e531cd555789af 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1251,9 +1251,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0594-Add-PlayerKickEvent-causes.patch b/patches/server/0594-Add-PlayerKickEvent-causes.patch index d9189e2200..740dc9be34 100644 --- a/patches/server/0594-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0594-Add-PlayerKickEvent-causes.patch @@ -100,7 +100,7 @@ index b9560b4ae5c0867396006119c5dadd7f3b47f78b..f3e32da770f379d46c65a0ba5a100b5f return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason); }, true); diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 7c17c3d4f4f5ebc42186fcc98008bda062715e55..01b6c3b67d6078e9877729a955ec51f0313e5a90 100644 +index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef03b6207a0 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -95,7 +95,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -110,7 +110,7 @@ index 7c17c3d4f4f5ebc42186fcc98008bda062715e55..01b6c3b67d6078e9877729a955ec51f0 - this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); + this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause }); - // Paper endg - This needs to be handled on the main thread for plugins + // Paper end - This needs to be handled on the main thread for plugins } @@ -131,7 +131,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } @@ -209,7 +209,7 @@ index 7c17c3d4f4f5ebc42186fcc98008bda062715e55..01b6c3b67d6078e9877729a955ec51f0 if (this.cserver.getServer().isRunning()) { this.cserver.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 489b7f80d4a6db2240b87e0a8af428a2ff08afe5..cc4463ed0112b8f987f75d1389c7be43fb81a8f7 100644 +index e70ff6389436f33f4ec1d0b238601419bddb3fe0..cde1ae539f8808ecaf28afda20dc5ea24d006d5f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -342,7 +342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -437,7 +437,7 @@ index 489b7f80d4a6db2240b87e0a8af428a2ff08afe5..cc4463ed0112b8f987f75d1389c7be43 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e27904551ca7f461026e62a2225c2607975a805f..c12ad5eabb7be2648f1a0314855664466b8665b0 100644 +index 5aef84c708865d7bf078e2c40b0d1d4e7dc36b82..52b57867e91c4e777c550098ddf8a75169db6c87 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -684,7 +684,7 @@ public abstract class PlayerList { diff --git a/patches/server/0653-Vanilla-command-permission-fixes.patch b/patches/server/0653-Vanilla-command-permission-fixes.patch index c033d07434..25c28237d6 100644 --- a/patches/server/0653-Vanilla-command-permission-fixes.patch +++ b/patches/server/0653-Vanilla-command-permission-fixes.patch @@ -33,12 +33,12 @@ index 899008b2980d13f1be6280cd8cb959c53a29bebf..d5f7da3502575f6847f3c22ab0e94284 private RedirectModifier modifier = null; private boolean forks; diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 7802e72152628d1e853e5494ec1061fe01fefa5f..e20f4e896b8c059b2d614e74d0c38e418936db6c 100644 +index c11977dceeba4120cdb63972c4ec486640d8114e..8be58d29f2a4753a241e68bd305b3e30186ca0e9 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java @@ -257,6 +257,13 @@ public class Commands { } - this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper + this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper - Add UnknownCommandEvent + // Paper start - Vanilla command permission fixes + for (final CommandNode node : this.dispatcher.getRoot().getChildren()) { diff --git a/patches/server/0715-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/0715-Fix-entity-type-tags-suggestions-in-selectors.patch index e9f4976061..d6c957489e 100644 --- a/patches/server/0715-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/0715-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -10,7 +10,7 @@ when if this was fixed on the client, that wouldn't be needed. Mojira Issue: https://bugs.mojang.com/browse/MC-235045 diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index de7d11baf17d1b6c3d5fb3402d38052f3a28c246..21c9b903e26f93b8d4e97f3e0d98e3b2e45857f9 100644 +index 907bc9d84dbc98427384cf529bfde4b09d8ce8ca..c47944b18a35929509ae3add455385e80f09763b 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -447,4 +447,20 @@ public class CommandSourceStack implements ExecutionCommandSource tree, CommandNode result, CommandSourceStack source, Map, CommandNode> resultNodes) { Iterator iterator = tree.getChildren().iterator(); @@ -46,7 +46,7 @@ index e20f4e896b8c059b2d614e74d0c38e418936db6c..4cec7e5b1086064650af50cc9b89da27 while (iterator.hasNext()) { CommandNode commandnode2 = (CommandNode) iterator.next(); // Paper start - Brigadier API -@@ -558,6 +559,12 @@ public class Commands { +@@ -557,6 +558,12 @@ public class Commands { if (requiredargumentbuilder.getSuggestionsProvider() != null) { requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider())); diff --git a/patches/server/0784-Add-support-for-Proxy-Protocol.patch b/patches/server/0784-Add-support-for-Proxy-Protocol.patch index 1995403e42..306ded1834 100644 --- a/patches/server/0784-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0784-Add-support-for-Proxy-Protocol.patch @@ -17,7 +17,7 @@ index ff1636d3e047e124c73496f4942e991abe01c150..376e8983fdfdbb6c3e5fd8ad0f6a05e6 implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion implementation("org.ow2.asm:asm-commons:9.5") diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index 7288a942397d223d97d7afd11b9c9e5dc6a96901..1e33cabcdf2c6c4894024bdcc1a479b2d120f944 100644 +index 7383c367eba6e157b020655c858fef80bcf91822..0057f3f7669b03c36c3dd2e7629e4551e3cde700 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -111,6 +111,12 @@ public class ServerConnectionListener { @@ -60,6 +60,6 @@ index 7288a942397d223d97d7afd11b9c9e5dc6a96901..1e33cabcdf2c6c4894024bdcc1a479b2 + }); + } + // Paper end - Add support for proxy protocol - pending.add(object); // Paper + pending.add(object); // Paper - prevent blocking on adding a new connection while the server is ticking ((Connection) object).configurePacketHandler(channelpipeline); ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); diff --git a/patches/server/0858-Friction-API.patch b/patches/server/0858-Friction-API.patch index 8b4f147d22..d1a8023c7a 100644 --- a/patches/server/0858-Friction-API.patch +++ b/patches/server/0858-Friction-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Friction API diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 49fdc6d198cc7af31e6c1d1ba52c8adc0fae433f..c13a7ae57c046832f65af11dc5efbc7b197b6f74 100644 +index 39a6823a2fef8c3907a39fc611489e07cdf6d1e1..89b2977e848afb6ff577382d69616be40fd28a75 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -55,12 +55,12 @@ index 49fdc6d198cc7af31e6c1d1ba52c8adc0fae433f..c13a7ae57c046832f65af11dc5efbc7b if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) { this.getAttributes().load(nbt.getList("Attributes", 10)); 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 13efea97d1836a48ef4c0e077a61571d9c171a0e..635f93b4205bd11a8080fbc1db53aa2430aacb77 100644 +index 8aaca29b115a55bf48306e71432c4c20d2bd21dc..eb0d6238588efa35fa868f26290547574a08eca2 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -57,6 +57,7 @@ public class ItemEntity extends Entity implements TraceableEntity { private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit - public boolean canMobPickup = true; // Paper + public boolean canMobPickup = true; // Paper - Item#canEntityPickup private int despawnRate = -1; // Paper - Alternative item-despawn-rate + public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API diff --git a/patches/server/0937-Fix-BanList-API.patch b/patches/server/0937-Fix-BanList-API.patch index 785adea805..2636191597 100644 --- a/patches/server/0937-Fix-BanList-API.patch +++ b/patches/server/0937-Fix-BanList-API.patch @@ -256,7 +256,7 @@ index c49d3448866caae8a2ceb51a45c3a056124f8f57..5527f6745d4d721666c6fa78f33a56d8 } diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java -index 6422c58907ee289359a11054fec1e4de6f495ae3..bc6151cfeb7ace4755414614723ee830081094af 100644 +index 6f779c6f4422c5b5dc22f66e3e702c714d0e052b..41336821d4e0430e19f2fc021f09430d7a1302f6 100644 --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java +++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java @@ -28,7 +28,7 @@ import org.bukkit.profile.PlayerProfile; @@ -274,7 +274,7 @@ index 6422c58907ee289359a11054fec1e4de6f495ae3..bc6151cfeb7ace4755414614723ee830 @Override - public CompletableFuture update() { + public CompletableFuture update() { // Paper - have to remove generic to avoid clashing between bukkit.PlayerProfile and paper.PlayerProfile - return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.PROFILE_EXECUTOR); // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor + return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread } @@ -277,4 +277,71 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky diff --git a/patches/server/1011-Add-predicate-for-blocks-when-raytracing.patch b/patches/server/1011-Add-predicate-for-blocks-when-raytracing.patch index 2d1ca7d6cf..ea4a275eaf 100644 --- a/patches/server/1011-Add-predicate-for-blocks-when-raytracing.patch +++ b/patches/server/1011-Add-predicate-for-blocks-when-raytracing.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add predicate for blocks when raytracing diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java -index 7df62a219d0bcffc793c1a8c55b6ed244fdeb199..4b7ea18a34675702c5b17c4819f7977807c1c935 100644 +index 7df62a219d0bcffc793c1a8c55b6ed244fdeb199..3c54b32886c608ce91654d18e198cac83d2d2d6a 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java @@ -83,6 +83,12 @@ public interface BlockGetter extends LevelHeightAccessor { @@ -26,7 +26,7 @@ index 7df62a219d0bcffc793c1a8c55b6ed244fdeb199..4b7ea18a34675702c5b17c4819f79778 } // Paper end - Prevent raytrace from loading chunks - if (iblockdata.isAir()) return null; // Paper - Perf: optimise air cases -+ if (iblockdata.isAir() || (canCollide != null && this instanceof LevelAccessor levelAccessor && !canCollide.test(org.bukkit.craftbukkit.block.CraftBlock.at(levelAccessor, blockposition)))) return null; // Paper - Perf: optimise air cases &g check canCollide predicate ++ if (iblockdata.isAir() || (canCollide != null && this instanceof LevelAccessor levelAccessor && !canCollide.test(org.bukkit.craftbukkit.block.CraftBlock.at(levelAccessor, blockposition)))) return null; // Paper - Perf: optimise air cases & check canCollide predicate FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: don't need to go to world state again Vec3 vec3d = raytrace1.getFrom(); Vec3 vec3d1 = raytrace1.getTo(); @@ -47,7 +47,7 @@ index 7df62a219d0bcffc793c1a8c55b6ed244fdeb199..4b7ea18a34675702c5b17c4819f79778 Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo()); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 55330b6b5e52f67d7490a2932a0ac7ec0387f145..1843ae08cc19cb8f7290403f8622dcd760e9399f 100644 +index 654267fcb560c45ad2db8712c056d097b1bf4904..0d66ad3728eb31bb1dbf9f35b4f9193ed3c1f880 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1125,9 +1125,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {