diff --git a/patches/api/Add-UUID-attribute-modifier-API.patch b/patches/api/Add-UUID-attribute-modifier-API.patch index 510fe1fc64..23ebbbce2c 100644 --- a/patches/api/Add-UUID-attribute-modifier-API.patch +++ b/patches/api/Add-UUID-attribute-modifier-API.patch @@ -14,21 +14,80 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + /** ++ * Gets the modifier with the corresponding key. ++ * ++ * @param key the jey of the modifier ++ * @return the modifier, if it exists ++ */ ++ @org.jetbrains.annotations.Nullable AttributeModifier getModifier(@NotNull net.kyori.adventure.key.Key key); ++ ++ /** ++ * Remove a modifier with the corresponding key from this instance. ++ * ++ * @param key the key of the modifier ++ */ ++ void removeModifier(@NotNull net.kyori.adventure.key.Key key); ++ ++ /** + * Gets the modifier with the corresponding UUID. + * + * @param uuid the UUID of the modifier + * @return the modifier, if it exists ++ * @deprecated use {@link #getModifier(net.kyori.adventure.key.Key)}, modifiers are no longer stored by UUID + */ ++ @Deprecated(forRemoval = true, since = "1.21") + @org.jetbrains.annotations.Nullable AttributeModifier getModifier(@NotNull java.util.UUID uuid); + + /** + * Remove a modifier with the corresponding UUID from this instance. + * + * @param uuid the UUID of the modifier ++ * @deprecated use {@link #removeModifier(net.kyori.adventure.key.Key)}, modifiers are no longer stored by UUID + */ ++ @Deprecated(forRemoval = true, since = "1.21") + void removeModifier(@NotNull java.util.UUID uuid); + // Paper end + /** * Add a modifier to this instance. * +diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java ++++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java +@@ -0,0 +0,0 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed { + private final Operation operation; + private final EquipmentSlotGroup slot; + +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.21") + public AttributeModifier(@NotNull String name, double amount, @NotNull Operation operation) { + this(UUID.randomUUID(), name, amount, operation); + } + +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.21") + public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation) { + this(uuid, name, amount, operation, (EquipmentSlot) null); + } + +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.21") + public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @Nullable EquipmentSlot slot) { + this(uuid, name, amount, operation, (slot) == null ? EquipmentSlotGroup.ANY : slot.getGroup()); + } + +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.21") + public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @NotNull EquipmentSlotGroup slot) { + this(NamespacedKey.fromString(uuid.toString()), amount, operation, slot); + } +@@ -0,0 +0,0 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed { + * @deprecated attributes are now identified by keys + */ + @NotNull +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.21") + public UUID getUniqueId() { + return UUID.fromString(getKey().toString()); + } diff --git a/patches/api/Allow-delegation-to-vanilla-chunk-gen.patch b/patches/api/Allow-delegation-to-vanilla-chunk-gen.patch deleted file mode 100644 index 6d01663663..0000000000 --- a/patches/api/Allow-delegation-to-vanilla-chunk-gen.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MiniDigger | Martin <admin@minidigger.dev> -Date: Wed, 29 Apr 2020 02:09:17 +0200 -Subject: [PATCH] Allow delegation to vanilla chunk gen - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - return server.createChunkData(world); - } - -+ // Paper start -+ /** -+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world -+ * -+ * @param world the world to create the ChunkData for -+ * @param x the x coordinate of the chunk -+ * @param z the z coordinate of the chunk -+ * @return a new ChunkData for the world -+ * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to -+ * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation. -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ public static ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z) { -+ return server.createVanillaChunkData(world, x, z); -+ } -+ // Paper end -+ - /** - * Creates a boss bar instance to display to players. The progress - * defaults to 1.0 -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public ChunkGenerator.ChunkData createChunkData(@NotNull World world); - -+ // Paper start -+ /** -+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world. -+ * -+ * @param world the world to create the ChunkData for -+ * @param x the x coordinate of the chunk -+ * @param z the z coordinate of the chunk -+ * @return a new ChunkData for the world -+ * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to -+ * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation. -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z); -+ // Paper end -+ - /** - * Creates a boss bar instance to display to players. The progress - * defaults to 1.0 -diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/generator/ChunkGenerator.java -+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java -@@ -0,0 +0,0 @@ public abstract class ChunkGenerator { - return false; - } - -+ // Paper start -+ /** -+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world -+ * -+ * @param world the world to create the ChunkData for -+ * @param x the x coordinate of the chunk -+ * @param z the z coordinate of the chunk -+ * @return a new ChunkData for the world -+ * -+ */ -+ @NotNull -+ public ChunkData createVanillaChunkData(@NotNull World world, int x, int z) { -+ return Bukkit.getServer().createVanillaChunkData(world, x, z); -+ } -+ // Paper end -+ - /** - * Gets if the server should generate Vanilla structures after this - * ChunkGenerator. diff --git a/patches/api/ItemStack-getMaxItemUseDuration.patch b/patches/api/ItemStack-getMaxItemUseDuration.patch index dbea6152a9..4854ac1b72 100644 --- a/patches/api/ItemStack-getMaxItemUseDuration.patch +++ b/patches/api/ItemStack-getMaxItemUseDuration.patch @@ -9,28 +9,20 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -0,0 +0,0 @@ import org.bukkit.Translatable; - import org.bukkit.Utility; - import org.bukkit.configuration.serialization.ConfigurationSerializable; - import org.bukkit.enchantments.Enchantment; -+import org.bukkit.entity.LivingEntity; - import org.bukkit.inventory.meta.Damageable; - import org.bukkit.inventory.meta.ItemMeta; - import org.bukkit.material.MaterialData; @@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat public String getI18NDisplayName() { return Bukkit.getServer().getItemFactory().getI18NDisplayName(this); } + + /** -+ * @deprecated use {@link #getMaxItemUseDuration(LivingEntity)}; crossbows, later possibly more items require an entity parameter ++ * @deprecated use {@link #getMaxItemUseDuration(org.bukkit.entity.LivingEntity)}; crossbows, later possibly more items require an entity parameter + */ + @Deprecated(forRemoval = true) + public int getMaxItemUseDuration() { + return getMaxItemUseDuration(null); + } + -+ public int getMaxItemUseDuration(@NotNull final LivingEntity entity) { ++ public int getMaxItemUseDuration(@NotNull final org.bukkit.entity.LivingEntity entity) { + if (type == null || type == Material.AIR || !type.isItem()) { + return 0; + } diff --git a/patches/server/Ability-to-apply-mending-to-XP-API.patch b/patches/server/Ability-to-apply-mending-to-XP-API.patch index 7f904db5f4..286d4a6890 100644 --- a/patches/server/Ability-to-apply-mending-to-XP-API.patch +++ b/patches/server/Ability-to-apply-mending-to-XP-API.patch @@ -26,9 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public int applyMending(int amount) { + ServerPlayer handle = this.getHandle(); + // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties -+ final var stackEntry = net.minecraft.world.item.enchantment.EnchantmentHelper -+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle, net.minecraft.world.item.ItemStack::isDamaged); -+ final net.minecraft.world.item.ItemStack itemstack = stackEntry != null ? stackEntry.getValue() : net.minecraft.world.item.ItemStack.EMPTY; ++ ++ final Optional<net.minecraft.world.item.enchantment.EnchantedItemInUse> stackEntry = net.minecraft.world.item.enchantment.EnchantmentHelper ++ .getRandomItemWith(net.minecraft.world.item.enchantment.EnchantmentEffectComponents.REPAIR_WITH_XP, handle, net.minecraft.world.item.ItemStack::isDamaged); ++ final net.minecraft.world.item.ItemStack itemstack = stackEntry.map(net.minecraft.world.item.enchantment.EnchantedItemInUse::itemStack).orElse(net.minecraft.world.item.ItemStack.EMPTY); + if (!itemstack.isEmpty() && itemstack.getItem().components().has(net.minecraft.core.component.DataComponents.MAX_DAMAGE)) { + net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level()); + orb.value = amount; diff --git a/patches/server/Add-ItemFactory-getSpawnEgg-API.patch b/patches/server/Add-ItemFactory-getSpawnEgg-API.patch index 1181543d2a..b944acb7b3 100644 --- a/patches/server/Add-ItemFactory-getSpawnEgg-API.patch +++ b/patches/server/Add-ItemFactory-getSpawnEgg-API.patch @@ -8,6 +8,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +@@ -0,0 +0,0 @@ import net.minecraft.core.HolderSet; + import net.minecraft.core.RegistryAccess; + import net.minecraft.core.component.DataComponentPatch; + import net.minecraft.core.registries.Registries; ++import net.minecraft.resources.ResourceLocation; + import net.minecraft.server.MinecraftServer; + import net.minecraft.tags.EnchantmentTags; + import net.minecraft.util.RandomSource; @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { new net.md_5.bungee.api.chat.TextComponent(customName)); } @@ -21,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + String typeId = type.getKey().toString(); -+ net.minecraft.resources.ResourceLocation typeKey = new net.minecraft.resources.ResourceLocation(typeId); ++ net.minecraft.resources.ResourceLocation typeKey = ResourceLocation.parse(typeId); + net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(typeKey); + net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType); + return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror(); diff --git a/patches/server/Add-Mob-Experience-reward-API.patch b/patches/server/Add-Mob-Experience-reward-API.patch index f64f9ecbd1..180d7621f1 100644 --- a/patches/server/Add-Mob-Experience-reward-API.patch +++ b/patches/server/Add-Mob-Experience-reward-API.patch @@ -8,6 +8,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +@@ -0,0 +0,0 @@ + package org.bukkit.craftbukkit.entity; + + import com.google.common.base.Preconditions; ++import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import org.bukkit.Sound; + import org.bukkit.craftbukkit.CraftLootTable; @@ -0,0 +0,0 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { this.getHandle().setAggressive(aggressive); } @@ -16,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override + public int getPossibleExperienceReward() { -+ return getHandle().getExperienceReward(); ++ return getHandle().getExperienceReward((ServerLevel) this.getHandle().level(), null); + } + // Paper end } diff --git a/patches/server/Add-PlayerKickEvent-causes.patch b/patches/server/Add-PlayerKickEvent-causes.patch index dc5e5e87d2..8d9d1f1880 100644 --- a/patches/server/Add-PlayerKickEvent-causes.patch +++ b/patches/server/Add-PlayerKickEvent-causes.patch @@ -279,8 +279,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start - validate pick item position if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); -- this.disconnect("Invalid hotbar selection (Hacking?)"); -+ this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause +- this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)")); ++ this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause return; } this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed @@ -288,8 +288,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; if (byteLength > 256 * 4) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); -- server.scheduleOnMain(() -> this.disconnect("Book too large!")); -+ server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause +- server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"))); ++ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause return; } byteTotal += byteLength; @@ -297,8 +297,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); -- server.scheduleOnMain(() -> this.disconnect("Book too large!")); -+ server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause +- server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"))); ++ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause return; } } diff --git a/patches/server/Add-PlayerPickItemEvent.patch b/patches/server/Add-PlayerPickItemEvent.patch index 3d7090c4f8..90bc5e8f68 100644 --- a/patches/server/Add-PlayerPickItemEvent.patch +++ b/patches/server/Add-PlayerPickItemEvent.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause + this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause return; } - this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed diff --git a/patches/server/Add-PlayerRecipeBookClickEvent.patch b/patches/server/Add-PlayerRecipeBookClickEvent.patch index f179b884c2..98bfeacc03 100644 --- a/patches/server/Add-PlayerRecipeBookClickEvent.patch +++ b/patches/server/Add-PlayerRecipeBookClickEvent.patch @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + recipeName = CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey()); + makeAll = event.isShiftClick(); + } -+ if (!(this.player.containerMenu instanceof RecipeBookMenu<?> recipeBookMenu)) { ++ if (!(this.player.containerMenu instanceof RecipeBookMenu<?, ?> recipeBookMenu)) { + return; + } + // Paper end - Add PlayerRecipeBookClickEvent diff --git a/patches/server/Add-UUID-attribute-modifier-API.patch b/patches/server/Add-UUID-attribute-modifier-API.patch index 2a886f89ab..49b52e0da2 100644 --- a/patches/server/Add-UUID-attribute-modifier-API.patch +++ b/patches/server/Add-UUID-attribute-modifier-API.patch @@ -28,6 +28,80 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void addModifier(AttributeModifier modifier) { throw new UnsupportedOperationException("Cannot modify default attributes"); +diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/AttributeMappings.java b/src/main/java/org/bukkit/craftbukkit/attribute/AttributeMappings.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/org/bukkit/craftbukkit/attribute/AttributeMappings.java +@@ -0,0 +0,0 @@ ++package org.bukkit.craftbukkit.attribute; ++ ++import java.util.HashMap; ++import java.util.Map; ++import java.util.UUID; ++import org.bukkit.NamespacedKey; ++import org.jetbrains.annotations.NotNull; ++ ++final class AttributeMappings { ++ private static final Map<UUID, NamespacedKey> ATTRIBUTE_MODIFIER_IDS = new HashMap<>(); ++ ++ static { ++ add(-4483571535397864886L, -5989644940537681742L, "armor.body"); ++ add(8144722948526719024L, -7778190119041365872L, "effect.slowness"); ++ add(6967552254039378640L, -9116175396973475259L, "enchantment.aqua_affinity"); ++ add(5279725409867744698L, -5150363631200102632L, "attacking"); ++ add(148071211714102867L, -7685811609035173472L, "attacking"); ++ add(6196088217904236654L, -7493791321850887290L, "effect.minining_fatigue"); ++ add(-5084161844451524480L, -8859020046251006329L, "enchantment.soul_speed"); ++ add(-7907339078496465106L, -8112074600724210224L, "enchantment.swift_sneak"); ++ add(6688265815086220243L, -6545541163342161890L, "drinking"); ++ add(8315164243412860989L, -6631520853640075966L, "creative_mode_block_range"); ++ add(4389663563256579765L, -4827163546944004714L, "enchantment.efficiency"); ++ add(6732612758648800940L, -5145707699103688244L, "effect.health_boost"); ++ add(9079981369298536661L, -6728494925450710401L, "covered"); ++ add(-1521481167610687786L, -8630419745734927691L, "effect.absorption"); ++ add(-7473408062188862076L, -5872005994337939597L, "creative_mode_entity_range"); ++ add(-3721396875562958315L, -5317020504214661337L, "effect.unluck"); ++ add(-2861585646493481178L, -6113244764726669811L, "armor.leggings"); ++ add(6718535547217657911L, -5386630269401489641L, "enchantment.sweeping_edge"); ++ add(-7949229004988660584L, -7828611303000832459L, "effect.speed"); ++ add(-8650171790042118250L, -5749650997644763080L, "enchantment.soul_speed"); ++ add(551224288813600377L, -8734740027710371860L, "enchantment.respiration"); ++ add(-7046399332347654691L, -6723081531683397260L, "suffocating"); ++ add(7361814797886573596L, -8641397326606817395L, "sprinting"); ++ add(-6972338111383059132L, -8978659762232839026L, "armor.chestplate"); ++ add(-5371971015925809039L, -6062243582569928137L, "enchantment.fire_protection"); ++ add(7245570952092733273L, -8449101711440750679L, "effect.strength"); ++ add(-422425648963762075L, -5756800103171642205L, "base_attack_speed"); ++ add(-4607081316629330256L, -7008565754814018370L, "effect.jump_boost"); ++ add(271280981090454338L, -8746077033958322898L, "effect.luck"); ++ add(2211131075215181206L, -5513857709499300658L, "powder_snow"); ++ add(-8908768238899017377L, -8313820693701227669L, "armor.boots"); ++ add(-5797418877589107702L, -6181652684028920077L, "effect.haste"); ++ add(3086076556416732775L, -5150312587563650736L, "armor.helmet"); ++ add(-5082757096938257406L, -4891139119377885130L, "baby"); ++ add(2478452629826324956L, -7247530463494186011L, "effect.weakness"); ++ add(4659420831966187055L, -5191473055587376048L, "enchantment.blast_protection"); ++ add(7301951777949303281L, -6753860660653972126L, "evil"); ++ add(8533189226688352746L, -8254757081029716377L, "baby"); ++ add(1286946037536540352L, -5768092872487507967L, "enchantment.depth_strider"); ++ add(-3801225194067177672L, -6586624321849018929L, "base_attack_damage"); ++ } ++ ++ public static @NotNull NamespacedKey uuidToKey(final UUID uuid) { ++ final NamespacedKey key = ATTRIBUTE_MODIFIER_IDS.get(uuid); ++ if (key != null) { ++ return key; ++ } else { ++ return NamespacedKey.minecraft(uuid.toString()); ++ } ++ } ++ ++ private static void add(final long msb, final long lsb, final String id) { ++ final UUID uuid = new UUID(msb, lsb); ++ ATTRIBUTE_MODIFIER_IDS.put(uuid, NamespacedKey.minecraft(id)); ++ } ++} diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java @@ -38,16 +112,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override ++ public AttributeModifier getModifier(final net.kyori.adventure.key.Key key) { ++ Preconditions.checkArgument(key != null, "Key cannot be null"); ++ net.minecraft.world.entity.ai.attributes.AttributeModifier modifier = this.handle.getModifier(io.papermc.paper.adventure.PaperAdventure.asVanilla(key)); ++ return modifier == null ? null : CraftAttributeInstance.convert(modifier); ++ } ++ ++ @Override ++ public void removeModifier(final net.kyori.adventure.key.Key key) { ++ Preconditions.checkArgument(key != null, "Key cannot be null"); ++ this.handle.removeModifier(io.papermc.paper.adventure.PaperAdventure.asVanilla(key)); ++ } ++ ++ @Override + public AttributeModifier getModifier(java.util.UUID uuid) { + Preconditions.checkArgument(uuid != null, "UUID cannot be null"); -+ net.minecraft.world.entity.ai.attributes.AttributeModifier modifier = this.handle.getModifier(uuid); -+ return modifier == null ? null : CraftAttributeInstance.convert(modifier); ++ return this.getModifier(AttributeMappings.uuidToKey(uuid)); + } + + @Override + public void removeModifier(java.util.UUID uuid) { + Preconditions.checkArgument(uuid != null, "UUID cannot be null"); -+ this.handle.removeModifier(uuid); ++ this.removeModifier(AttributeMappings.uuidToKey(uuid)); + } + // Paper end + diff --git a/patches/server/Add-exception-reporting-event.patch b/patches/server/Add-exception-reporting-event.patch index b6240f4cfc..1cede25cef 100644 --- a/patches/server/Add-exception-reporting-event.patch +++ b/patches/server/Add-exception-reporting-event.patch @@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start - Prevent block entity and entity crashes final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); -+ net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent ++ net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent LevelChunk.this.removeBlockEntity(this.getPos()); // Paper end - Prevent block entity and entity crashes // Spigot start diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 4b6d6b29b5..d9b325c5fb 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -4531,7 +4531,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public void playSound(final net.kyori.adventure.sound.Sound sound) { -+ final Vec3 pos = this.getHandle().position(); ++ final net.minecraft.world.phys.Vec3 pos = this.getHandle().position(); + this.playSound(sound, pos.x, pos.y, pos.z); + } + diff --git a/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch deleted file mode 100644 index feb0179d28..0000000000 --- a/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MiniDigger | Martin <admin@minidigger.dev> -Date: Wed, 29 Apr 2020 02:10:32 +0200 -Subject: [PATCH] Allow delegation to vanilla chunk gen - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME)); - } - -+ // Paper start - Allow delegation to vanilla chunk gen -+ private static final List<net.minecraft.world.level.chunk.status.ChunkStatus> VANILLA_GEN_STATUSES = List.of( -+ net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY, -+ net.minecraft.world.level.chunk.status.ChunkStatus.STRUCTURE_STARTS, -+ net.minecraft.world.level.chunk.status.ChunkStatus.STRUCTURE_REFERENCES, -+ net.minecraft.world.level.chunk.status.ChunkStatus.BIOMES, -+ net.minecraft.world.level.chunk.status.ChunkStatus.NOISE, -+ net.minecraft.world.level.chunk.status.ChunkStatus.SURFACE, -+ net.minecraft.world.level.chunk.status.ChunkStatus.CARVERS, -+ net.minecraft.world.level.chunk.status.ChunkStatus.FEATURES, -+ net.minecraft.world.level.chunk.status.ChunkStatus.INITIALIZE_LIGHT, -+ net.minecraft.world.level.chunk.status.ChunkStatus.LIGHT -+ ); -+ -+ @Override -+ @Deprecated(forRemoval = true) -+ public ChunkGenerator.ChunkData createVanillaChunkData(World world, int x, int z) { -+ // do bunch of vanilla shit -+ final net.minecraft.server.level.ServerLevel serverLevel = ((CraftWorld) world).getHandle(); -+ final net.minecraft.core.Registry<net.minecraft.world.level.biome.Biome> biomeRegistry = serverLevel.getServer().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME); -+ final net.minecraft.world.level.chunk.ProtoChunk protoChunk = new net.minecraft.world.level.chunk.ProtoChunk( -+ new net.minecraft.world.level.ChunkPos(x, z), -+ net.minecraft.world.level.chunk.UpgradeData.EMPTY, -+ serverLevel, -+ biomeRegistry, -+ null -+ ); -+ -+ final net.minecraft.world.level.chunk.ChunkGenerator chunkGenerator; -+ if (serverLevel.chunkSource.getGenerator() instanceof org.bukkit.craftbukkit.generator.CustomChunkGenerator bukkit) { -+ chunkGenerator = bukkit.getDelegate(); -+ } else { -+ chunkGenerator = serverLevel.chunkSource.getGenerator(); -+ } -+ -+ final net.minecraft.world.level.ChunkPos chunkPos = new net.minecraft.world.level.ChunkPos(x, z); -+ final net.minecraft.util.thread.ProcessorMailbox<Runnable> mailbox = net.minecraft.util.thread.ProcessorMailbox.create( -+ net.minecraft.Util.backgroundExecutor(), -+ "CraftServer#createVanillaChunkData(worldName='" + world.getName() + "', x='" + x + "', z='" + z + "')" -+ ); -+ for (final net.minecraft.world.level.chunk.status.ChunkStatus chunkStatus : VANILLA_GEN_STATUSES) { -+ final List<net.minecraft.world.level.chunk.ChunkAccess> chunks = Lists.newArrayList(); -+ final int statusRange = Math.max(1, chunkStatus.getRange()); -+ -+ for (int zz = chunkPos.z - statusRange; zz <= chunkPos.z + statusRange; ++zz) { -+ for (int xx = chunkPos.x - statusRange; xx <= chunkPos.x + statusRange; ++xx) { -+ if (xx == chunkPos.x && zz == chunkPos.z) { -+ chunks.add(protoChunk); -+ } else { -+ final net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeHolder = serverLevel.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS); -+ final net.minecraft.world.level.chunk.ChunkAccess chunk = new net.minecraft.world.level.chunk.EmptyLevelChunk(serverLevel, new net.minecraft.world.level.ChunkPos(xx, zz), biomeHolder); -+ chunks.add(chunk); -+ } -+ } -+ } -+ -+ chunkStatus.generate( -+ new net.minecraft.world.level.chunk.status.WorldGenContext( -+ serverLevel, -+ chunkGenerator, -+ serverLevel.getStructureManager(), -+ serverLevel.chunkSource.getLightEngine() -+ ), -+ mailbox::tell, -+ chunk -> { -+ throw new UnsupportedOperationException("Not creating full chunks here"); -+ }, -+ chunks -+ ).thenAccept(chunk -> { -+ if (chunk != null && chunkStatus == net.minecraft.world.level.chunk.status.ChunkStatus.NOISE) { -+ net.minecraft.world.level.levelgen.Heightmap.primeHeightmaps(chunk, net.minecraft.world.level.chunk.status.ChunkStatus.POST_FEATURES); -+ } -+ }).join(); -+ } -+ -+ // get empty object -+ OldCraftChunkData data = (OldCraftChunkData) this.createChunkData(world); -+ // copy over generated sections -+ data.setRawChunkData(protoChunk.getSections()); -+ // hooray! -+ return data; -+ } -+ // Paper end - Allow delegation to vanilla chunk gen -+ - @Override - public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) { - return new CraftBossBar(title, color, style, flags); -diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java -+++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java -@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData; - public final class OldCraftChunkData implements ChunkGenerator.ChunkData { - private final int minHeight; - private final int maxHeight; -- private final LevelChunkSection[] sections; -+ private LevelChunkSection[] sections; // Paper - Allow delegation to vanilla chunk gen - private final Registry<net.minecraft.world.level.biome.Biome> biomes; - private Set<BlockPos> tiles; - private final Set<BlockPos> lights = new HashSet<>(); -@@ -0,0 +0,0 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData { - return this.tiles; - } - -- Set<BlockPos> getLights() { -+ public Set<BlockPos> getLights() { // Paper - Allow delegation to vanilla chunk gen - return this.lights; - } -+ -+ // Paper start - Allow delegation to vanilla chunk gen -+ public void setRawChunkData(LevelChunkSection[] sections) { -+ this.sections = sections; -+ } -+ // Paper end - Allow delegation to vanilla chunk gen - } diff --git a/patches/server/Book-Size-Limits.patch b/patches/server/Book-Size-Limits.patch index e0c2ab7825..a3b15f6af1 100644 --- a/patches/server/Book-Size-Limits.patch +++ b/patches/server/Book-Size-Limits.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; + if (byteLength > 256 * 4) { + ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); -+ server.scheduleOnMain(() -> this.disconnect("Book too large!")); ++ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"))); + return; + } + byteTotal += byteLength; @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + if (byteTotal > byteAllowed) { + ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); -+ server.scheduleOnMain(() -> this.disconnect("Book too large!")); ++ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"))); + return; + } + } diff --git a/patches/server/Do-not-accept-invalid-client-settings.patch b/patches/server/Do-not-accept-invalid-client-settings.patch index e7f4c580cd..6106792071 100644 --- a/patches/server/Do-not-accept-invalid-client-settings.patch +++ b/patches/server/Do-not-accept-invalid-client-settings.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - do not accept invalid information + if (packet.information().viewDistance() < 0) { + LOGGER.warn("Disconnecting " + this.player.getScoreboardName() + " for invalid view distance: " + packet.information().viewDistance()); -+ this.disconnect("Invalid client settings", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); ++ this.disconnect(Component.literal("Invalid client settings"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); + return; + } + // Paper end - do not accept invalid information diff --git a/patches/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch b/patches/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch index b5fddc7753..81491558a1 100644 --- a/patches/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch +++ b/patches/server/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean canUse() { -+ if (!this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items ++ if (!this.mob.level().getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items Raid raid = this.mob.getCurrentRaid(); if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance(this.mob.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) { diff --git a/patches/server/Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/Fix-kick-event-leave-message-not-being-sent.patch index 5676701e74..37895d91ab 100644 --- a/patches/server/Fix-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/Fix-kick-event-leave-message-not-being-sent.patch @@ -38,14 +38,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent // Send the possibly modified leave message - this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionInfo.report(), disconnectionInfo.bugReportLink())); // Paper - Adventure +- this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionInfo.report(), disconnectionInfo.bugReportLink())); // Paper - Adventure ++ this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionInfo.report(), disconnectionInfo.bugReportLink()), event.leaveMessage()); // Paper - Adventure & use kick event leave message } -@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + +- private void disconnect0(DisconnectionDetails disconnectiondetails) { ++ private void disconnect0(DisconnectionDetails disconnectiondetails, @Nullable net.kyori.adventure.text.Component leaveMessage) { // Paper - use kick event leave message + // CraftBukkit end + this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason this.connection.send(new ClientboundDisconnectPacket(disconnectiondetails.reason()), PacketSendListener.thenRun(() -> { this.connection.disconnect(disconnectiondetails); })); - this.onDisconnect(disconnectiondetails); // CraftBukkit - fire quit instantly -+ this.onDisconnect(disconnectiondetails, event.leaveMessage()); // CraftBukkit - fire quit instantly // Paper - use kick event leave message ++ this.onDisconnect(disconnectiondetails, leaveMessage); // CraftBukkit - fire quit instantly // Paper - use kick event leave message this.connection.setReadOnly(); MinecraftServer minecraftserver = this.server; Connection networkmanager = this.connection; diff --git a/patches/server/LivingEntity-Active-Item-API.patch b/patches/server/LivingEntity-Active-Item-API.patch index 8b59ac0d5c..d6c2eadef6 100644 --- a/patches/server/LivingEntity-Active-Item-API.patch +++ b/patches/server/LivingEntity-Active-Item-API.patch @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void setActiveItemRemainingTime(final int ticks) { + Preconditions.checkArgument(ticks >= 0, "ticks must be >= 0"); -+ Preconditions.checkArgument(ticks <= this.getHandle().getUseItem().getUseDuration(), "ticks must be <= item use duration"); ++ Preconditions.checkArgument(ticks <= this.getHandle().getUseItem().getUseDuration(this.getHandle()), "ticks must be <= item use duration"); + this.getHandle().useItemRemaining = ticks; + } + diff --git a/patches/server/More-Teleport-API.patch b/patches/server/More-Teleport-API.patch index 20e8d25283..d193ee95b7 100644 --- a/patches/server/More-Teleport-API.patch +++ b/patches/server/More-Teleport-API.patch @@ -145,7 +145,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public void lookAt(double x, double y, double z, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor) { -+ this.getHandle().lookAt(toNmsAnchor(playerAnchor), new Vec3(x, y, z)); ++ this.getHandle().lookAt(toNmsAnchor(playerAnchor), new net.minecraft.world.phys.Vec3(x, y, z)); + } + + public static net.minecraft.commands.arguments.EntityAnchorArgument.Anchor toNmsAnchor(io.papermc.paper.entity.LookAnchor nmsAnchor) { diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index a62f6a0e78..9f6f231ea8 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -164,7 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + private static final Logger LOGGER = LogUtils.getClassLogger(); + public static final String WORLD_DEFAULTS = "__world_defaults__"; -+ public static final ResourceLocation WORLD_DEFAULTS_KEY = new ResourceLocation("configurations", WORLD_DEFAULTS); ++ public static final ResourceLocation WORLD_DEFAULTS_KEY = ResourceLocation.fromNamespaceAndPath("configurations", WORLD_DEFAULTS); + protected final Path globalFolder; + protected final Class<G> globalConfigClass; + protected final Class<W> worldConfigClass; diff --git a/patches/server/Treat-sequence-violations-like-they-should-be.patch b/patches/server/Treat-sequence-violations-like-they-should-be.patch index 499bd3b547..cbf7931db2 100644 --- a/patches/server/Treat-sequence-violations-like-they-should-be.patch +++ b/patches/server/Treat-sequence-violations-like-they-should-be.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void ackBlockChangesUpTo(int sequence) { if (sequence < 0) { -+ this.disconnect("Expected packet sequence nr >= 0", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - Treat sequence violations like they should be ++ this.disconnect(Component.literal("Expected packet sequence nr >= 0"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - Treat sequence violations like they should be throw new IllegalArgumentException("Expected packet sequence nr >= 0"); } else { this.ackBlockChangesUpTo = Math.max(sequence, this.ackBlockChangesUpTo); diff --git a/patches/server/Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/Validate-PickItem-Packet-and-kick-for-invalid.patch index 8cdf990217..7a4188c21b 100644 --- a/patches/server/Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - validate pick item position + if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { + ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); -+ this.disconnect("Invalid hotbar selection (Hacking?)"); ++ this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)")); + return; + } + this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed diff --git a/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch b/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch index ce2c2e336e..4993f6bacd 100644 --- a/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch +++ b/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch @@ -47,13 +47,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z); if (chunk == null) { @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - @Override - public boolean regenerateChunk(int x, int z) { - org.spigotmc.AsyncCatcher.catchOp("chunk regenerate"); // Spigot + if (!unloadChunk0(x, z, false)) { + return false; + } + warnUnsafeChunk("regenerating a faraway chunk", x, z); // Paper - // Paper start - implement regenerateChunk method - final ServerLevel serverLevel = this.world; - final net.minecraft.server.level.ServerChunkCache serverChunkCache = serverLevel.getChunkSource(); + + final long chunkKey = ChunkCoordIntPair.pair(x, z); + world.getChunkProvider().unloadQueue.remove(chunkKey); @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { diff --git a/patches/server/misc-debugging-dumps.patch b/patches/server/misc-debugging-dumps.patch index 6b169ced5e..712c0ce54c 100644 --- a/patches/server/misc-debugging-dumps.patch +++ b/patches/server/misc-debugging-dumps.patch @@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void onDisconnect(DisconnectionDetails info) { + // Paper start - Debugging + if (net.minecraft.server.MinecraftServer.getServer().isDebugging()) { -+ ServerConfigurationPacketListenerImpl.LOGGER.info("{} lost connection: {}, while in configuration phase {}", this.gameProfile, reason.getString(), currentTask != null ? currentTask.type().id() : "null"); ++ ServerConfigurationPacketListenerImpl.LOGGER.info("{} lost connection: {}, while in configuration phase {}", this.gameProfile, info.reason().getString(), currentTask != null ? currentTask.type().id() : "null"); + } else // Paper end ServerConfigurationPacketListenerImpl.LOGGER.info("{} lost connection: {}", this.gameProfile, info.reason().getString()); super.onDisconnect(info); diff --git a/patches/server/Implement-regenerateChunk.patch b/patches/unapplied/server/Implement-regenerateChunk.patch similarity index 100% rename from patches/server/Implement-regenerateChunk.patch rename to patches/unapplied/server/Implement-regenerateChunk.patch