diff --git a/patches/server/Add-ItemFactory-getSpawnEgg-API.patch b/patches/server/Add-ItemFactory-getSpawnEgg-API.patch index 95758c63fa..1181543d2a 100644 --- a/patches/server/Add-ItemFactory-getSpawnEgg-API.patch +++ b/patches/server/Add-ItemFactory-getSpawnEgg-API.patch @@ -39,9 +39,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - ItemFactory#getSpawnEgg (paper had original method that returned ItemStack, upstream added identical but returned Material) + if (owner.equals("org/bukkit/inventory/ItemFactory") && name.equals("getSpawnEgg") && desc.equals("(Lorg/bukkit/entity/EntityType;)Lorg/bukkit/inventory/ItemStack;")) { + super.visitInsn(Opcodes.SWAP); // has 1 param, this moves the owner instance to the top for the checkcast -+ super.visitTypeInsn(Opcodes.CHECKCAST, CB_PACKAGE_PREFIX + "inventory/CraftItemFactory"); ++ super.visitTypeInsn(Opcodes.CHECKCAST, runtimeCbPkgPrefix() + "inventory/CraftItemFactory"); + super.visitInsn(Opcodes.SWAP); // moves param back to the the top of stack -+ super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE_PREFIX + "inventory/CraftItemFactory", "getSpawnEgg0", desc, false); ++ super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, runtimeCbPkgPrefix() + "inventory/CraftItemFactory", "getSpawnEgg0", desc, false); + return; + } + // Paper end - ItemFactory#getSpawnEgg diff --git a/patches/server/Add-more-advancement-API.patch b/patches/server/Add-more-advancement-API.patch index 3f47c6aeef..bfe2506c04 100644 --- a/patches/server/Add-more-advancement-API.patch +++ b/patches/server/Add-more-advancement-API.patch @@ -172,8 +172,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } + if (owner.equals("org/bukkit/advancement/Advancement") && name.equals("getDisplay") && desc.endsWith(")Lorg/bukkit/advancement/AdvancementDisplay;")) { -+ super.visitTypeInsn(Opcodes.CHECKCAST, CB_PACKAGE_PREFIX + "advancement/CraftAdvancement"); -+ super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE_PREFIX + "advancement/CraftAdvancement", "getDisplay0", desc, false); ++ super.visitTypeInsn(Opcodes.CHECKCAST, runtimeCbPkgPrefix() + "advancement/CraftAdvancement"); ++ super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, runtimeCbPkgPrefix() + "advancement/CraftAdvancement", "getDisplay0", desc, false); + return; + } // Paper end diff --git a/patches/server/Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch b/patches/server/Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch index f8ec34d96d..929fe64fff 100644 --- a/patches/server/Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch +++ b/patches/server/Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch @@ -11,7 +11,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 { - super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE_PREFIX + "advancement/CraftAdvancement", "getDisplay0", desc, false); + super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, runtimeCbPkgPrefix() + "advancement/CraftAdvancement", "getDisplay0", desc, false); return; } + if (owner.equals("org/bukkit/WorldCreator") && name.equals("keepSpawnLoaded") && desc.equals("(Lnet/kyori/adventure/util/TriState;)V")) { 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 eca6d474cb..dba2a1b6f0 100644 --- a/patches/server/Remap-reflection-calls-in-plugins-using-internals.patch +++ b/patches/server/Remap-reflection-calls-in-plugins-using-internals.patch @@ -360,7 +360,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @DefaultQualifier(NonNull.class) public final class MappingEnvironment { -+ public static final String LEGACY_CB_VERSION = "v1_20_R3"; ++ public static final String LEGACY_CB_VERSION = "v1_20_R4"; private static final @Nullable String MAPPINGS_HASH = readMappingsHash(); private static final boolean REOBF = checkReobf(); @@ -677,12 +677,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - final String NMS_REVISION_PACKAGE = "v" + manifest.getMainAttributes().getValue("CraftBukkit-Package-Version") + "/"; - - getAndRemove.put("org/bukkit/".concat("craftbukkit/" + NMS_REVISION_PACKAGE), NMS_REVISION_PACKAGE); -- } -- -- return getAndRemove; -- } + private static final String CB_PACKAGE_PREFIX = "org/bukkit/".concat("craftbukkit/"); + private static final String LEGACY_CB_PACKAGE_PREFIX = CB_PACKAGE_PREFIX + io.papermc.paper.util.MappingEnvironment.LEGACY_CB_VERSION + "/"; ++ private static String runtimeCbPkgPrefix() { ++ if (io.papermc.paper.util.MappingEnvironment.reobf()) { ++ return LEGACY_CB_PACKAGE_PREFIX; + } +- +- return getAndRemove; ++ return CB_PACKAGE_PREFIX; + } @Nonnull private static String getOriginalOrRewrite(@Nonnull String original)