From a8c7bd874045c521a73b4d82d5d548f5c18c498e Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 25 Dec 2023 23:51:56 +0100 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: cc9aa21a SPIGOT-6399, SPIGOT-7344: Clarify collidable behavior for player entities f23325b6 Add API for per-world simulation distances 26e1774e Add API for per-world view distances 0b541e60 Add PlayerLoginEvent#getRealAddress 5f027d2d PR-949: Add Vector#fromJOML() overloads for read-only vector types CraftBukkit Changes: bcf56171a PR-1321: Clean up some stuff which got missed during previous PRs 7f833a2d1 SPIGOT-7462: Players no longer drop XP after dying near a Sculk Catalyst 752aac669 Implement APIs for per world view and simulation distances 57d7ef433 Preserve empty enchantment tags for glow effect 465ec3fb4 Remove connected check on setScoreboard f90ce621e Use one PermissibleBase for all command blocks 5876cca44 SPIGOT-7550: Fix creation of Arrow instances f03fc3aa3 SPIGOT-7549: ServerTickManager#setTickRate incorrect Precondition 9d7f49b01 SPIGOT-7548: Fix wrong spawn location for experience orb and dropped item Spigot Changes: ed9ba9a4 Drop no longer required patch ignoring -o option 86b5dd6a SPIGOT-7546: Fix hardcoded check for outdated client message aa7cde7a Remove obsolete APIs for per world view and simulation distances 6dff577e Remove obsolete patch preserving empty `ench` tags a3bf95b8 Remove obsolete PlayerLoginEvent#getRealAddress 1b02f5d6 Remove obsolete connected check on setScoreboard patch acf717eb Remove obsolete command block PermissibleBase patch 053fa2a9 Remove redundant patch dealing with null tile entities --- patches/api/Add-view-distance-API.patch | 10 +++--- patches/api/Adventure.patch | 25 +++++++------- .../api/Fix-Spigot-annotation-mistakes.patch | 7 ++-- patches/api/More-World-API.patch | 4 +-- ...-command-sender-which-forwards-feedb.patch | 14 ++------ .../server/Add-StructuresLocateEvent.patch | 2 +- patches/server/Adventure.patch | 8 ++--- .../server/Disable-spigot-tick-limiters.patch | 2 +- ...PI-for-Reason-Source-Triggering-play.patch | 2 +- .../Fix-MC-117075-TE-Unload-Lag-Spike.patch | 8 ----- ...rs-not-working-in-some-kick-messages.patch | 2 +- ...ncorrect-message-for-outdated-client.patch | 19 ----------- .../Handle-Item-Meta-Inconsistencies.patch | 2 +- patches/server/MC-Utils.patch | 2 +- patches/server/More-World-API.patch | 2 +- ...eData-on-more-entities-when-spawning.patch | 2 +- patches/server/Rewrite-chunk-system.patch | 33 ++++++++++--------- ...otfix-spawning-item-xp-in-wrong-spot.patch | 8 ----- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 21 files changed, 57 insertions(+), 101 deletions(-) delete mode 100644 patches/server/Fix-incorrect-message-for-outdated-client.patch diff --git a/patches/api/Add-view-distance-API.patch b/patches/api/Add-view-distance-API.patch index 02b12e6cb..ac83f6e87 100644 --- a/patches/api/Add-view-distance-API.patch +++ b/patches/api/Add-view-distance-API.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - int getSimulationDistance(); - // Spigot end + @NotNull + public Set getFeatureFlags(); + // Paper start - view distance api + /** @@ -71,9 +71,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + void setSendViewDistance(int viewDistance); + // Paper end - view distance api + - // Spigot start - public class Spigot { - + /** + * Represents various map environment types that a world may be + */ diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Player.java diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 11a1296aa..9d67c6eca 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -3605,14 +3605,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java @@ -0,0 +0,0 @@ public class PlayerLoginEvent extends PlayerEvent { - private final InetAddress address; + private final InetAddress realAddress; private final String hostname; private Result result = Result.ALLOWED; - private String message = ""; + private net.kyori.adventure.text.Component message = net.kyori.adventure.text.Component.empty(); - private final InetAddress realAddress; // Spigot /** + * This constructor defaults message to an empty string, and result to @@ -0,0 +0,0 @@ public class PlayerLoginEvent extends PlayerEvent { * @param result The result status for this event * @param message The message to be displayed if result denies login @@ -3620,8 +3620,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @deprecated in favour of {@link #PlayerLoginEvent(Player, String, InetAddress, Result, net.kyori.adventure.text.Component, InetAddress)} */ + @Deprecated // Paper - public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) { // Spigot - this(player, hostname, address, realAddress); // Spigot + public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) { + this(player, hostname, address, realAddress); this.result = result; + this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + } @@ -3638,12 +3638,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param message The message to be displayed if result denies login + * @param realAddress the actual, unspoofed connecting address + */ -+ public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final net.kyori.adventure.text.Component message, @NotNull final InetAddress realAddress) { // Spigot ++ public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final net.kyori.adventure.text.Component message, @NotNull final InetAddress realAddress) { + this(player, hostname, address, realAddress); // Spigot + this.result = result; -+ this.message = message; -+ } -+ + this.message = message; + } + + /** + * Gets the current kick message that will be used if getResult() != + * Result.ALLOWED @@ -3660,12 +3660,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param message New kick message + */ + public void kickMessage(net.kyori.adventure.text.@NotNull Component message) { - this.message = message; - } ++ this.message = message; ++ } + // Paper end - - // Spigot start ++ /** + * Gets the current result of the login, as an enum + * @@ -0,0 +0,0 @@ public class PlayerLoginEvent extends PlayerEvent { * Result.ALLOWED * diff --git a/patches/api/Fix-Spigot-annotation-mistakes.patch b/patches/api/Fix-Spigot-annotation-mistakes.patch index 5873f4e5a..4a617a67b 100644 --- a/patches/api/Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/Fix-Spigot-annotation-mistakes.patch @@ -615,13 +615,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** @@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - // Paper end - view distance api + StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored); // Spigot start -+ /** -+ * @deprecated Unsupported api -+ */ -+ @Deprecated // Paper ++ @Deprecated(forRemoval = true) // Paper public class Spigot { /** diff --git a/patches/api/More-World-API.patch b/patches/api/More-World-API.patch index cce0f63f5..228460e8a 100644 --- a/patches/api/More-World-API.patch +++ b/patches/api/More-World-API.patch @@ -129,5 +129,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + // Spigot start - /** - * Returns the view distance used for this world. + @Deprecated(forRemoval = true) // Paper + public class Spigot { diff --git a/patches/server/API-for-creating-command-sender-which-forwards-feedb.patch b/patches/server/API-for-creating-command-sender-which-forwards-feedb.patch index 26a1d28bf..8e559cfdc 100644 --- a/patches/server/API-for-creating-command-sender-which-forwards-feedb.patch +++ b/patches/server/API-for-creating-command-sender-which-forwards-feedb.patch @@ -143,23 +143,15 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java -@@ -0,0 +0,0 @@ import org.bukkit.plugin.Plugin; +@@ -0,0 +0,0 @@ import org.bukkit.permissions.PermissionAttachmentInfo; + import org.bukkit.plugin.Plugin; public abstract class ServerCommandSender implements CommandSender { - private static PermissibleBase blockPermInst; - private final PermissibleBase perm; + public final PermissibleBase perm; // Paper private net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers -+ // Paper start -+ public ServerCommandSender(final PermissibleBase permissibleBase) { -+ this.perm = permissibleBase; -+ } -+ // Paper end -+ - public ServerCommandSender() { - if (this instanceof CraftBlockCommandSender) { - if (ServerCommandSender.blockPermInst == null) { + protected ServerCommandSender() { diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java diff --git a/patches/server/Add-StructuresLocateEvent.patch b/patches/server/Add-StructuresLocateEvent.patch index fb5f6e8b3..276f81191 100644 --- a/patches/server/Add-StructuresLocateEvent.patch +++ b/patches/server/Add-StructuresLocateEvent.patch @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - StructuresLocateEvent + final org.bukkit.World bukkitWorld = world.getWorld(); + final org.bukkit.Location origin = io.papermc.paper.util.MCUtil.toLocation(world, center); -+ final List apiStructures = structures.stream().map(Holder::value).map(nms -> org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(nms, world.registryAccess())).toList(); ++ final List apiStructures = structures.stream().map(Holder::value).map(nms -> org.bukkit.craftbukkit.generator.structure.CraftStructure.minecraftToBukkit(nms)).toList(); + if (!apiStructures.isEmpty()) { + final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(bukkitWorld, origin, apiStructures, radius, skipReferencedStructures); + if (!event.callEvent()) { diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 1988ae368..5a0e29144 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -3854,7 +3854,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public boolean isOp() { - return true; + return CraftBlockCommandSender.SHARED_PERM.isOp(); diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java @@ -3926,13 +3926,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandSender.java @@ -0,0 +0,0 @@ import org.bukkit.plugin.Plugin; + public abstract class ServerCommandSender implements CommandSender { - private static PermissibleBase blockPermInst; private final PermissibleBase perm; + private net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers - public ServerCommandSender() { - if (this instanceof CraftBlockCommandSender) { + protected ServerCommandSender() { + this.perm = new PermissibleBase(this); @@ -0,0 +0,0 @@ public abstract class ServerCommandSender implements CommandSender { return this.spigot; } diff --git a/patches/server/Disable-spigot-tick-limiters.patch b/patches/server/Disable-spigot-tick-limiters.patch index 2a7549b79..85e738f21 100644 --- a/patches/server/Disable-spigot-tick-limiters.patch +++ b/patches/server/Disable-spigot-tick-limiters.patch @@ -18,4 +18,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition); - // Spigot start + // Spigot end diff --git a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 0255ae822..9d81bf05b 100644 --- a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -331,7 +331,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return item; })); register(new EntityTypeData<>(EntityType.EXPERIENCE_ORB, ExperienceOrb.class, CraftExperienceOrb::new, -- spawnData -> new net.minecraft.world.entity.ExperienceOrb(spawnData.minecraftWorld(), spawnData.x(), spawnData.z(), spawnData.z(), 0) +- spawnData -> new net.minecraft.world.entity.ExperienceOrb(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), 0) + spawnData -> new net.minecraft.world.entity.ExperienceOrb(spawnData.minecraftWorld(), spawnData.x(), spawnData.z(), spawnData.z(), 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null) // Paper )); register(new EntityTypeData<>(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloud.class, CraftAreaEffectCloud::new, spawnData -> new net.minecraft.world.entity.AreaEffectCloud(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); diff --git a/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch index a00ffacf8..863c96117 100644 --- a/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -17,14 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition); -@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - if (tickingblockentity == null) { - this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash"); - tilesThisCycle--; -- this.blockEntityTickers.remove(this.tileTickPosition--); - continue; - } - // Spigot end @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (tickingblockentity.isRemoved()) { // Spigot start diff --git a/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch index 8a08d3233..d2865ebf8 100644 --- a/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - MutableComponent ichatmutablecomponent; + Component ichatmutablecomponent; // Paper - Fix hex colors not working in some kick messages - if (packet.protocolVersion() < 754) { + if (packet.protocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Spigot - SPIGOT-7546: Handle version check correctly for outdated client message - ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot + ichatmutablecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages } else { diff --git a/patches/server/Fix-incorrect-message-for-outdated-client.patch b/patches/server/Fix-incorrect-message-for-outdated-client.patch deleted file mode 100644 index 4fd022e49..000000000 --- a/patches/server/Fix-incorrect-message-for-outdated-client.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: sulu5890 -Date: Sun, 11 Jul 2021 19:34:03 -0500 -Subject: [PATCH] Fix incorrect message for outdated client - - -diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) { - Component ichatmutablecomponent; // Paper - Fix hex colors not working in some kick messages - -- if (packet.protocolVersion() < 754) { -+ if (packet.protocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Paper - Fix incorrect message for outdated clients - ichatmutablecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages - } else { - ichatmutablecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromString( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) )[0]; // Spigot // Paper - Fix hex colors not working in some kick messages diff --git a/patches/server/Handle-Item-Meta-Inconsistencies.patch b/patches/server/Handle-Item-Meta-Inconsistencies.patch index 61423090a..61456225b 100644 --- a/patches/server/Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/Handle-Item-Meta-Inconsistencies.patch @@ -216,7 +216,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.blockData = meta.blockData; - if (meta.enchantments != null) { // Spigot + if (meta.enchantments != null) { - this.enchantments = new LinkedHashMap(meta.enchantments); + this.enchantments = new EnchantmentMap(meta.enchantments); // Paper } diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 5a695142c..a53b3cbac 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -6636,7 +6636,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class DistanceManager { final Executor mainThreadExecutor; private long ticketTickCounter; - private int simulationDistance = 10; + public int simulationDistance = 10; + private final ChunkMap chunkMap; // Paper - protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor) { diff --git a/patches/server/More-World-API.patch b/patches/server/More-World-API.patch index 6c0dbcc16..ac256f0ee 100644 --- a/patches/server/More-World-API.patch +++ b/patches/server/More-World-API.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value(), this.getHandle().registryAccess()), CraftLocation.toBukkit(found.getFirst(), this)); + return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value()), CraftLocation.toBukkit(found.getFirst(), this)); } + // Paper start diff --git a/patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch b/patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch index 7f6d10385..d7c05fcaa 100644 --- a/patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch +++ b/patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public final class CraftEntityTypes { net.minecraft.world.item.ItemStack itemStack = new net.minecraft.world.item.ItemStack(Items.STONE); - ItemEntity item = new ItemEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.z(), spawnData.z(), itemStack); + ItemEntity item = new ItemEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), itemStack); item.setPickUpDelay(10); + CLEAR_MOVE_IF_NOT_RANDOMIZED.accept(spawnData, item); // Paper - respect randomizeData diff --git a/patches/server/Rewrite-chunk-system.patch b/patches/server/Rewrite-chunk-system.patch index 0e70321cd..d97f57bcb 100644 --- a/patches/server/Rewrite-chunk-system.patch +++ b/patches/server/Rewrite-chunk-system.patch @@ -17555,7 +17555,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final Int2ObjectMap entityMap; @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final Queue unloadQueue; - private int serverViewDistance; + public int serverViewDistance; - // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() - public final CallbackExecutor callbackExecutor = new CallbackExecutor(); @@ -17577,10 +17577,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } - }; - // CraftBukkit end -+ // Paper - rewrite chunk system - +- // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); + @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ()); // Note: players need to be explicitly added to distance maps before they can be updated @@ -18672,7 +18672,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - final LongSet ticketsToRelease = new LongOpenHashSet(); - final Executor mainThreadExecutor; - private long ticketTickCounter; -- private int simulationDistance = 10; +- public int simulationDistance = 10; + // Paper - rewrite chunk system private final ChunkMap chunkMap; // Paper @@ -18719,8 +18719,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - + this.getChunkHolderManager().tick(); // Paper - rewrite chunk system } - +- private static int getTicketLevelAt(SortedArraySet> tickets) { + return !tickets.isEmpty() ? ((Ticket) tickets.first()).getTicketLevel() : ChunkLevel.MAX_LEVEL + 1; + } @@ -0,0 +0,0 @@ public abstract class DistanceManager { protected abstract ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k); @@ -18999,8 +19001,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } catch (Throwable throwable1) { - throwable.addSuppressed(throwable1); - } -+ // Paper - rewrite chunk system - +- - throw throwable; - } - @@ -19010,7 +19011,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } - - } -- ++ // Paper - rewrite chunk system + - @VisibleForTesting - TickingTracker tickingTracker() { - return this.tickingTicketsTracker; @@ -22755,19 +22757,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 SortedArraySet> tickets = chunkTickets.getValue(); @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - // Spigot start + @Override public int getViewDistance() { -- return this.world.spigotConfig.viewDistance; +- return this.world.getChunkSource().chunkMap.serverViewDistance; + return this.getHandle().playerChunkLoader.getAPIViewDistance(); // Paper - replace player chunk loader } @Override public int getSimulationDistance() { -- return this.world.spigotConfig.simulationDistance; +- return this.world.getChunkSource().chunkMap.getDistanceManager().simulationDistance; + return this.getHandle().playerChunkLoader.getAPITickDistance(); // Paper - replace player chunk loader - } - // Spigot end ++ } + // Paper start - view distance api + @Override + public void setViewDistance(int viewDistance) { @@ -22805,11 +22806,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void setSendViewDistance(int viewDistance) { + this.getHandle().chunkSource.chunkMap.setSendViewDistance(viewDistance); // Paper - replace player chunk loader -+ } + } + // Paper end - view distance api - // Spigot start - private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot() + public BlockMetadataStore getBlockMetadata() { + return this.blockMetadata; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/patches/server/hotfix-spawning-item-xp-in-wrong-spot.patch b/patches/server/hotfix-spawning-item-xp-in-wrong-spot.patch index b13bc5cab..310e0c66d 100644 --- a/patches/server/hotfix-spawning-item-xp-in-wrong-spot.patch +++ b/patches/server/hotfix-spawning-item-xp-in-wrong-spot.patch @@ -9,14 +9,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -0,0 +0,0 @@ public final class CraftEntityTypes { - // We use stone instead of empty, to give the plugin developer a visual clue, that the spawn method is working, - // and that the item stack should probably be changed. - net.minecraft.world.item.ItemStack itemStack = new net.minecraft.world.item.ItemStack(Items.STONE); -- ItemEntity item = new ItemEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.z(), spawnData.z(), itemStack); -+ ItemEntity item = new ItemEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), itemStack); - item.setPickUpDelay(10); - CLEAR_MOVE_IF_NOT_RANDOMIZED.accept(spawnData, item); // Paper - respect randomizeData - return item; })); register(new EntityTypeData<>(EntityType.EXPERIENCE_ORB, ExperienceOrb.class, CraftExperienceOrb::new, diff --git a/work/Bukkit b/work/Bukkit index f29cb8015..cc9aa21a2 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit f29cb8015897da1bca0c93522c5884c4c9f93601 +Subproject commit cc9aa21a289b9a7d361c4a8f99b56d5300f40d4c diff --git a/work/CraftBukkit b/work/CraftBukkit index b3b43a6ad..bcf56171a 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit b3b43a6ad21c9f7fc2dd0a1e7e94abae0057770d +Subproject commit bcf56171a63d24b21bea341e8f5b3c5234f077c3 diff --git a/work/Spigot b/work/Spigot index 06d602e7c..ed9ba9a42 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 06d602e7c3165ebf32f7419cb5873ec82d54ff7c +Subproject commit ed9ba9a42d6c6aca02c474aed4207b7b4fd6f5d6