From 0f17027652f644b88ccffb2f69d48ba43f93ed22 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 14 Mar 2023 16:10:18 -0700 Subject: [PATCH] fix more compile errors --- .../0304-Missing-Entity-Behavior-API.patch | 8 ++- patches/api/0375-More-Teleport-API.patch | 13 +++-- patches/server/0010-Adventure.patch | 15 +++--- .../0015-Rewrite-dataconverter-system.patch | 4 +- ...d-mobs-to-jump-and-take-water-damage.patch | 4 +- ...nilla-per-world-scoreboard-coloring-.patch | 6 +-- ...-API-Replenishable-Lootables-Feature.patch | 13 +++++ ...nt-extended-PaperServerListPingEvent.patch | 54 ++++++++++--------- .../0184-Player.setPlayerProfile-API.patch | 6 +-- .../server/0444-Add-PrepareResultEvent.patch | 4 +- ...ataPlayer-leak-due-from-quitting-ear.patch | 4 +- ...erver-load-chunks-from-newer-version.patch | 4 +- ...-add-isDeeplySleeping-to-HumanEntity.patch | 5 +- patches/server/0600-More-World-API.patch | 8 +-- ...-address-to-AsyncPlayerPreLoginEvent.patch | 4 +- .../0645-Missing-Entity-Behavior-API.patch | 6 +-- ...prevent-NBT-copy-in-smithing-recipes.patch | 4 +- ...dd-missing-block-data-mins-and-maxes.patch | 21 ++++++++ ...hange-the-podium-for-the-EnderDragon.patch | 4 +- .../server/0858-Add-Player-getFishHook.patch | 4 +- patches/server/0864-More-Teleport-API.patch | 8 +-- ...6-Add-Velocity-IP-Forwarding-Support.patch | 6 +-- ...le-player-info-update-packet-on-join.patch | 15 +----- ...Fix-force-opening-enchantment-tables.patch | 4 +- ...ity-drop-not-updating-the-client-inv.patch | 4 +- ...ItemEvent-and-EntityCompostItemEvent.patch | 13 ----- 26 files changed, 130 insertions(+), 111 deletions(-) diff --git a/patches/api/0304-Missing-Entity-Behavior-API.patch b/patches/api/0304-Missing-Entity-Behavior-API.patch index 91e05d3fc2..a6b5eb90d3 100644 --- a/patches/api/0304-Missing-Entity-Behavior-API.patch +++ b/patches/api/0304-Missing-Entity-Behavior-API.patch @@ -1226,10 +1226,10 @@ index a4411daca0d8a770b0d15e08847b82df8a3ec27f..35b51136f5258abfae3395aeae4b3000 + // Paper end - Entity API } diff --git a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java -index db69687a7ad4b18d17ab1677cae5d8dd4dcd3678..8e4c6ec409f49d4a3378c466acc47f62c7689c0b 100644 +index db69687a7ad4b18d17ab1677cae5d8dd4dcd3678..304b05aeaea5febf493fc40d433a23acb384b4f0 100644 --- a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java +++ b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java -@@ -24,4 +24,19 @@ public interface HopperMinecart extends Minecart, InventoryHolder, LootableEntit +@@ -24,4 +24,23 @@ public interface HopperMinecart extends Minecart, InventoryHolder, LootableEntit * @param enabled new enabled state */ void setEnabled(boolean enabled); @@ -1238,14 +1238,18 @@ index db69687a7ad4b18d17ab1677cae5d8dd4dcd3678..8e4c6ec409f49d4a3378c466acc47f62 + * Gets the number of ticks that this hopper minecart cannot pickup items up for. + * + * @return ticks left on cooldown ++ * @deprecated Hopper minecarts don't have cooldowns anymore + */ ++ @Deprecated(forRemoval = true) + int getPickupCooldown(); + + /** + * Sets the number of ticks that this hopper minecart cannot pickup items for. + * + * @param cooldown cooldown length in ticks ++ * @deprecated Hopper minecarts don't have cooldowns anymore + */ ++ @Deprecated(forRemoval = true) + void setPickupCooldown(int cooldown); + // Paper end } diff --git a/patches/api/0375-More-Teleport-API.patch b/patches/api/0375-More-Teleport-API.patch index 8fe52e096b..a9928a2bcd 100644 --- a/patches/api/0375-More-Teleport-API.patch +++ b/patches/api/0375-More-Teleport-API.patch @@ -219,7 +219,7 @@ index f3fe0266778d9d513f6a561b8829644d1f66e617..058c2f9da196d68477d5fbdcf55b5074 @Override Spigot spigot(); diff --git a/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java b/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java -index 113e620ce38bb8ff97cf24e309af59b717774b36..cc75d2e84e68a1f63ec91a909c37407a46ddb16a 100644 +index 113e620ce38bb8ff97cf24e309af59b717774b36..c334684341002c469a0dd90fc995758aff6bac61 100644 --- a/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java @@ -13,8 +13,14 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { @@ -237,16 +237,14 @@ index 113e620ce38bb8ff97cf24e309af59b717774b36..cc75d2e84e68a1f63ec91a909c37407a } public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause) { -@@ -23,6 +29,17 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { +@@ -23,6 +29,15 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { this.cause = cause; } + // Paper start - Teleport API + @org.jetbrains.annotations.ApiStatus.Experimental -+ public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause, boolean dismounted, @NotNull java.util.Set teleportFlagSet) { ++ public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause, @NotNull java.util.Set teleportFlagSet) { + super(player, from, to); -+ -+ this.dismounted = dismounted; + this.teleportFlagSet = teleportFlagSet; + this.cause = cause; + } @@ -255,7 +253,7 @@ index 113e620ce38bb8ff97cf24e309af59b717774b36..cc75d2e84e68a1f63ec91a909c37407a /** * Gets the cause of this teleportation event * -@@ -84,6 +101,30 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { +@@ -84,6 +99,31 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { UNKNOWN; } @@ -264,8 +262,9 @@ index 113e620ce38bb8ff97cf24e309af59b717774b36..cc75d2e84e68a1f63ec91a909c37407a + * Gets if the player will be dismounted in this teleportation. + * + * @return dismounted or not ++ * @deprecated dismounting on tp is no longer controlled by the server + */ -+ @org.jetbrains.annotations.ApiStatus.Experimental ++ @Deprecated(forRemoval = true) + public boolean willDismountPlayer() { + return this.dismounted; + } diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index eac1d77afd..1af0afd39a 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..3246049fd557951d971ef40112a411c1 +} diff --git a/src/main/java/io/papermc/paper/adventure/ChatDecorationProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatDecorationProcessor.java new file mode 100644 -index 0000000000000000000000000000000000000000..e7671b9e2fc5ed01461e4ae1557dfc14075e61bd +index 0000000000000000000000000000000000000000..3b53d87a52cafb2503419f21ddd87d42a5ec0330 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/ChatDecorationProcessor.java @@ -0,0 +1,145 @@ @@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..e7671b9e2fc5ed01461e4ae1557dfc14 +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; -+import net.minecraft.Util; ++import net.minecraft.Optionull; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.ChatDecorator; +import net.minecraft.server.MinecraftServer; @@ -194,7 +194,7 @@ index 0000000000000000000000000000000000000000..e7671b9e2fc5ed01461e4ae1557dfc14 + } + + private ChatDecorator.Result processModern(final ChatDecorator.Result input) { -+ final @Nullable CraftPlayer player = Util.mapNullable(this.player, ServerPlayer::getBukkitEntity); ++ final @Nullable CraftPlayer player = Optionull.map(this.player, ServerPlayer::getBukkitEntity); + + final Component initialResult = input.message().component(); + final AsyncChatDecorateEvent event; @@ -255,10 +255,10 @@ index 0000000000000000000000000000000000000000..e7671b9e2fc5ed01461e4ae1557dfc14 +} diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java new file mode 100644 -index 0000000000000000000000000000000000000000..e7bcc08e3d3fe0ecb97e65cb2c32582750e22c28 +index 0000000000000000000000000000000000000000..45830cf2b42c2c983cef922c6355e5d6a7cfb982 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -0,0 +1,411 @@ +@@ -0,0 +1,412 @@ +package io.papermc.paper.adventure; + +import io.papermc.paper.chat.ChatRenderer; @@ -280,6 +280,7 @@ index 0000000000000000000000000000000000000000..e7bcc08e3d3fe0ecb97e65cb2c325827 +import net.kyori.adventure.audience.ForwardingAudience; +import net.kyori.adventure.key.Key; +import net.kyori.adventure.text.Component; ++import net.minecraft.Optionull; +import net.minecraft.Util; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.chat.ChatDecorator; @@ -551,7 +552,7 @@ index 0000000000000000000000000000000000000000..e7bcc08e3d3fe0ecb97e65cb2c325827 + if (acceptsNative(viewer)) { + this.sendNative(viewer, chatType, msgFunction); + } else { -+ final net.minecraft.network.chat.@Nullable Component unsigned = Util.mapNullable(msgFunction, f -> f.apply(viewer)); ++ final net.minecraft.network.chat.@Nullable Component unsigned = Optionull.map(msgFunction, f -> f.apply(viewer)); + final PlayerChatMessage msg = unsigned == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(unsigned); + viewer.sendMessage(msg.adventureView(), this.adventure(chatType)); + } @@ -601,7 +602,7 @@ index 0000000000000000000000000000000000000000..e7bcc08e3d3fe0ecb97e65cb2c325827 + if (viewer instanceof ConsoleCommandSender) { + this.sendToServer(chatType, msgFunction); + } else if (viewer instanceof CraftPlayer craftPlayer) { -+ craftPlayer.getHandle().sendChatMessage(ChatProcessor.this.outgoing, ChatProcessor.this.player.shouldFilterMessageTo(craftPlayer.getHandle()), chatType, Util.mapNullable(msgFunction, f -> f.apply(viewer))); ++ craftPlayer.getHandle().sendChatMessage(ChatProcessor.this.outgoing, ChatProcessor.this.player.shouldFilterMessageTo(craftPlayer.getHandle()), chatType, Optionull.map(msgFunction, f -> f.apply(viewer))); + } else if (viewer instanceof ForwardingAudience.Single single) { + this.sendNative(single.audience(), chatType, msgFunction); + } else { diff --git a/patches/server/0015-Rewrite-dataconverter-system.patch b/patches/server/0015-Rewrite-dataconverter-system.patch index 5da52c7dea..7ff6a856d7 100644 --- a/patches/server/0015-Rewrite-dataconverter-system.patch +++ b/patches/server/0015-Rewrite-dataconverter-system.patch @@ -23132,7 +23132,7 @@ index d80580574a9e5d1c850270d93807f3a66a9c76f8..2e9519726e5628a13a09f79dff2f5069 @Override diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 08961b2a9684ac54c455002affc6174b0e64b6a5..c6bbf2e695a6b572271c4fde3bea3bddc1dda339 100644 +index 08961b2a9684ac54c455002affc6174b0e64b6a5..b0c8a0e64c7a5d41c1b4cc1e39c4399c142b56af 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java @@ -142,7 +142,14 @@ public class SectionStorage implements AutoCloseable { @@ -23142,7 +23142,7 @@ index 08961b2a9684ac54c455002affc6174b0e64b6a5..c6bbf2e695a6b572271c4fde3bea3bdd - Dynamic dynamic2 = this.type.update(this.fixerUpper, dynamic, j, k); + // Paper start - route to new converter system + Dynamic dynamic2; -+ if (this.type.getType() == net.minecraft.util.datafix.fixes.References.POI_CHUNK) { ++ if (this.type == net.minecraft.util.datafix.DataFixTypes.POI_CHUNK) { + dynamic2 = new Dynamic<>(dynamic.getOps(), (T)ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.POI_CHUNK, (CompoundTag)dynamic.getValue(), j, k)); + } else { + dynamic2 = this.type.update(this.fixerUpper, dynamic, j, k); diff --git a/patches/server/0023-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/0023-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index 7fc39de3b8..d4c8f5b2f9 100644 --- a/patches/server/0023-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/0023-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow nerfed mobs to jump and take water damage diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index a290487b153a66a3e936ed1183f3c2ce343e59b1..8dea6df3456fd37095400711c94b0d0866988745 100644 +index a290487b153a66a3e936ed1183f3c2ce343e59b1..ce1b3b607c21307fe3ea65590fa63265a6f67ac8 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -110,6 +110,7 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -27,7 +27,7 @@ index a290487b153a66a3e936ed1183f3c2ce343e59b1..8dea6df3456fd37095400711c94b0d08 + this.getJumpControl().tick(); + } + if (this.isSensitiveToWater() && isInWaterRainOrBubble()) { -+ hurt(DamageSource.DROWN, 1.0F); ++ hurt(this.damageSources().drown(), 1.0F); + } + return; + } diff --git a/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 50f36541f3..fed47a610c 100644 --- a/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/patches/server/0087-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -12,10 +12,10 @@ for this on CB at one point but I can't find it. We may need to do this ourselves at some point in the future. diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -index e7bcc08e3d3fe0ecb97e65cb2c32582750e22c28..309fe1162db195c7c3c94d785d6aa2700e42b08a 100644 +index 45830cf2b42c2c983cef922c6355e5d6a7cfb982..4d9bc4a62ebae0f3707900503576c64733de639f 100644 --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -28,7 +28,9 @@ import net.minecraft.network.chat.PlayerChatMessage; +@@ -29,7 +29,9 @@ import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.resources.ResourceKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -25,7 +25,7 @@ index e7bcc08e3d3fe0ecb97e65cb2c32582750e22c28..309fe1162db195c7c3c94d785d6aa270 import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.util.LazyPlayerSet; import org.bukkit.craftbukkit.util.Waitable; -@@ -364,10 +366,16 @@ public final class ChatProcessor { +@@ -365,10 +367,16 @@ public final class ChatProcessor { } static String legacyDisplayName(final CraftPlayer player) { diff --git a/patches/server/0095-LootTable-API-Replenishable-Lootables-Feature.patch b/patches/server/0095-LootTable-API-Replenishable-Lootables-Feature.patch index 69893ab10d..46c63668a9 100644 --- a/patches/server/0095-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/patches/server/0095-LootTable-API-Replenishable-Lootables-Feature.patch @@ -719,6 +719,19 @@ index 982adacb361b0590799dc68f9b7c13c7195627fd..e49eece9bff3a53469673d03a7bbf8f9 public CraftLootable(World world, T tileEntity) { super(world, tileEntity); +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSuspiciousSand.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSuspiciousSand.java +index 15fba6668d340a28f07dd9c02aeb28fe53db1530..855d452dcbcaee092965732f14a17a74572290bb 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSuspiciousSand.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSuspiciousSand.java +@@ -60,7 +60,7 @@ public class CraftSuspiciousSand extends CraftBlockEntityState originalSample; + + private StandardPaperServerListPingEventImpl(MinecraftServer server, Connection networkManager, ServerStatus ping) { -+ super(server, new PaperStatusClient(networkManager), ping.getVersion() != null ? ping.getVersion().getProtocol() : -1, server.server.getServerIcon()); -+ this.originalSample = ping.getPlayers() == null ? null : ping.getPlayers().getSample(); // GH-1473 - pre-tick race condition NPE ++ super(server, new PaperStatusClient(networkManager), ping.version().map(ServerStatus.Version::protocol).orElse(-1), server.server.getServerIcon()); ++ this.originalSample = ping.players().map(ServerStatus.Players::sample).orElse(null); // GH-1473 - pre-tick race condition NPE + } + + @Nonnull @@ -107,18 +112,18 @@ index 0000000000000000000000000000000000000000..4c2351b03b58511b80017b58ee9b20ab + return sample; + } + -+ private GameProfile[] getPlayerSampleHandle() { ++ private List getPlayerSampleHandle() { + if (this.originalSample != null) { + return this.originalSample; + } + + List entries = super.getPlayerSample(); + if (entries.isEmpty()) { -+ return EMPTY_PROFILES; ++ return Collections.emptyList(); + } + -+ GameProfile[] profiles = new GameProfile[entries.size()]; -+ for (int i = 0; i < profiles.length; i++) { ++ final List profiles = new ArrayList<>(); ++ for (PlayerProfile profile : entries) { + /* + * Avoid null UUIDs/names since that will make the response invalid + * on the client. @@ -126,19 +131,15 @@ index 0000000000000000000000000000000000000000..4c2351b03b58511b80017b58ee9b20ab + * This can be used to create custom lines in the player list that do not + * refer to a specific player. + */ -+ -+ PlayerProfile profile = entries.get(i); + if (profile.getId() != null && profile.getName() != null) { -+ profiles[i] = CraftPlayerProfile.asAuthlib(profile); ++ profiles.add(CraftPlayerProfile.asAuthlib(profile)); + } else { -+ profiles[i] = new GameProfile(MoreObjects.firstNonNull(profile.getId(), FAKE_UUID), Strings.nullToEmpty(profile.getName())); ++ profiles.add(new GameProfile(MoreObjects.firstNonNull(profile.getId(), FAKE_UUID), Strings.nullToEmpty(profile.getName()))); + } + } -+ + return profiles; + } + -+ @SuppressWarnings("deprecation") + public static void processRequest(MinecraftServer server, Connection networkManager) { + StandardPaperServerListPingEventImpl event = new StandardPaperServerListPingEventImpl(server, networkManager, server.getStatus()); + server.server.getPluginManager().callEvent(event); @@ -150,24 +151,29 @@ index 0000000000000000000000000000000000000000..4c2351b03b58511b80017b58ee9b20ab + } + + // Setup response -+ ServerStatus ping = new ServerStatus(); + + // Description -+ ping.setDescription(new AdventureComponent(event.motd())); ++ final Component description = new AdventureComponent(event.motd()); + + // Players ++ final Optional players; + if (!event.shouldHidePlayers()) { -+ ping.setPlayers(new ServerStatus.Players(event.getMaxPlayers(), event.getNumPlayers())); -+ ping.getPlayers().setSample(event.getPlayerSampleHandle()); ++ players = Optional.of(new ServerStatus.Players(event.getMaxPlayers(), event.getNumPlayers(), event.getPlayerSampleHandle())); ++ } else { ++ players = Optional.empty(); + } + + // Version -+ ping.setVersion(new ServerStatus.Version(event.getVersion(), event.getProtocolVersion())); ++ final ServerStatus.Version version = new ServerStatus.Version(event.getVersion(), event.getProtocolVersion()); + + // Favicon ++ final Optional favicon; + if (event.getServerIcon() != null) { -+ ping.setFavicon(event.getServerIcon().getData()); ++ favicon = Optional.of(new ServerStatus.Favicon(((CraftIconCache) event.getServerIcon()).value)); ++ } else { ++ favicon = Optional.empty(); + } ++ final ServerStatus ping = new ServerStatus(description, players, Optional.of(version), favicon, server.enforceSecureProfile()); + + // Send response + networkManager.send(new ClientboundStatusResponsePacket(ping)); @@ -198,7 +204,7 @@ index 44c9135e8d63df11009d5eea509c6c57e8d841c4..163993cd4fe52c5bd89db656d61ff795 int k = Mth.nextInt(this.random, 0, list.size() - j); diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java -index d99b2235038eb1aba8cda474c4aa51e207149ef4..4eebe72d8ef4e71271c583545c7312212fabe8ec 100644 +index d99b2235038eb1aba8cda474c4aa51e207149ef4..2c13147bc063a09bb7907d6f90c3a1e811a09eb1 100644 --- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java @@ -48,6 +48,8 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene @@ -215,7 +221,7 @@ index d99b2235038eb1aba8cda474c4aa51e207149ef4..4eebe72d8ef4e71271c583545c731221 this.connection.send(new ClientboundStatusResponsePacket(ping)); // CraftBukkit end + */ -+ com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(this.server, this.connection); ++ com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(MinecraftServer.getServer(), this.connection); + // Paper end } } diff --git a/patches/server/0184-Player.setPlayerProfile-API.patch b/patches/server/0184-Player.setPlayerProfile-API.patch index a94924951e..2059d2c9c4 100644 --- a/patches/server/0184-Player.setPlayerProfile-API.patch +++ b/patches/server/0184-Player.setPlayerProfile-API.patch @@ -9,7 +9,7 @@ This can be useful for changing name or skins after a player has logged in. public-f net.minecraft.world.entity.player.Player gameProfile diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2985032eb3e97653f96fdbc7a4e986b0f9f15983..5a8703799204c28d885edfe1f366d222270d6558 100644 +index ec1aa8d5fbfdafc35948a04f4d8d65e879853ff0..ef9fc39e70516772cc91b9ada493bfa051b41784 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1534,7 +1534,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -55,7 +55,7 @@ index e7442952ef1f03969949014492a7ddc6d0796ba5..69a1852905dd4724c30ac8ab88c14251 public Server getServer() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a1ab7a666e429f0ac9afc1bd8a65866364655b70..e3d166dd69470468e17255e994876a305f90c9ba 100644 +index a1ab7a666e429f0ac9afc1bd8a65866364655b70..2dd0e3272587697b52f75e851f26bb818f25c6aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -82,6 +82,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; @@ -136,7 +136,7 @@ index a1ab7a666e429f0ac9afc1bd8a65866364655b70..e3d166dd69470468e17255e994876a30 + for (ServerPlayer player : players) { + CraftPlayer bukkitPlayer = player.getBukkitEntity(); + if (bukkitPlayer.canSee(this)) { -+ bukkitPlayer.trackAndShowEntity(self); ++ bukkitPlayer.trackAndShowEntity(self.getBukkitEntity()); + } + } + // Refresh misc player things AFTER sending game profile diff --git a/patches/server/0444-Add-PrepareResultEvent.patch b/patches/server/0444-Add-PrepareResultEvent.patch index a7ed9f86c6..977a30051d 100644 --- a/patches/server/0444-Add-PrepareResultEvent.patch +++ b/patches/server/0444-Add-PrepareResultEvent.patch @@ -44,14 +44,14 @@ index 5bcd3857fd30ec43e0191a862fc9c7712149e3dd..4770f2b19847be6002f9fea9c258f823 } diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java -index 4087e381b2250be387b608d8742f6a6009a52879..6fc62df63c9645adeb6af69f84f7b67e9d924d74 100644 +index 4087e381b2250be387b608d8742f6a6009a52879..ff770b9ce68a62418de0c7ed389650626fa1dcb2 100644 --- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java @@ -110,6 +110,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { super.slotsChanged(inventory); if (inventory == this.inputSlots) { this.createResult(); -+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper ++ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, this instanceof SmithingMenu ? 3 : 2); // Paper } } diff --git a/patches/server/0452-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/0452-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch index 02b47f08de..43380c5968 100644 --- a/patches/server/0452-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch +++ b/patches/server/0452-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch @@ -60,14 +60,14 @@ index 06fc39b19385d36fd0c5bb9a7042a238eb6e8a57..bb1f0e9dbcb792d015d1cb65664a96fd LootContext lootContext = EntityPredicate.createContext(player, player); List> list = null; diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index 6802e1def5e93c208d01a68f5cfc4c8809bb910f..3df2a3fdfe2aa70457581210adf1bfabc73291d0 100644 +index 6802e1def5e93c208d01a68f5cfc4c8809bb910f..7116b0752c8d790a6eae0cb4ea851beac59faaa4 100644 --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java @@ -62,6 +62,7 @@ public class PlayerAdvancements { @Nullable private Advancement lastSelectedTab; private boolean isFirstPacket = true; -+ public final Map> criterionData = Maps.newIdentityHashMap(); // Paper - fix advancement data player leakage ++ public final Map> criterionData = new java.util.IdentityHashMap<>(); // Paper - fix advancement data player leakage public PlayerAdvancements(DataFixer dataFixer, PlayerList playerManager, ServerAdvancementManager advancementLoader, Path filePath, ServerPlayer owner) { this.dataFixer = dataFixer; diff --git a/patches/server/0455-Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/server/0455-Do-not-let-the-server-load-chunks-from-newer-version.patch index 6736cba641..5d732a61b8 100644 --- a/patches/server/0455-Do-not-let-the-server-load-chunks-from-newer-version.patch +++ b/patches/server/0455-Do-not-let-the-server-load-chunks-from-newer-version.patch @@ -9,7 +9,7 @@ the game, immediately stop the server to prevent data corruption. You can override this functionality at your own peril. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 4138ba8bdf6f359327dfc86d3402b787ae58c818..9981bbfd846a5380b99f0d894b121db554d03028 100644 +index 4138ba8bdf6f359327dfc86d3402b787ae58c818..f0f38f1a7603cd06aba6adefd370d40b97f2e5b8 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java @@ -128,9 +128,22 @@ public class ChunkSerializer { @@ -17,7 +17,7 @@ index 4138ba8bdf6f359327dfc86d3402b787ae58c818..9981bbfd846a5380b99f0d894b121db5 } + // Paper start -+ private static final int CURRENT_DATA_VERSION = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); ++ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion(); + private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion"); + // Paper end public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) { diff --git a/patches/server/0594-add-isDeeplySleeping-to-HumanEntity.patch b/patches/server/0594-add-isDeeplySleeping-to-HumanEntity.patch index 912cccddf2..a92e9872c2 100644 --- a/patches/server/0594-add-isDeeplySleeping-to-HumanEntity.patch +++ b/patches/server/0594-add-isDeeplySleeping-to-HumanEntity.patch @@ -5,14 +5,15 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 539708d5d806c757305bee754d9a4f0de49a742f..dd25a8d27e780969425a38e5a83ab1528c6f6089 100644 +index 539708d5d806c757305bee754d9a4f0de49a742f..b326654ef96cfd3f5cff476203844c2fb932b9b6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -132,6 +132,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -132,6 +132,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } // Paper end + // Paper start ++ @Override + public boolean isDeeplySleeping() { + return getHandle().isSleepingLongEnough(); + } diff --git a/patches/server/0600-More-World-API.patch b/patches/server/0600-More-World-API.patch index c7ec81343b..ab46622df2 100644 --- a/patches/server/0600-More-World-API.patch +++ b/patches/server/0600-More-World-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d0a2e20d4d85056abb54e6916753305ef2f3dfab..71fbfdaab3ff03c7ba3b987d0285bbaa6d3cbce4 100644 +index d0a2e20d4d85056abb54e6916753305ef2f3dfab..8a068c4fe548a3744244c96a3062e10bbf05e793 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -2050,6 +2050,69 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -20,7 +20,7 @@ index d0a2e20d4d85056abb54e6916753305ef2f3dfab..71fbfdaab3ff03c7ba3b987d0285bbaa + + @Override + public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) { -+ BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ()); ++ BlockPos originPos = io.papermc.paper.util.MCUtil.toBlockPos(origin); + Pair> pair = getHandle().findClosestBiome3d(holder -> holder.is(CraftNamespacedKey.toMinecraft(biome.getKey())), originPos, radius, step, step); + if (pair == null) { + return null; @@ -79,7 +79,7 @@ index d0a2e20d4d85056abb54e6916753305ef2f3dfab..71fbfdaab3ff03c7ba3b987d0285bbaa public Raid locateNearestRaid(Location location, int radius) { Validate.notNull(location, "Location cannot be null"); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java -index 3071ac1ac0e733d73dade49597a39f7d156bbc04..60c4afd5cad66ffb0cfb5c1fa9857def593813ae 100644 +index 3071ac1ac0e733d73dade49597a39f7d156bbc04..967445b2eb158454100a27369a1f463d69f54f27 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java @@ -12,4 +12,13 @@ public final class CraftVector { @@ -92,7 +92,7 @@ index 3071ac1ac0e733d73dade49597a39f7d156bbc04..60c4afd5cad66ffb0cfb5c1fa9857def + } + + public static net.minecraft.core.BlockPos toBlockPos(org.bukkit.util.Vector bukkit) { -+ return new net.minecraft.core.BlockPos(bukkit.getX(), bukkit.getY(), bukkit.getZ()); ++ return net.minecraft.core.BlockPos.containing(bukkit.getX(), bukkit.getY(), bukkit.getZ()); + } + // Paper end } diff --git a/patches/server/0611-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0611-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch index 918d815d6c..32ba58aa32 100644 --- a/patches/server/0611-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch +++ b/patches/server/0611-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index c9f8f61c43428c519c0dac1b7416bad775e3429f..5ae5c35ee4d058bde6726797abb1472ee0516256 100644 +index c9f8f61c43428c519c0dac1b7416bad775e3429f..b026c003e1fc02a9ea426f3126acb788fc09a874 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -331,12 +331,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, public void fireEvents() throws Exception { String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); -+ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.getRawAddress()).getAddress(); // Paper ++ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.channel.remoteAddress()).getAddress(); // Paper java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; diff --git a/patches/server/0645-Missing-Entity-Behavior-API.patch b/patches/server/0645-Missing-Entity-Behavior-API.patch index 15bc3e06bd..70a5c02b12 100644 --- a/patches/server/0645-Missing-Entity-Behavior-API.patch +++ b/patches/server/0645-Missing-Entity-Behavior-API.patch @@ -764,7 +764,7 @@ index 5500d5768bb22f70b99aa28cf4541b4871e12139..4d7a2c4c1001aefe9fcd4be8dbcb414f + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java -index ee9648739fb39c5842063d7442df6eb5c9336d7f..569763b3c9e92a4071884f139fb1263201f80e43 100644 +index ee9648739fb39c5842063d7442df6eb5c9336d7f..67fe56cc4c2af24f6bd883c6e14851019b0b9523 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java @@ -39,4 +39,20 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements @@ -779,12 +779,12 @@ index ee9648739fb39c5842063d7442df6eb5c9336d7f..569763b3c9e92a4071884f139fb12632 + + @Override + public int getPickupCooldown() { -+ return this.getHandle().cooldownTime; ++ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns"); + } + + @Override + public void setPickupCooldown(int cooldown) { -+ this.getHandle().setCooldown(cooldown); ++ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns"); + } + // Paper end } diff --git a/patches/server/0676-Option-to-prevent-NBT-copy-in-smithing-recipes.patch b/patches/server/0676-Option-to-prevent-NBT-copy-in-smithing-recipes.patch index 557f50d851..6be6026009 100644 --- a/patches/server/0676-Option-to-prevent-NBT-copy-in-smithing-recipes.patch +++ b/patches/server/0676-Option-to-prevent-NBT-copy-in-smithing-recipes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option to prevent NBT copy in smithing recipes diff --git a/src/main/java/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java b/src/main/java/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java -index 9c8ca33327e2e54c1c9d7f5a3a9a6648b5422737..7292702141a216a426a3acd3561a3927b0584708 100644 +index 9c8ca33327e2e54c1c9d7f5a3a9a6648b5422737..06c7ca77456acc1f206aabc6d4198128ca927c6a 100644 --- a/src/main/java/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java @@ -26,8 +26,15 @@ public class LegacyUpgradeRecipe implements SmithingRecipe { @@ -43,7 +43,7 @@ index 9c8ca33327e2e54c1c9d7f5a3a9a6648b5422737..7292702141a216a426a3acd3561a3927 CraftItemStack result = CraftItemStack.asCraftMirror(this.result); - CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition)); -+ CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper ++ CraftSmithingRecipe recipe = new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper return recipe; } diff --git a/patches/server/0800-Add-missing-block-data-mins-and-maxes.patch b/patches/server/0800-Add-missing-block-data-mins-and-maxes.patch index 83ba5f6bc1..2096473939 100644 --- a/patches/server/0800-Add-missing-block-data-mins-and-maxes.patch +++ b/patches/server/0800-Add-missing-block-data-mins-and-maxes.patch @@ -21,6 +21,27 @@ index 83f86725c00f0e175cb46c7e27705ca777f413ba..24d16825c10edfed6d22e8e37ddb9fd8 // org.bukkit.craftbukkit.block.data.CraftLightable +diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java +index bd1c7e41f0d21c69b1d1b4d4021d188502d7fee3..82da57f7d288da45062f7d61325caf0e47e6d4f6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftCherryLeaves.java +@@ -51,4 +51,16 @@ public final class CraftCherryLeaves extends org.bukkit.craftbukkit.block.data.C + public void setWaterlogged(boolean waterlogged) { + set(CraftCherryLeaves.WATERLOGGED, waterlogged); + } ++ ++ // Paper start ++ @Override ++ public int getMaximumDistance() { ++ return getMax(DISTANCE); ++ } ++ ++ @Override ++ public int getMinimumDistance() { ++ return getMin(DISTANCE); ++ } ++ // Paper end + } diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java index 780b6a29592571f4a730a858734256f69519cca7..ef97e77b25562a8aed35d68d42ced4825d43a29d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftComposter.java diff --git a/patches/server/0823-Allow-to-change-the-podium-for-the-EnderDragon.patch b/patches/server/0823-Allow-to-change-the-podium-for-the-EnderDragon.patch index f5e665dafc..b046117a30 100644 --- a/patches/server/0823-Allow-to-change-the-podium-for-the-EnderDragon.patch +++ b/patches/server/0823-Allow-to-change-the-podium-for-the-EnderDragon.patch @@ -123,7 +123,7 @@ index 0ae65d0fa03d12486f48b0274b6e2d4eea169caf..ffe89d8c1f22f672d145fedb3bb10258 this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java -index acdd2e6efa42476dd627a54da66576ea75bc02d4..4326dae90e70d0f2029c43b878d19c3a1ba90d8a 100644 +index acdd2e6efa42476dd627a54da66576ea75bc02d4..92bcc01b3b28062aa966a7aaca199d7a3be832f4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java @@ -79,4 +79,22 @@ public class CraftEnderDragon extends CraftMob implements EnderDragon, CraftEnem @@ -144,7 +144,7 @@ index acdd2e6efa42476dd627a54da66576ea75bc02d4..4326dae90e70d0f2029c43b878d19c3a + this.getHandle().setPodium(null); + } else { + org.apache.commons.lang.Validate.isTrue(location.getWorld() == null || location.getWorld().equals(getWorld()), "You cannot set a podium in a different world to where the dragon is"); -+ this.getHandle().setPodium(new net.minecraft.core.BlockPos(location.getX(), location.getY(), location.getZ())); ++ this.getHandle().setPodium(io.papermc.paper.util.MCUtil.toBlockPos(location)); + } + } + // Paper end diff --git a/patches/server/0858-Add-Player-getFishHook.patch b/patches/server/0858-Add-Player-getFishHook.patch index 54986e6ae0..7302cc061d 100644 --- a/patches/server/0858-Add-Player-getFishHook.patch +++ b/patches/server/0858-Add-Player-getFishHook.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Player#getFishHook diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index dd25a8d27e780969425a38e5a83ab1528c6f6089..e54833a19fb0d8e530fce202d998287c02961b35 100644 +index b326654ef96cfd3f5cff476203844c2fb932b9b6..d3644b268c10fd839338a5b1bfc42b4ae5286555 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -159,6 +159,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -160,6 +160,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return new Location(worldServer.getWorld(), bed.getX(), bed.getY(), bed.getZ()); } // Paper end diff --git a/patches/server/0864-More-Teleport-API.patch b/patches/server/0864-More-Teleport-API.patch index c60ecd3664..3065b33e38 100644 --- a/patches/server/0864-More-Teleport-API.patch +++ b/patches/server/0864-More-Teleport-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] More Teleport API public net.minecraft.server.network.ServerGamePacketListenerImpl internalTeleport(DDDFFLjava/util/Set;Z)V diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3c0378e8b0f1cb56331b9e89db8f530f3a0dcf64..c81ae9fd083c255c0964c344b3c4ad1dc8ddba7b 100644 +index 3c0378e8b0f1cb56331b9e89db8f530f3a0dcf64..bcbea0fa4fc277f08d90eea5ea4411516362e21e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1708,11 +1708,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -17,10 +17,10 @@ index 3c0378e8b0f1cb56331b9e89db8f530f3a0dcf64..c81ae9fd083c255c0964c344b3c4ad1d - PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause); + // Paper start - Teleport API + Set relativeFlags = java.util.EnumSet.noneOf(io.papermc.paper.entity.TeleportFlag.Relative.class); -+ for (net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket.RelativeArgument relativeArgument : set) { ++ for (RelativeMovement relativeArgument : set) { + relativeFlags.add(org.bukkit.craftbukkit.entity.CraftPlayer.toApiRelativeFlag(relativeArgument)); + } -+ PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, flag, java.util.Set.copyOf(relativeFlags)); ++ PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags)); + // Paper end this.cserver.getPluginManager().callEvent(event); @@ -74,7 +74,7 @@ index 7df1eebce5b62214943e55314e9ec98f056fa330..2aee8aacd50431c18ff28af678348ec2 // Let the server handle cross world teleports if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 63f383fec691d7f6160ec3d8d675c8db0aad1bcd..e84614aa646980da09f21e757e0ce0ae8fc89f9e 100644 +index 8e16fc9263cfd43bb85d368b0a6f36624a6ebf91..0a32183038420823811d8a5ae5eadeef73304296 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1231,13 +1231,100 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0876-Add-Velocity-IP-Forwarding-Support.patch b/patches/server/0876-Add-Velocity-IP-Forwarding-Support.patch index fc0d1b1d9e..885413acfd 100644 --- a/patches/server/0876-Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/0876-Add-Velocity-IP-Forwarding-Support.patch @@ -123,7 +123,7 @@ index 51b3db0b6c2cede95b584268e035c0fb36d38094..a7e133f3495e9132a5fdae2c24f225e7 DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index f45b616c4f418298c67903c141c52172b6dd51e0..6a30389c1d498843ca8cc01bfc50dc5656d7d2e4 100644 +index 3fcd7bfdb8945b276c94a263e9da6b85ce470366..3431b1132e55c53cda7cf47f021f23068b63322d 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -61,6 +61,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -163,7 +163,7 @@ index f45b616c4f418298c67903c141c52172b6dd51e0..6a30389c1d498843ca8cc01bfc50dc56 + // Paper end String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); - java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.getRawAddress()).getAddress(); // Paper + java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.channel.remoteAddress()).getAddress(); // Paper @@ -411,6 +428,47 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, // Spigot end @@ -213,7 +213,7 @@ index f45b616c4f418298c67903c141c52172b6dd51e0..6a30389c1d498843ca8cc01bfc50dc56 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 72f4b2adb2601e9869fe972cff5da4d6934f5325..fe0a23ca59cbb4027fdeded10cf148d429306d3a 100644 +index 2a9b967e40909ccd4727c1ca81b57b6ca9ce4f05..f9a9d2bb7b6d1bf4a0931438de4d8c7ee0757479 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -774,7 +774,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0948-Use-single-player-info-update-packet-on-join.patch b/patches/server/0948-Use-single-player-info-update-packet-on-join.patch index fa91ac36cd..e19d54bf4d 100644 --- a/patches/server/0948-Use-single-player-info-update-packet-on-join.patch +++ b/patches/server/0948-Use-single-player-info-update-packet-on-join.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use single player info update packet on join diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3bec358de0348ba64ddbd83b63814fdc7b375b55..ed09fc864a400f8a12e4097e28542a5792d1a902 100644 +index afcdd85d2b10bbd76c589c419feefd87f3ea1825..2d8488b9aa088b6d5f0c7e557b8ad0b29bc4cd88 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -3625,7 +3625,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -58,16 +58,3 @@ index 3793cc8a2cc917ba33b18c5af7fac25e9c1da288..c0c14766adaac855112f85a203a6163b player.sentListPacket = true; player.supressTrackerForLogin = false; // Paper ((ServerLevel)player.level).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now -diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java -index 6d46908692637ace5d81a9948f5ed42e142f549a..31b515fd19555585d6e3a6f1da3bcd7fac380a50 100644 ---- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java -+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java -@@ -242,8 +242,4 @@ public class DamageSources { - public DamageSource sonicBoom(Entity attacker) { - return this.source(DamageTypes.SONIC_BOOM, attacker); - } -- -- public DamageSource badRespawnPointExplosion(Vec3 position) { -- return new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position); -- } - } diff --git a/patches/server/0952-Fix-force-opening-enchantment-tables.patch b/patches/server/0952-Fix-force-opening-enchantment-tables.patch index 425f04f634..2abcb07620 100644 --- a/patches/server/0952-Fix-force-opening-enchantment-tables.patch +++ b/patches/server/0952-Fix-force-opening-enchantment-tables.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix force-opening enchantment tables diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index e54833a19fb0d8e530fce202d998287c02961b35..1eb7a9732a270bd501e22a36230fe49b02a91fba 100644 +index d3644b268c10fd839338a5b1bfc42b4ae5286555..d445a75736d4ab9f790387c6a8f077cc45f7023f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -402,7 +402,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -403,7 +403,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { // If there isn't an enchant table we can force create one, won't be very useful though. BlockPos pos = new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()); diff --git a/patches/server/0958-Fix-HumanEntity-drop-not-updating-the-client-inv.patch b/patches/server/0958-Fix-HumanEntity-drop-not-updating-the-client-inv.patch index 9e2c1a3e4b..5d32898ade 100644 --- a/patches/server/0958-Fix-HumanEntity-drop-not-updating-the-client-inv.patch +++ b/patches/server/0958-Fix-HumanEntity-drop-not-updating-the-client-inv.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Fix HumanEntity#drop not updating the client inv public net.minecraft.server.level.ServerPlayer containerSynchronizer diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 1eb7a9732a270bd501e22a36230fe49b02a91fba..06efb7230f56ed1f5440b40f7032573ec817cef8 100644 +index d445a75736d4ab9f790387c6a8f077cc45f7023f..c8cccfcf4d572a9e65fce09621aeed2a7045003c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -755,8 +755,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -756,8 +756,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { // Paper end @Override public boolean dropItem(boolean dropAll) { diff --git a/patches/server/0959-Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/server/0959-Add-CompostItemEvent-and-EntityCompostItemEvent.patch index cfdc9625e4..7998c0b4d4 100644 --- a/patches/server/0959-Add-CompostItemEvent-and-EntityCompostItemEvent.patch +++ b/patches/server/0959-Add-CompostItemEvent-and-EntityCompostItemEvent.patch @@ -4,19 +4,6 @@ Date: Sun, 8 Aug 2021 19:56:02 +0200 Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent -diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java -index 05c1e8c9f013547d4fcdbbd299329166a8ece1b0..aff235c019ae5c6ed5227127d5424b34af5f36dd 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java -+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java -@@ -58,7 +58,7 @@ public class WorkAtComposter extends WorkAtPoi { - i -= p; - - for(int q = 0; q < p; ++q) { -- blockState = ComposterBlock.insertItem(entity, blockState, world, itemStack, blockPos); -+ blockState = ComposterBlock.insertItem(entity, blockState, world, itemStack, blockPos, entity); // Paper - if (blockState.getValue(ComposterBlock.LEVEL) == 7) { - this.spawnComposterFillEffects(world, composterState, blockPos, blockState); - return; diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java index e81bda56c58df6c3109382c17e86f4cc0f16cf81..fc3f08db8e3747e6e9d6f448c91e51144d480585 100644 --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java