Initial Spigot remap patches

This commit is contained in:
Kyle Wood 2021-06-11 06:43:40 -05:00
parent fc52b39f3f
commit c1aacf62b5
No known key found for this signature in database
GPG Key ID: 86AF5613ACA30CC5
3 changed files with 248 additions and 0 deletions

View File

@ -0,0 +1,76 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kyle Wood <demonwav@gmail.com>
Date: Thu, 10 Dec 2020 20:50:33 -0800
Subject: [PATCH] Convert project to Gradle
diff --git a/.gitignore b/.gitignore
index e431e3435737e28394d81b56568a08b3c3148b9b..c484aff2c192bf42059b5689327909e4af654401 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+.gradle/
+
# Eclipse stuff
/.classpath
/.project
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..a0f1c1d1ac63fdcce942922ffe68a8d44c712513
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,54 @@
+plugins {
+ `java-library`
+ checkstyle
+}
+
+java {
+ withSourcesJar()
+ withJavadocJar()
+}
+
+dependencies {
+ // api dependencies are listed transitively to API consumers
+ api("commons-lang:commons-lang:2.6")
+ api("com.google.guava:guava:21.0")
+ api("com.google.code.gson:gson:2.8.0")
+ api("net.md-5:bungeecord-chat:1.16-R0.4")
+ api("org.yaml:snakeyaml:1.29")
+
+ compileOnly("org.apache.maven:maven-resolver-provider:3.8.1")
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.0")
+
+ val annotations = "org.jetbrains:annotations-java5:21.0.1"
+ compileOnly(annotations)
+ testCompileOnly(annotations)
+
+ testImplementation("junit:junit:4.13.1")
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.ow2.asm:asm-tree:9.1")
+
+ checkstyle("com.puppycrawl.tools:checkstyle:8.39")
+}
+
+tasks.jar {
+ manifest {
+ attributes += mapOf(
+ "Automatic-Module-Name" to "org.bukkit"
+ )
+ }
+}
+
+tasks.withType<Javadoc>().configureEach {
+ (options as StandardJavadocDocletOptions).links(
+ "https://guava.dev/releases/21.0/api/docs/",
+ "https://javadoc.io/doc/org.yaml/snakeyaml/1.27/",
+ "https://javadoc.io/doc/org.jetbrains/annotations-java5/20.1.0/",
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/"
+ )
+}
+
+checkstyle {
+ configFile = file("checkstyle.xml")
+ sourceSets = listOf(project.sourceSets.main.get(), project.sourceSets.test.get())
+}

View File

@ -0,0 +1,95 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kyle Wood <demonwav@gmail.com>
Date: Thu, 10 Dec 2020 20:54:19 -0800
Subject: [PATCH] Setup Gradle project
diff --git a/.gitignore b/.gitignore
index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..3e05459f27c4c5697ae65da504d67a6a2f617b57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+.gradle/
+build/
+
# Eclipse stuff
/.classpath
/.project
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..fddf2f440356425d948f40dcf9d9853a374ddc8e
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,72 @@
+import com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer
+import java.time.Instant
+
+plugins {
+ java
+ id("com.github.johnrengelman.shadow")
+}
+
+val packageVersion = providers.gradleProperty("packageVersion").forUseAtConfigurationTime().get()
+
+repositories {
+ maven("https://libraries.minecraft.net/")
+}
+
+dependencies {
+ implementation(project(":Paper-API"))
+ implementation("jline:jline:2.12.1")
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") {
+ exclude(group = "org.apache.logging.log4j", module = "log4j-api")
+ }
+ implementation("org.ow2.asm:asm:9.1")
+ implementation("com.googlecode.json-simple:json-simple:1.1.1") {
+ // This includes junit transitively for whatever reason
+ isTransitive = false
+ }
+ runtimeOnly("org.xerial:sqlite-jdbc:3.34.0")
+ runtimeOnly("mysql:mysql-connector-java:5.1.49")
+
+ runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.1")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.0")
+
+ testImplementation("junit:junit:4.13.1")
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
+}
+
+tasks.jar {
+ manifest {
+ attributes(mapOf(
+ "Main-Class" to "org.bukkit.craftbukkit.Main",
+ "Implementation-Title" to "CraftBukkit",
+ "Implementation-Vendor" to Instant.now().epochSecond,
+ "Specification-Title" to "Bukkit",
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to "Bukkit Team"
+ ))
+ for (tld in listOf("net", "com", "org")) {
+ attributes(mapOf(
+ "Sealed" to "true"
+ ), "$tld/bukkit")
+ }
+ }
+}
+
+tasks.shadowJar {
+ listOf(
+ "jline", "it.unimi", "org.apache.commons.codec", "org.apache.commons.io",
+ "org.apache.commons.lang3", "org.objectweb.asm"
+ ).forEach { pack ->
+ relocate(pack, "org.bukkit.craftbukkit.libs.$pack")
+ }
+ relocate("org.bukkit.craftbukkit", "org.bukkit.craftbukkit.v$packageVersion") {
+ exclude("org.bukkit.craftbukkit.Main*")
+ }
+ transform(AppendingTransformer::class.java) {
+ resource = "META-INF/services/java.sql.Driver"
+ }
+}
+
+tasks.test {
+ exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
+}

