diff --git a/patches/api/Add-methods-to-get-translation-keys.patch b/patches/api/Add-methods-to-get-translation-keys.patch index 2035f9feb4..670a5647db 100644 --- a/patches/api/Add-methods-to-get-translation-keys.patch +++ b/patches/api/Add-methods-to-get-translation-keys.patch @@ -351,6 +351,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Provides protection against environmental damage */ +@@ -0,0 +0,0 @@ public abstract class Enchantment implements Keyed, Translatable { + public abstract net.kyori.adventure.text.@NotNull Component displayName(int level); + // Paper end + ++ // Paper start - mark translation key as deprecated ++ /** ++ * @deprecated this method assumes that the enchantments description ++ * always be a translatable component which is not guaranteed. ++ */ ++ @Override ++ @Deprecated(forRemoval = true) ++ public abstract @NotNull String translationKey(); ++ // Paper end - mark translation key as deprecated ++ + /** + * Gets the Enchantment at the specified key + * diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java diff --git a/patches/api/More-Enchantment-API.patch b/patches/api/More-Enchantment-API.patch index 0d0a49bca8..0461dfeb0c 100644 --- a/patches/api/More-Enchantment-API.patch +++ b/patches/api/More-Enchantment-API.patch @@ -127,11 +127,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param level the level of enchantment + * @param entityCategory the category of entity + * @return the damage increase -+ * @deprecated Use {@link #getDamageIncrease(int, org.bukkit.entity.EntityType)} instead. -+ * Enchantment damage increase is no longer handled via {@link org.bukkit.entity.EntityCategory}s, but -+ * is instead controlled by tags, e.g. {@link org.bukkit.Tag#ENTITY_TYPES_SENSITIVE_TO_BANE_OF_ARTHROPODS}. -+ * As such, a category cannot properly represent all entities defined by the tags. ++ * @deprecated Enchantments now have a complex effect systems that cannot be reduced to a simple damage increase. + */ ++ @Contract("-> fail") + @Deprecated(forRemoval = true, since = "1.20.5") + public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory); + @@ -141,19 +139,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param level the level of enchantment + * @param entityType the type of entity. + * @return the damage increase ++ * @deprecated Enchantments now have a complex effect systems that cannot be reduced to a simple damage increase. + */ ++ @Contract("-> fail") ++ @Deprecated(forRemoval = true, since = "1.21") + public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityType entityType); + + /** + * Gets the equipment slots where this enchantment is considered "active". + * + * @return the equipment slots ++ * @deprecated Use {@link #getActiveSlotGroups()} instead as enchantments are now applicable to a group of equipment slots. ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true, since = "1.21") ++ public java.util.Set getActiveSlots() { ++ final java.util.Set slots = this.getActiveSlotGroups(); ++ return java.util.Arrays.stream(org.bukkit.inventory.EquipmentSlot.values()).filter(e -> { ++ for (final org.bukkit.inventory.EquipmentSlotGroup group : slots) { ++ if (group.test(e)) return true; ++ } ++ return false; ++ }).collect(java.util.stream.Collectors.toSet()); ++ } ++ ++ /** ++ * Gets the equipment slots where this enchantment is considered "active". ++ * ++ * @return the equipment slots + */ + @NotNull -+ public abstract java.util.Set getActiveSlots(); ++ public abstract java.util.Set getActiveSlotGroups(); // Paper end - /** + // Paper start - mark translation key as deprecated diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java diff --git a/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 100% rename from patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch diff --git a/patches/unapplied/server/Add-Channel-initialization-listeners.patch b/patches/server/Add-Channel-initialization-listeners.patch similarity index 100% rename from patches/unapplied/server/Add-Channel-initialization-listeners.patch rename to patches/server/Add-Channel-initialization-listeners.patch diff --git a/patches/unapplied/server/Add-EntityBlockStorage-clearEntities.patch b/patches/server/Add-EntityBlockStorage-clearEntities.patch similarity index 100% rename from patches/unapplied/server/Add-EntityBlockStorage-clearEntities.patch rename to patches/server/Add-EntityBlockStorage-clearEntities.patch diff --git a/patches/unapplied/server/Add-HiddenPotionEffect-API.patch b/patches/server/Add-HiddenPotionEffect-API.patch similarity index 100% rename from patches/unapplied/server/Add-HiddenPotionEffect-API.patch rename to patches/server/Add-HiddenPotionEffect-API.patch diff --git a/patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 99% rename from patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index 81c172a010..cc50187c9c 100644 --- a/patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void aiStep() { - if (this.isAlive() && this.isSunBurnTick()) { + if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API - this.igniteForSeconds(8); + this.igniteForSeconds(8.0F); } @@ -0,0 +0,0 @@ public class Phantom extends FlyingMob implements Enemy { diff --git a/patches/unapplied/server/Add-basic-Datapack-API.patch b/patches/server/Add-basic-Datapack-API.patch similarity index 100% rename from patches/unapplied/server/Add-basic-Datapack-API.patch rename to patches/server/Add-basic-Datapack-API.patch diff --git a/patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch b/patches/server/Add-environment-variable-to-disable-server-gui.patch similarity index 100% rename from patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch rename to patches/server/Add-environment-variable-to-disable-server-gui.patch diff --git a/patches/unapplied/server/Add-more-WanderingTrader-API.patch b/patches/server/Add-more-WanderingTrader-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-WanderingTrader-API.patch rename to patches/server/Add-more-WanderingTrader-API.patch diff --git a/patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch b/patches/server/Expand-PlayerGameModeChangeEvent.patch similarity index 95% rename from patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch rename to patches/server/Expand-PlayerGameModeChangeEvent.patch index d7c6239e6c..81a10562ba 100644 --- a/patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch +++ b/patches/server/Expand-PlayerGameModeChangeEvent.patch @@ -48,18 +48,20 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } public boolean setGameMode(GameType gameMode) { -- if (!this.gameMode.changeGameModeForPlayer(gameMode)) { -- return false; + // Paper start - Expand PlayerGameModeChangeEvent + org.bukkit.event.player.PlayerGameModeChangeEvent event = this.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); + return event == null ? false : event.isCancelled(); + } + @Nullable + public org.bukkit.event.player.PlayerGameModeChangeEvent setGameMode(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component message) { + boolean flag = this.isSpectator(); + +- if (!this.gameMode.changeGameModeForPlayer(gameMode)) { +- return false; + org.bukkit.event.player.PlayerGameModeChangeEvent event = this.gameMode.changeGameModeForPlayer(gameMode, cause, message); + if (event == null || event.isCancelled()) { + return null; @@ -67,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId())); if (gameMode == GameType.SPECTATOR) { -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.onUpdateAbilities(); this.updateEffectVisibility(); @@ -76,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } public void loadGameTypes(@Nullable CompoundTag nbt) { @@ -137,7 +139,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); + this.player = this.server.getPlayerList().respawn(this.player, false, Entity.RemovalReason.KILLED, RespawnReason.DEATH); // CraftBukkit if (this.server.isHardcore()) { - this.player.setGameMode(GameType.SPECTATOR); + this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - Expand PlayerGameModeChangeEvent diff --git a/patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch b/patches/server/Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch rename to patches/server/Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/unapplied/server/Inventory-close.patch b/patches/server/Inventory-close.patch similarity index 100% rename from patches/unapplied/server/Inventory-close.patch rename to patches/server/Inventory-close.patch diff --git a/patches/unapplied/server/ItemStack-repair-check-API.patch b/patches/server/ItemStack-repair-check-API.patch similarity index 100% rename from patches/unapplied/server/ItemStack-repair-check-API.patch rename to patches/server/ItemStack-repair-check-API.patch diff --git a/patches/unapplied/server/More-Enchantment-API.patch b/patches/server/More-Enchantment-API.patch similarity index 50% rename from patches/unapplied/server/More-Enchantment-API.patch rename to patches/server/More-Enchantment-API.patch index 25dfa27d08..1d1157e93d 100644 --- a/patches/unapplied/server/More-Enchantment-API.patch +++ b/patches/server/More-Enchantment-API.patch @@ -13,12 +13,20 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment. index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +@@ -0,0 +0,0 @@ import java.util.Locale; + import net.minecraft.Util; + import net.minecraft.core.Holder; + import net.minecraft.core.registries.Registries; ++import net.minecraft.network.chat.contents.TranslatableContents; + import net.minecraft.tags.EnchantmentTags; + import org.bukkit.NamespacedKey; + import org.bukkit.Registry; @@ -0,0 +0,0 @@ public class CraftEnchantment extends Enchantment implements Handleable guessEntityTypeFromEnchantmentCategory( -+ final org.bukkit.entity.EntityCategory entityCategory -+ ) { -+ final net.minecraft.tags.TagKey> tag = switch (entityCategory) { -+ case ARTHROPOD -> net.minecraft.tags.EntityTypeTags.SENSITIVE_TO_BANE_OF_ARTHROPODS; -+ case UNDEAD -> net.minecraft.tags.EntityTypeTags.SENSITIVE_TO_SMITE; -+ case WATER -> net.minecraft.tags.EntityTypeTags.SENSITIVE_TO_IMPALING; -+ default -> null; -+ }; -+ if (tag == null) return null; -+ -+ return net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tag) -+ .map(e -> e.size() > 0 ? e.get(0).value() : null) -+ .orElse(null); ++ throw new UnsupportedOperationException("Enchantments are based on complex effect maps since 1.21, cannot compute a simple damage increase"); + } + + @Override -+ public java.util.Set getActiveSlots() { -+ return java.util.stream.Stream.of(this.handle.definition.slots()).map(org.bukkit.craftbukkit.CraftEquipmentSlot::getSlot).collect(java.util.stream.Collectors.toSet()); -+ } ++ public java.util.Set getActiveSlotGroups() { ++ return this.getHandle().definition().slots().stream() ++ .map(org.bukkit.craftbukkit.CraftEquipmentSlot::getSlot) ++ .collect(java.util.stream.Collectors.toSet()); + } // Paper end - @Override diff --git a/patches/unapplied/server/Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/Send-empty-commands-if-tab-completion-is-disabled.patch similarity index 100% rename from patches/unapplied/server/Send-empty-commands-if-tab-completion-is-disabled.patch rename to patches/server/Send-empty-commands-if-tab-completion-is-disabled.patch