diff --git a/patches/api/Add-RegistryAccess-for-managing-registries.patch b/patches/api/Add-RegistryAccess-for-managing-registries.patch index 3785686035..8c272740da 100644 --- a/patches/api/Add-RegistryAccess-for-managing-registries.patch +++ b/patches/api/Add-RegistryAccess-for-managing-registries.patch @@ -219,6 +219,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * Custom boss bars. * @@ -0,0 +0,0 @@ public interface Registry extends Iterable { + * + * @see Cat.Type + */ +- Registry CAT_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Cat.Type.class), "No registry present for Cat Type. This is a bug."); ++ Registry CAT_VARIANT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.CAT_VARIANT); // Paper + /** * Server enchantments. * * @see Enchantment @@ -317,7 +323,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Villager profession. * + * @see Villager.Profession + */ +- Registry VILLAGER_PROFESSION = Objects.requireNonNull(Bukkit.getRegistry(Villager.Profession.class), "No registry present for Villager Profession. This is a bug."); ++ Registry VILLAGER_PROFESSION = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.VILLAGER_PROFESSION); // Paper + /** + * Villager type. + * + * @see Villager.Type + */ +- Registry VILLAGER_TYPE = Objects.requireNonNull(Bukkit.getRegistry(Villager.Type.class), "No registry present for Villager Type. This is a bug."); ++ Registry VILLAGER_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.VILLAGER_TYPE); // Paper + /** + * Memory Keys. + * @@ -0,0 +0,0 @@ public interface Registry extends Iterable { + * + * @see Frog.Variant + */ +- Registry FROG_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Frog.Variant.class), "No registry present for Frog Variant. This is a bug."); ++ Registry FROG_VARIANT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.FROG_VARIANT); // Paper + /** * Wolf variants. * * @see Wolf.Variant @@ -329,7 +355,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Map cursor types. * -@@ -0,0 +0,0 @@ public interface Registry extends Iterable { + * @see MapCursor.Type + */ +- Registry MAP_DECORATION_TYPE = Objects.requireNonNull(Bukkit.getRegistry(MapCursor.Type.class), "No registry present for MapCursor Type. This is a bug."); ++ Registry MAP_DECORATION_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.MAP_DECORATION_TYPE); // Paper + /** + * Game events. * * @see GameEvent */ diff --git a/patches/api/Add-methods-to-get-translation-keys.patch b/patches/api/Add-methods-to-get-translation-keys.patch index 670a5647db..d0b555ac00 100644 --- a/patches/api/Add-methods-to-get-translation-keys.patch +++ b/patches/api/Add-methods-to-get-translation-keys.patch @@ -427,20 +427,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * Represents the various different Villager professions there may be. * Villagers have different trading options depending on their profession, */ -- public enum Profession implements Keyed { -+ public enum Profession implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - NONE, +- interface Profession extends OldEnum, Keyed { ++ interface Profession extends OldEnum, Keyed, net.kyori.adventure.translation.Translatable { + + Profession NONE = getProfession("none"); /** - * Armorer profession. Wears a black apron. Armorers primarily trade for @@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager { - public NamespacedKey getKey() { - return key; + static Profession[] values() { + return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]); } + + // Paper start + @Override -+ public @NotNull String translationKey() { -+ return "entity.minecraft.villager." + this.key.getKey(); ++ default @NotNull String translationKey() { ++ return "entity.minecraft.villager." + this.getKey().getKey(); + } + // Paper end } diff --git a/patches/api/Add-villager-reputation-API.patch b/patches/api/Add-villager-reputation-API.patch index e1391e6d61..843e1bdebf 100644 --- a/patches/api/Add-villager-reputation-API.patch +++ b/patches/api/Add-villager-reputation-API.patch @@ -113,9 +113,9 @@ diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Villager.java +++ b/src/main/java/org/bukkit/entity/Villager.java -@@ -0,0 +0,0 @@ - package org.bukkit.entity; - +@@ -0,0 +0,0 @@ package org.bukkit.entity; + import com.google.common.base.Preconditions; + import com.google.common.collect.Lists; import java.util.Locale; +import java.util.Map; // Paper +import java.util.UUID; // Paper @@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.Location; import org.bukkit.NamespacedKey; @@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager { - return key; + return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]); } } + diff --git a/patches/api/Experimental-annotations-change.patch b/patches/api/Experimental-annotations-change.patch index e3483773e0..e71725f9cc 100644 --- a/patches/api/Experimental-annotations-change.patch +++ b/patches/api/Experimental-annotations-change.patch @@ -200,29 +200,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/map/MapCursor.java +++ b/src/main/java/org/bukkit/map/MapCursor.java @@ -0,0 +0,0 @@ public final class MapCursor { - BANNER_RED(24, "banner_red"), - BANNER_BLACK(25, "banner_black"), - RED_X(26, "red_x"), + Type BANNER_RED = getType("banner_red"); + Type BANNER_BLACK = getType("banner_black"); + Type RED_X = getType("red_x"); + @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - VILLAGE_DESERT(27, "village_desert"), + Type VILLAGE_DESERT = getType("village_desert"); + @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - VILLAGE_PLAINS(28, "village_plains"), + Type VILLAGE_PLAINS = getType("village_plains"); + @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - VILLAGE_SAVANNA(29, "village_savanna"), + Type VILLAGE_SAVANNA = getType("village_savanna"); + @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - VILLAGE_SNOWY(30, "village_snowy"), + Type VILLAGE_SNOWY = getType("village_snowy"); + @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - VILLAGE_TAIGA(31, "village_taiga"), + Type VILLAGE_TAIGA = getType("village_taiga"); + @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - JUNGLE_TEMPLE(32, "jungle_temple"), + Type JUNGLE_TEMPLE = getType("jungle_temple"); + @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation + @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - SWAMP_HUT(33, "swamp_hut"), - TRIAL_CHAMBERS(34, "trial_chambers") - ; + Type SWAMP_HUT = getType("swamp_hut"); + Type TRIAL_CHAMBERS = getType("trial_chambers"); + diff --git a/patches/api/Fix-Spigot-annotation-mistakes.patch b/patches/api/Fix-Spigot-annotation-mistakes.patch index 8b5ab41325..184fb78506 100644 --- a/patches/api/Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/Fix-Spigot-annotation-mistakes.patch @@ -1836,7 +1836,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - @Deprecated + @org.jetbrains.annotations.ApiStatus.Internal // Paper public byte getRawType() { - return type.value; + return type.getValue(); } @@ -0,0 +0,0 @@ public final class MapCursor { * Set the type of this cursor. @@ -1859,9 +1859,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ - @Deprecated + @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getValue() { - return value; - } + byte getValue(); + + /** @@ -0,0 +0,0 @@ public final class MapCursor { * * @param value the value @@ -1872,7 +1872,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - @Deprecated + @org.jetbrains.annotations.ApiStatus.Internal // Paper @Nullable - public static Type byValue(byte value) { + static Type byValue(byte value) { for (Type t : values()) { diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/api/Fix-upstream-javadocs.patch b/patches/api/Fix-upstream-javadocs.patch index d3659a64cf..0f971df41b 100644 --- a/patches/api/Fix-upstream-javadocs.patch +++ b/patches/api/Fix-upstream-javadocs.patch @@ -612,13 +612,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/entity/Villager.java @@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager { */ - NITWIT, + Profession NITWIT = getProfession("nitwit"); /** - * Sheperd profession. Wears a brown robe. Shepherds primarily trade for + * Shepherd profession. Wears a brown robe. Shepherds primarily trade for * wool items, and shears. */ - SHEPHERD, + Profession SHEPHERD = getProfession("shepherd"); diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java @@ -660,14 +660,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ public class BlockExplodeEvent extends BlockEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); -@@ -0,0 +0,0 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable { - this.cancel = false; - } - -+ @io.papermc.paper.annotation.DoNotUse // Paper - @Deprecated(forRemoval = true) - public BlockExplodeEvent(@NotNull final Block what, @NotNull final List blocks, final float yield) { - this(what, what.getState(), blocks, yield); diff --git a/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java b/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java diff --git a/patches/api/Fixes-and-additions-to-the-spawn-reason-API.patch b/patches/api/Fixes-and-additions-to-the-spawn-reason-API.patch index dc91a4ad1a..8889fc6674 100644 --- a/patches/api/Fixes-and-additions-to-the-spawn-reason-API.patch +++ b/patches/api/Fixes-and-additions-to-the-spawn-reason-API.patch @@ -44,5 +44,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + OMINOUS_ITEM_SPAWNER, + // Paper end - Fixes and additions to the SpawnReason API /** - * When a creature is spawned by plugins - */ + * When a creature is spawned by a potion effect, for example: + * {@link org.bukkit.potion.PotionType#OOZING}, {@link org.bukkit.potion.PotionType#INFESTED} diff --git a/patches/api/Improve-PortalEvents.patch b/patches/api/Improve-PortalEvents.patch index 8cc13ef52e..11104d1b9a 100644 --- a/patches/api/Improve-PortalEvents.patch +++ b/patches/api/Improve-PortalEvents.patch @@ -87,10 +87,18 @@ diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java b/src/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; - public class EntityPortalEvent extends EntityTeleportEvent { - private static final HandlerList handlers = new HandlerList(); +@@ -0,0 +0,0 @@ package org.bukkit.event.entity; + import org.bukkit.Location; + import org.bukkit.entity.Entity; + import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + +@@ -0,0 +0,0 @@ public class EntityPortalEvent extends EntityTeleportEvent { private int searchRadius = 128; + private boolean canCreatePortal = true; + private int creationRadius = 16; + private final org.bukkit.PortalType type; // Paper public EntityPortalEvent(@NotNull final Entity entity, @NotNull final Location from, @Nullable final Location to) { @@ -102,15 +110,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super(entity, from, to); this.searchRadius = searchRadius; + this.type = org.bukkit.PortalType.CUSTOM; // Paper + } + + public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, boolean canCreatePortal, int creationRadius) { ++ // Paper start ++ this(entity, from, to, searchRadius, canCreatePortal, creationRadius, org.bukkit.PortalType.CUSTOM); + } + -+ // Paper start -+ public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, final @NotNull org.bukkit.PortalType portalType) { -+ super(entity, from, to); -+ this.searchRadius = searchRadius; ++ @ApiStatus.Internal ++ public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, boolean canCreatePortal, int creationRadius, final @NotNull org.bukkit.PortalType portalType) { + super(entity, from, to); + this.type = portalType; -+ } -+ ++ // Paper end + this.searchRadius = searchRadius; + this.canCreatePortal = canCreatePortal; + this.creationRadius = creationRadius; + } + ++ // Paper start + /** + * Get the portal type relating to this event. + * @@ -142,11 +159,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void setTo(@Nullable final Location to) { + super.setTo(to); - } ++ } + // Paper end - ++ /** * Set the Block radius to search in for available portals. + * diff --git a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java diff --git a/patches/api/Missing-Entity-API.patch b/patches/api/Missing-Entity-API.patch index 28fdc039bb..7fcc172e0c 100644 --- a/patches/api/Missing-Entity-API.patch +++ b/patches/api/Missing-Entity-API.patch @@ -262,7 +262,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Cat.java +++ b/src/main/java/org/bukkit/entity/Cat.java @@ -0,0 +0,0 @@ public interface Cat extends Tameable, Sittable { - return key; + return Lists.newArrayList(Registry.CAT_VARIANT).toArray(new Type[0]); } } + diff --git a/patches/server/Add-RegistryAccess-for-managing-Registries.patch b/patches/server/Add-RegistryAccess-for-managing-Registries.patch index 28b311b42d..6790964124 100644 --- a/patches/server/Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/Add-RegistryAccess-for-managing-Registries.patch @@ -41,6 +41,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.craftbukkit.block.CraftBlockType; +import org.bukkit.craftbukkit.damage.CraftDamageType; +import org.bukkit.craftbukkit.enchantments.CraftEnchantment; ++import org.bukkit.craftbukkit.entity.CraftCat; ++import org.bukkit.craftbukkit.entity.CraftFrog; ++import org.bukkit.craftbukkit.entity.CraftVillager; +import org.bukkit.craftbukkit.entity.CraftWolf; +import org.bukkit.craftbukkit.generator.structure.CraftStructure; +import org.bukkit.craftbukkit.generator.structure.CraftStructureType; @@ -48,15 +51,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.craftbukkit.inventory.trim.CraftTrimMaterial; +import org.bukkit.craftbukkit.inventory.trim.CraftTrimPattern; +import org.bukkit.craftbukkit.legacy.FieldRename; ++import org.bukkit.craftbukkit.map.CraftMapCursor; +import org.bukkit.craftbukkit.potion.CraftPotionEffectType; +import org.bukkit.craftbukkit.util.CraftNamespacedKey; +import org.bukkit.damage.DamageType; ++import org.bukkit.entity.Cat; ++import org.bukkit.entity.Frog; ++import org.bukkit.entity.Villager; +import org.bukkit.entity.Wolf; +import org.bukkit.entity.memory.MemoryKey; +import org.bukkit.generator.structure.StructureType; +import org.bukkit.inventory.ItemType; +import org.bukkit.inventory.meta.trim.TrimMaterial; +import org.bukkit.inventory.meta.trim.TrimPattern; ++import org.bukkit.map.MapCursor; +import org.bukkit.potion.PotionEffectType; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; @@ -80,6 +88,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new), + entry(Registries.BLOCK, RegistryKey.BLOCK, BlockType.class, CraftBlockType::new), + entry(Registries.ITEM, RegistryKey.ITEM, ItemType.class, CraftItemType::new), ++ entry(Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, Cat.Type.class, CraftCat.CraftType::new), ++ entry(Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, Frog.Variant.class, CraftFrog.CraftVariant::new), ++ entry(Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION, Villager.Profession.class, CraftVillager.CraftProfession::new), ++ entry(Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, Villager.Type.class, CraftVillager.CraftType::new), ++ entry(Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, MapCursor.Type.class, CraftMapCursor.CraftType::new), + + // data-drivens + entry(Registries.STRUCTURE, RegistryKey.STRUCTURE, Structure.class, CraftStructure::new).delayed(), @@ -95,17 +108,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + apiOnly(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, () -> org.bukkit.Registry.ART), + apiOnly(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, () -> org.bukkit.Registry.ATTRIBUTE), + apiOnly(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, () -> org.bukkit.Registry.BANNER_PATTERN), -+ apiOnly(Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, () -> org.bukkit.Registry.CAT_VARIANT), + apiOnly(Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE, () -> org.bukkit.Registry.ENTITY_TYPE), + apiOnly(Registries.PARTICLE_TYPE, RegistryKey.PARTICLE_TYPE, () -> org.bukkit.Registry.PARTICLE_TYPE), + apiOnly(Registries.POTION, RegistryKey.POTION, () -> org.bukkit.Registry.POTION), + apiOnly(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, () -> org.bukkit.Registry.SOUNDS), -+ apiOnly(Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION, () -> org.bukkit.Registry.VILLAGER_PROFESSION), -+ apiOnly(Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, () -> org.bukkit.Registry.VILLAGER_TYPE), + apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> (org.bukkit.Registry>) (org.bukkit.Registry) org.bukkit.Registry.MEMORY_MODULE_TYPE), -+ apiOnly(Registries.FLUID, RegistryKey.FLUID, () -> org.bukkit.Registry.FLUID), -+ apiOnly(Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, () -> org.bukkit.Registry.FROG_VARIANT), -+ apiOnly(Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, () -> org.bukkit.Registry.MAP_DECORATION_TYPE) ++ apiOnly(Registries.FLUID, RegistryKey.FLUID, () -> org.bukkit.Registry.FLUID) + ); + final Map, RegistryEntry> byRegistryKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size()); + final Map, RegistryEntry> byResourceKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size()); @@ -750,7 +758,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - return new CraftRegistry<>(Structure.class, registryHolder.registryOrThrow(Registries.STRUCTURE), CraftStructure::new, FieldRename.NONE); - } - if (bukkitClass == StructureType.class) { -- return new CraftRegistry<>(StructureType.class, BuiltInRegistries.STRUCTURE_TYPE, CraftStructureType::new, FieldRename.NONE); +- return new CraftRegistry<>(StructureType.class, registryHolder.registryOrThrow(Registries.STRUCTURE_TYPE), CraftStructureType::new, FieldRename.NONE); +- } +- if (bukkitClass == Villager.Type.class) { +- return new CraftRegistry<>(Villager.Type.class, registryHolder.registryOrThrow(Registries.VILLAGER_TYPE), CraftVillager.CraftType::new, FieldRename.NONE); +- } +- if (bukkitClass == Villager.Profession.class) { +- return new CraftRegistry<>(Villager.Profession.class, registryHolder.registryOrThrow(Registries.VILLAGER_PROFESSION), CraftVillager.CraftProfession::new, FieldRename.NONE); - } - if (bukkitClass == TrimMaterial.class) { - return new CraftRegistry<>(TrimMaterial.class, registryHolder.registryOrThrow(Registries.TRIM_MATERIAL), CraftTrimMaterial::new, FieldRename.NONE); @@ -773,6 +787,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (bukkitClass == ItemType.class) { - return new CraftRegistry<>(ItemType.class, registryHolder.registryOrThrow(Registries.ITEM), CraftItemType::new, FieldRename.NONE); - } +- if (bukkitClass == Frog.Variant.class) { +- return new CraftRegistry<>(Frog.Variant.class, registryHolder.registryOrThrow(Registries.FROG_VARIANT), CraftFrog.CraftVariant::new, FieldRename.NONE); +- } +- if (bukkitClass == Cat.Type.class) { +- return new CraftRegistry<>(Cat.Type.class, registryHolder.registryOrThrow(Registries.CAT_VARIANT), CraftCat.CraftType::new, FieldRename.NONE); +- } +- if (bukkitClass == MapCursor.Type.class) { +- return new CraftRegistry<>(MapCursor.Type.class, registryHolder.registryOrThrow(Registries.MAP_DECORATION_TYPE), CraftMapCursor.CraftType::new, FieldRename.NONE); +- } - - return null; - } @@ -829,6 +852,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private YamlConfiguration commandsConfiguration; private final Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); @@ -0,0 +0,0 @@ public final class CraftServer implements Server { + } + + private void loadCompatibilities() { ++ if (true) return; // Paper - Big nope + ConfigurationSection compatibilities = this.configuration.getConfigurationSection("settings.compatibility"); + if (compatibilities == null) { + this.activeCompatibilities = Collections.emptySet(); +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @Override public Registry getRegistry(Class aClass) { @@ -842,7 +873,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java +++ b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java @@ -0,0 +0,0 @@ public class FieldRename { - return Enum.valueOf(enumClass, FieldRename.rename(apiVersion, enumClass.getName().replace('.', '/'), name)); + }; } - @RequireCompatibility("allow-old-keys-in-registry") @@ -852,15 +883,56 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } + // Paper start - absolutely not, having this as an expectation for plugin developers opens a huge + // can of worms in the future, especially if mojang comes back and reuses some old key -+ // @RequireCompatibility("allow-old-keys-in-registry") -+ // public static T get(Registry registry, NamespacedKey namespacedKey) { -+ // // We don't have version-specific changes, so just use current, and don't inject a version -+ // return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT); -+ // } ++ //@RequireCompatibility("allow-old-keys-in-registry") ++ //public static T get(Registry registry, NamespacedKey namespacedKey) { ++ // // We don't have version-specific changes, so just use current, and don't inject a version ++ // return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT); ++ //} + // Paper end // PatternType private static final FieldRenameData PATTERN_TYPE_DATA = FieldRenameData.Builder.newBuilder() +diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +@@ -0,0 +0,0 @@ public class Commodore { + + public static byte[] convert(byte[] b, final String pluginName, final ApiVersion pluginVersion, final Set activeCompatibilities) { + final boolean modern = pluginVersion.isNewerThanOrSameAs(ApiVersion.FLATTENING); +- final boolean enumCompatibility = pluginVersion.isOlderThanOrSameAs(ApiVersion.getOrCreateVersion("1.20.6")) && activeCompatibilities.contains("enum-compatibility-mode"); + ClassReader cr = new ClassReader(b); + ClassWriter cw = new ClassWriter(0); // TODO 2024-06-22: Open PR to ASM to included interface in handle hash + +- List methodEnumSignatures = Commodore.getMethodSignatures(b); +- Multimap enumLessToEnum = HashMultimap.create(); +- for (String method : methodEnumSignatures) { +- enumLessToEnum.put(method.replace("Ljava/lang/Enum;", "Ljava/lang/Object;"), method); +- } +- + ClassVisitor visitor = cw; +- if (enumCompatibility) { +- visitor = new LimitedClassRemapper(cw, new SimpleRemapper(Commodore.ENUM_RENAMES)); +- } + + cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(visitor)) { // Paper + final Set rerouteMethodData = new HashSet<>(); +@@ -0,0 +0,0 @@ public class Commodore { + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { +- if (enumCompatibility && (access & Opcodes.ACC_SYNTHETIC) != 0 && (access & Opcodes.ACC_BRIDGE) != 0 && desc.contains("Ljava/lang/Object;")) { +- // SPIGOT-7820: Do not use object method if enum method is present +- // The object method does only redirect to the enum method +- Collection result = enumLessToEnum.get(desc.replace("Ljava/lang/Enum;", "Ljava/lang/Object;") + " " + name); +- if (result.size() == 2) { +- name = name + "_BUKKIT_UNUSED"; +- } +- } +- + return new MethodVisitor(this.api, super.visitMethod(access, name, desc, signature, exceptions)) { + // Paper start - Plugin rewrites + @Override diff --git a/src/main/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess b/src/main/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -878,6 +950,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 use-map-color-cache: true - compatibility: - allow-old-keys-in-registry: false +- enum-compatibility-mode: false spawn-limits: monsters: 70 animals: 10 @@ -1106,6 +1179,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - register(PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class); - register(Structure.class, Registries.STRUCTURE, CraftStructure.class, net.minecraft.world.level.levelgen.structure.Structure.class); - register(StructureType.class, Registries.STRUCTURE_TYPE, CraftStructureType.class, net.minecraft.world.level.levelgen.structure.StructureType.class); +- register(Villager.Type.class, Registries.VILLAGER_TYPE, CraftVillager.CraftType.class, VillagerType.class); +- register(Villager.Profession.class, Registries.VILLAGER_PROFESSION, CraftVillager.CraftProfession.class, VillagerProfession.class); - register(TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class); - register(TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class); - register(DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class); @@ -1113,6 +1188,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - register(Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class); - register(ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true); - register(BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true); +- register(Frog.Variant.class, Registries.FROG_VARIANT, CraftFrog.CraftVariant.class, FrogVariant.class); +- register(Cat.Type.class, Registries.CAT_VARIANT, CraftCat.CraftType.class, CatVariant.class); +- register(MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, CraftMapCursor.CraftType.class, MapDecorationType.class); + // Order: RegistryKey, Bukkit class, Minecraft Registry key, CraftBukkit class, Minecraft class + register(RegistryKey.ENCHANTMENT, Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class); + register(RegistryKey.GAME_EVENT, GameEvent.class, Registries.GAME_EVENT, CraftGameEvent.class, net.minecraft.world.level.gameevent.GameEvent.class); @@ -1120,6 +1198,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + register(RegistryKey.MOB_EFFECT, PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class); + register(RegistryKey.STRUCTURE, Structure.class, Registries.STRUCTURE, CraftStructure.class, net.minecraft.world.level.levelgen.structure.Structure.class); + register(RegistryKey.STRUCTURE_TYPE, StructureType.class, Registries.STRUCTURE_TYPE, CraftStructureType.class, net.minecraft.world.level.levelgen.structure.StructureType.class); ++ register(RegistryKey.VILLAGER_TYPE, Villager.Type.class, Registries.VILLAGER_TYPE, CraftVillager.CraftType.class, VillagerType.class); ++ register(RegistryKey.VILLAGER_PROFESSION, Villager.Profession.class, Registries.VILLAGER_PROFESSION, CraftVillager.CraftProfession.class, VillagerProfession.class); + register(RegistryKey.TRIM_MATERIAL, TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class); + register(RegistryKey.TRIM_PATTERN, TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class); + register(RegistryKey.DAMAGE_TYPE, DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class); @@ -1127,6 +1207,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + register(RegistryKey.WOLF_VARIANT, Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class); + register(RegistryKey.ITEM, ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true); + register(RegistryKey.BLOCK, BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true); ++ register(RegistryKey.FROG_VARIANT, Frog.Variant.class, Registries.FROG_VARIANT, CraftFrog.CraftVariant.class, FrogVariant.class); ++ register(RegistryKey.CAT_VARIANT, Cat.Type.class, Registries.CAT_VARIANT, CraftCat.CraftType.class, CatVariant.class); ++ register(RegistryKey.MAP_DECORATION_TYPE, MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, CraftMapCursor.CraftType.class, MapDecorationType.class); } diff --git a/patches/server/Add-missing-team-sidebar-display-slots.patch b/patches/server/Add-missing-team-sidebar-display-slots.patch index 97fd808c7b..f9768b2928 100644 --- a/patches/server/Add-missing-team-sidebar-display-slots.patch +++ b/patches/server/Add-missing-team-sidebar-display-slots.patch @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case "org/bukkit/enchantments/Enchantment" -> FieldRename.convertEnchantmentName(apiVersion, from); case "org/bukkit/block/Biome" -> FieldRename.convertBiomeName(apiVersion, from); @@ -0,0 +0,0 @@ public class FieldRename { - // } + //} // Paper end + // Paper start - DisplaySlot diff --git a/patches/server/Add-villager-reputation-API.patch b/patches/server/Add-villager-reputation-API.patch index fdd3d8f901..fc98962776 100644 --- a/patches/server/Add-villager-reputation-API.patch +++ b/patches/server/Add-villager-reputation-API.patch @@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public CraftVillager(CraftServer server, net.minecraft.world.entity.npc.Villager entity) { @@ -0,0 +0,0 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { - .getOptional(CraftNamespacedKey.toMinecraft(bukkit.getKey())).orElseThrow(); + return this.getKey().hashCode(); } } + diff --git a/patches/server/Adopt-MaterialRerouting.patch b/patches/server/Adopt-MaterialRerouting.patch index f2878b528a..440fc103c3 100644 --- a/patches/server/Adopt-MaterialRerouting.patch +++ b/patches/server/Adopt-MaterialRerouting.patch @@ -116,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (isInternal(methodNode.invisibleAnnotations)) continue; + // Paper end - filter out more methods from rerouting test - if (!Commodore.rerouteMethods(Collections.emptySet(), MaterialReroutingTest.MATERIAL_METHOD_REROUTE, (methodNode.access & Opcodes.ACC_STATIC) != 0, classNode.name, methodNode.name, methodNode.desc, a -> { })) { + if (!Commodore.rerouteMethods(Collections.emptySet(), ApiVersion.CURRENT, MaterialReroutingTest.MATERIAL_METHOD_REROUTE, (methodNode.access & Opcodes.ACC_STATIC) != 0, classNode.name, methodNode.name, methodNode.desc, a -> { })) { missingReroute.add(methodNode.name + " " + methodNode.desc + " " + methodNode.signature); @@ -0,0 +0,0 @@ public class MaterialReroutingTest extends AbstractTestingBase { } diff --git a/patches/server/Build-system-changes.patch b/patches/server/Build-system-changes.patch index 4c6366224a..7d6aed787d 100644 --- a/patches/server/Build-system-changes.patch +++ b/patches/server/Build-system-changes.patch @@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -7); + deadline.add(Calendar.DAY_OF_YEAR, -14); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/patches/server/Expose-server-build-information.patch b/patches/server/Expose-server-build-information.patch index 03079ac7bb..6f6c38aa08 100644 --- a/patches/server/Expose-server-build-information.patch +++ b/patches/server/Expose-server-build-information.patch @@ -610,7 +610,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static boolean useConsole = true; @@ -0,0 +0,0 @@ public class Main { - deadline.add(Calendar.DAY_OF_YEAR, -7); + deadline.add(Calendar.DAY_OF_YEAR, -14); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); diff --git a/patches/server/Fix-this-stupid-bullshit.patch b/patches/server/Fix-this-stupid-bullshit.patch index 85aca2d071..338ff9d49a 100644 --- a/patches/server/Fix-this-stupid-bullshit.patch +++ b/patches/server/Fix-this-stupid-bullshit.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -7); + deadline.add(Calendar.DAY_OF_YEAR, -14); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/patches/server/Hook-into-CB-plugin-rewrites.patch b/patches/server/Hook-into-CB-plugin-rewrites.patch index efb8e9cae0..5bb8bfb7bc 100644 --- a/patches/server/Hook-into-CB-plugin-rewrites.patch +++ b/patches/server/Hook-into-CB-plugin-rewrites.patch @@ -11,8 +11,8 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java -@@ -0,0 +0,0 @@ import java.util.ArrayList; - import java.util.Arrays; +@@ -0,0 +0,0 @@ import java.util.Arrays; + import java.util.Collection; import java.util.Collections; import java.util.Enumeration; +import java.util.HashMap; @@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import joptsimple.OptionSet; import joptsimple.OptionSpec; @@ -0,0 +0,0 @@ public class Commodore { - private static final Map MATERIAL_METHOD_REROUTE = Commodore.createReroutes(MaterialRerouting.class); private static final Map METHOD_REROUTE = Commodore.createReroutes(MethodRerouting.class); + private static final Map ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class); + // Paper start - Plugin rewrites + private static final Map SEARCH_AND_REMOVE = initReplacementsMap(); @@ -69,8 +69,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 OptionParser parser = new OptionParser(); OptionSpec inputFlag = parser.acceptsAll(Arrays.asList("i", "input")).withRequiredArg().ofType(File.class).required(); @@ -0,0 +0,0 @@ public class Commodore { - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + } + return new MethodVisitor(this.api, super.visitMethod(access, name, desc, signature, exceptions)) { + // Paper start - Plugin rewrites + @Override diff --git a/patches/server/Improve-PortalEvents.patch b/patches/server/Improve-PortalEvents.patch index 0422306c55..f63c938f25 100644 --- a/patches/server/Improve-PortalEvents.patch +++ b/patches/server/Improve-PortalEvents.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); Location enter = bukkitEntity.getLocation(); -- EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius); +- EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, true, creationRadius); + // Paper start + final org.bukkit.PortalType portalType = switch (cause) { + case END_PORTAL -> org.bukkit.PortalType.ENDER; @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + case END_GATEWAY -> org.bukkit.PortalType.END_GATEWAY; // not actually used yet + default -> org.bukkit.PortalType.CUSTOM; + }; -+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, portalType); ++ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, true, creationRadius, portalType); + // Paper end event.getEntity().getServer().getPluginManager().callEvent(event); if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !entity.isAlive()) { diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 88203a14d9..cbae094205 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -6168,7 +6168,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData; +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.ApiStatus; @DelegateDeserialization(ItemStack.class) public final class CraftItemStack extends ItemStack { diff --git a/patches/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch index 08bc2d33bd..6c793aa8b1 100644 --- a/patches/server/Missing-Entity-API.patch +++ b/patches/server/Missing-Entity-API.patch @@ -522,7 +522,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java @@ -0,0 +0,0 @@ public class CraftCat extends CraftTameableAnimal implements Cat { - + ", this can happen if a plugin creates its own cat variant with out properly registering it."); + return this.getKey().hashCode(); } } + diff --git a/patches/server/Proxy-ItemStack-to-CraftItemStack.patch b/patches/server/Proxy-ItemStack-to-CraftItemStack.patch index bebcd41634..47d84f51ef 100644 --- a/patches/server/Proxy-ItemStack-to-CraftItemStack.patch +++ b/patches/server/Proxy-ItemStack-to-CraftItemStack.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData; +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.ApiStatus; @DelegateDeserialization(ItemStack.class) public final class CraftItemStack extends ItemStack { diff --git a/patches/server/Remap-reflection-calls-in-plugins-using-internals.patch b/patches/server/Remap-reflection-calls-in-plugins-using-internals.patch index 5dcdab166a..f34f390950 100644 --- a/patches/server/Remap-reflection-calls-in-plugins-using-internals.patch +++ b/patches/server/Remap-reflection-calls-in-plugins-using-internals.patch @@ -653,7 +653,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java @@ -0,0 +0,0 @@ public class Commodore { - private static final Map METHOD_REROUTE = Commodore.createReroutes(MethodRerouting.class); + private static final Map ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class); // Paper start - Plugin rewrites - private static final Map SEARCH_AND_REMOVE = initReplacementsMap(); @@ -701,11 +701,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end - Plugin rewrites @@ -0,0 +0,0 @@ public class Commodore { - ClassReader cr = new ClassReader(b); - ClassWriter cw = new ClassWriter(cr, 0); + visitor = new LimitedClassRemapper(cw, new SimpleRemapper(Commodore.ENUM_RENAMES)); + } -- cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, cw) { -+ cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(cw)) { // Paper +- cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, visitor) { ++ cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(visitor)) { // Paper final Set rerouteMethodData = new HashSet<>(); String className; boolean isInterface; diff --git a/patches/server/Restore-vanilla-entity-drops-behavior.patch b/patches/server/Restore-vanilla-entity-drops-behavior.patch index b61377ee9c..87f46649b5 100644 --- a/patches/server/Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/Restore-vanilla-entity-drops-behavior.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!keepInventory) { for (ItemStack item : this.getInventory().getContents()) { if (!item.isEmpty() && !EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) { -- loot.add(CraftItemStack.asCraftMirror(item)); +- loot.add(CraftItemStack.asCraftMirror(item).markForInventoryDrop()); + loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false, false))); // Paper - Restore vanilla drops behavior; drop function taken from Inventory#dropAll (don't fire drop event) } } @@ -225,8 +225,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Restore vanilla drops behavior if (stack == null || stack.getType() == Material.AIR) continue; -- victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for dropped items +- if (stack instanceof CraftItemStack craftItemStack && craftItemStack.isForInventoryDrop()) { +- victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for Player Inventory dropped items +- } else { +- victim.forceDrops = true; +- victim.spawnAtLocation(CraftItemStack.asNMSCopy(stack)); // SPIGOT-7806: Vanilla Behaviour for items not related to Player Inventory dropped items +- victim.forceDrops = false; +- } + drop.runConsumer(entity.getWorld(), entity.getLocation()); // Paper - Restore vanilla drops behavior } return event; +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { + this.setItemMeta(itemMeta); + } + +- /** +- * Gets if the item is marked as an inventory drop in death events. +- * +- * @return true if the item is marked as an inventory drop +- */ +- @ApiStatus.Internal +- public boolean isForInventoryDrop() { +- return this.isForInventoryDrop; +- } +- +- /** +- * Marks this item as an inventory drop in death events. +- * +- * @return the ItemStack marked as an inventory drop +- */ +- @ApiStatus.Internal +- public ItemStack markForInventoryDrop() { +- this.isForInventoryDrop = true; +- return this; +- } +- + @Override + public MaterialData getData() { + return this.handle != null ? CraftMagicNumbers.getMaterialData(this.handle.getItem()) : super.getData(); diff --git a/work/Bukkit b/work/Bukkit index e86f4dc4bb..3a3bea5205 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit e86f4dc4bb897d2ad627763e46c9ed08b090f0f3 +Subproject commit 3a3bea52057e094e4060239ad8a5ce16cf4c8dcb diff --git a/work/CraftBukkit b/work/CraftBukkit index c3ceeb6f79..403accd563 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit c3ceeb6f79b4258d3c966f34aeafb7ca6d72e41a +Subproject commit 403accd56333f091f4ef8b5f870591785e26cdfe diff --git a/work/Spigot b/work/Spigot index 491f367502..5bbef5ad33 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 491f36750240694ded097bb893aa03d5f7bb81d8 +Subproject commit 5bbef5ad33ea0f6a5f743ce123b385d3d22ff3f9