View File

@ -0,0 +1,77 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kyle Wood <kyle@denwav.dev>
Date: Fri, 11 Jun 2021 05:25:03 -0500
Subject: [PATCH] Decompile fixes
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3aecce56bdac0a316742a55e340c522bea737321..6b4d84faba50d9f3f87e48251cf1294479d4a3a0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1138,7 +1138,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
- protected void doRunTask(TickTask ticktask) {
+ public void doRunTask(TickTask ticktask) { // Paper - decomp fix
this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask);
}
diff --git a/src/main/java/net/minecraft/server/commands/SummonCommand.java b/src/main/java/net/minecraft/server/commands/SummonCommand.java
index 71c22f72b6e7507e85ecb6be3166b809b7409ab2..fb9fca76a42479363c9c9764fdae6adb4b5e703f 100644
--- a/src/main/java/net/minecraft/server/commands/SummonCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java
@@ -54,9 +54,9 @@ public class SummonCommand {
nbttagcompound1.putString("id", entity.toString());
ServerLevel worldserver = source.getLevel();
- Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (entity1) -> {
- entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
- return entity1;
+ Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (loadedEntity) -> { // Paper - decomp fix
+ loadedEntity.moveTo(pos.x, pos.y, pos.z, loadedEntity.getYRot(), loadedEntity.getXRot()); // Paper - decomp fix
+ return loadedEntity; // Paper - decomp fix
});
if (entity1 == null) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
index 88a8c2bc4aa30f478122a05fd119486a0107db82..5f00e3f4c86196db47bf1007973445d40866afdd 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
@@ -169,8 +169,8 @@ public class BehaviorUtils {
return optional.map((uuid) -> {
return ((ServerLevel) entity.level).getEntity(uuid);
- }).map((entity) -> {
- return entity instanceof LivingEntity ? (LivingEntity) entity : null;
+ }).map((entity2) -> { // Paper - decomp fix
+ return entity2 instanceof LivingEntity ? (LivingEntity) entity2 : null; // Paper - decomp fix
});
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index c88dc823ca0c2f83bc10886208d498ea77523d68..dcfd0b107ac7bd1633f3b681cd5f5e26ce87bd63 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -522,7 +522,7 @@ public class Phantom extends FlyingMob implements Enemy {
List<Player> list = Phantom.this.level.getNearbyPlayers(this.attackTargeting, (LivingEntity) Phantom.this, Phantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
if (!list.isEmpty()) {
- list.sort(Comparator.comparing(Entity::getY).reversed());
+ list.sort(Comparator.<Player, Double>comparing(Entity::getY).reversed()); // Paper - decomp fix
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
index b4a5709b03e400d00504f33a9b34019d2b7bf115..2d79d4014770081fcd58a929e5fe0a26ac1b8023 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -172,7 +172,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
Map<RecipeType<?>, Object2ObjectLinkedOpenHashMap<ResourceLocation, Recipe<?>>> map = Maps.newHashMap(); // CraftBukkit
recipes.forEach((irecipe) -> {
- Map<ResourceLocation, Recipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> {
+ Map<ResourceLocation, Recipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes_) -> { // Paper - decomp fix
return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
});
Recipe<?> irecipe1 = (Recipe) map1.put(irecipe.getId(), irecipe);