mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 15:17:17 +01:00
Fixes for cb pkg ver
This commit is contained in:
parent
04a25c2813
commit
820f999ba4
5 changed files with 26 additions and 22 deletions
|
@ -353,14 +353,14 @@ index 0000000000000000000000000000000000000000..5fa5868e82d1f00498d0c5771369e171
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MappingEnvironment.java b/src/main/java/io/papermc/paper/util/MappingEnvironment.java
|
||||
index 8e4229634d41a42b3d93948eebb77def7c0c72b1..450d20a7a43868c06c43a9da07345e47786c75d4 100644
|
||||
index 8e4229634d41a42b3d93948eebb77def7c0c72b1..38745299ea49f253a410e77557100903ecb472b0 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MappingEnvironment.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MappingEnvironment.java
|
||||
@@ -10,6 +10,7 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@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();
|
||||
|
||||
|
@ -658,10 +658,10 @@ index 457a963ee6ebd3cf5c3831f6660e3850335af49f..61744d8fde3ba98585cf261fc09f0acc
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index 072153a601eb257bd36bba24f356d4eb085e3636..432ad62a82573901673d654b06e87b62369bea7a 100644
|
||||
index 072153a601eb257bd36bba24f356d4eb085e3636..c2f46c2d7c4035848724cdccdce23f45774e338c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -65,36 +65,20 @@ public class Commodore {
|
||||
@@ -65,36 +65,26 @@ public class Commodore {
|
||||
);
|
||||
|
||||
// Paper start - Plugin rewrites
|
||||
|
@ -677,12 +677,16 @@ index 072153a601eb257bd36bba24f356d4eb085e3636..432ad62a82573901673d654b06e87b62
|
|||
- 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)
|
||||
|
@ -705,7 +709,7 @@ index 072153a601eb257bd36bba24f356d4eb085e3636..432ad62a82573901673d654b06e87b62
|
|||
}
|
||||
// Paper end - Plugin rewrites
|
||||
|
||||
@@ -167,7 +151,7 @@ public class Commodore {
|
||||
@@ -167,7 +157,7 @@ public class Commodore {
|
||||
ClassReader cr = new ClassReader(b);
|
||||
ClassWriter cw = new ClassWriter(cr, 0);
|
||||
|
||||
|
|
|
@ -220,10 +220,10 @@ index c95b553a751e99b37ea340fcf5e1417bb147ae2d..5a6ce9733da2bb58499a27d96ad0cfd8
|
|||
public void onEntityRemove(Entity entity) {
|
||||
this.invertedVisibilityEntities.remove(entity.getUUID());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index 432ad62a82573901673d654b06e87b62369bea7a..6b4d696dc9f718fecfdba9b1091630d7ac6bd18a 100644
|
||||
index c2f46c2d7c4035848724cdccdce23f45774e338c..ceeb7381f81daa29f7ac76c68cb3d44886d5ceb5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -363,6 +363,13 @@ public class Commodore {
|
||||
@@ -369,6 +369,13 @@ public class Commodore {
|
||||
}
|
||||
// Paper end - Rewrite plugins
|
||||
|
||||
|
|
|
@ -164,16 +164,16 @@ index 8ca86852319d7463f60832bc98b825b0b4325995..62ada73302c6b3ce3fb2dcc8c31a1d9c
|
|||
|
||||
private final DisplayInfo handle;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index 6b4d696dc9f718fecfdba9b1091630d7ac6bd18a..e495b2ce1f129172314178222de9bba7bfe56572 100644
|
||||
index ceeb7381f81daa29f7ac76c68cb3d44886d5ceb5..c85e24d476b3fee51f166150a552a3c5c1097dc3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -368,6 +368,11 @@ public class Commodore {
|
||||
@@ -374,6 +374,11 @@ public class Commodore {
|
||||
super.visitMethodInsn(opcode, owner, name, "()Lcom/destroystokyo/paper/profile/PlayerProfile;", itf);
|
||||
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
|
||||
|
|
|
@ -29,19 +29,19 @@ index 943ef44ce17719170b71be0eae75c43426376459..db112344ef6cd6dc5c1fc5c222e23d48
|
|||
+ // Paper end - old getSpawnEgg API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index e495b2ce1f129172314178222de9bba7bfe56572..b08de24fbc5addefe61d5b1919898775260d4a54 100644
|
||||
index c85e24d476b3fee51f166150a552a3c5c1097dc3..27ca966d3542794e8739b28bae555a0c8ba815fb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -375,6 +375,15 @@ public class Commodore {
|
||||
@@ -381,6 +381,15 @@ public class Commodore {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // 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
|
||||
|
|
|
@ -7,11 +7,11 @@ Subject: [PATCH] Mitigate effects of WorldCreator#keepSpawnLoaded ret type
|
|||
TODO: Remove in 1.21?
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index b08de24fbc5addefe61d5b1919898775260d4a54..c46bb5ab1a9f365099a5e86ec6411e504fac372f 100644
|
||||
index 27ca966d3542794e8739b28bae555a0c8ba815fb..163e773a4782784f236175d7b0cf10ac4a574cac 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -373,6 +373,12 @@ public class Commodore {
|
||||
super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE_PREFIX + "advancement/CraftAdvancement", "getDisplay0", desc, false);
|
||||
@@ -379,6 +379,12 @@ public class Commodore {
|
||||
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")) {
|
||||
|
|
Loading…
Reference in a new issue