Initial Spigot remap patches

This commit is contained in:
Kyle Wood 2021-06-11 06:43:40 -05:00
parent e8399962f4
commit 9f5325207d
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 <kyle@denwav.dev>
Date: Thu, 10 Dec 2020 20:50:33 -0800
Subject: [PATCH] Convert project to Gradle
diff --git a/.gitignore b/.gitignore
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +0,0 @@
+.gradle/
+
# Eclipse stuff
/.classpath
/.project
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@
+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,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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/commands/SummonCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SummonCommand.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -0,0 +0,0 @@ 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);

View file

@ -0,0 +1,95 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kyle Wood <kyle@denwav.dev>
Date: Thu, 10 Dec 2020 20:54:19 -0800
Subject: [PATCH] Setup Gradle project
diff --git a/.gitignore b/.gitignore
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +0,0 @@
+.gradle/
+build/
+
# Eclipse stuff
/.classpath
/.project
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@
+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")
+}