Adventure (kind of)
This commit is contained in:
parent
8e8d6aeeb0
commit
9b56221762
10 changed files with 282 additions and 367 deletions
782
patches/server/0001-Setup-Gradle-project.patch
Normal file
782
patches/server/0001-Setup-Gradle-project.patch
Normal file
|
@ -0,0 +1,782 @@
|
|||
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
|
||||
|
||||
The pom.xml file is deleted in this patch so the patch will fail to
|
||||
apply if there are changes made to it from upstream - thus notifying us
|
||||
that changes were made.
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 37dab9e868dbfb019c271a547d975a48ad1cb571..3811c0d849a3eb028ed1a6b7a2d4747f7f570448 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -1,3 +1,6 @@
|
||||
+.gradle/
|
||||
+build/
|
||||
+
|
||||
# Eclipse stuff
|
||||
/.classpath
|
||||
/.project
|
||||
@@ -39,3 +42,7 @@ dependency-reduced-pom.xml
|
||||
|
||||
/src/main/resources/achievement
|
||||
/src/main/resources/lang
|
||||
+
|
||||
+# vs code
|
||||
+/.vscode
|
||||
+/.factorypath
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3be7f53046d821d6777481b92b3aa6e3df51ed8f
|
||||
--- /dev/null
|
||||
+++ b/build.gradle.kts
|
||||
@@ -0,0 +1,140 @@
|
||||
+import io.papermc.paperweight.util.*
|
||||
+
|
||||
+plugins {
|
||||
+ java
|
||||
+ `maven-publish`
|
||||
+ id("com.github.johnrengelman.shadow")
|
||||
+}
|
||||
+
|
||||
+dependencies {
|
||||
+ implementation(project(":paper-api"))
|
||||
+ implementation("jline:jline:2.12.1")
|
||||
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") {
|
||||
+ exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
||||
+ }
|
||||
+ implementation("org.ow2.asm:asm:9.5")
|
||||
+ implementation("commons-lang:commons-lang:2.6")
|
||||
+ runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
|
||||
+ runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
|
||||
+
|
||||
+ runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
||||
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
|
||||
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
|
||||
+
|
||||
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
||||
+ testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
+ testImplementation("org.mockito:mockito-core:5.5.0")
|
||||
+}
|
||||
+
|
||||
+val craftbukkitPackageVersion = "1_20_R2" // Paper
|
||||
+tasks.jar {
|
||||
+ archiveClassifier.set("dev")
|
||||
+
|
||||
+ manifest {
|
||||
+ val git = Git(rootProject.layout.projectDirectory.path)
|
||||
+ val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||
+ val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
|
||||
+ val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
||||
+ attributes(
|
||||
+ "Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
+ "Implementation-Title" to "CraftBukkit",
|
||||
+ "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||
+ "Implementation-Vendor" to date, // Paper
|
||||
+ "Specification-Title" to "Bukkit",
|
||||
+ "Specification-Version" to project.version,
|
||||
+ "Specification-Vendor" to "Bukkit Team",
|
||||
+ )
|
||||
+ for (tld in setOf("net", "com", "org")) {
|
||||
+ attributes("$tld/bukkit", "Sealed" to true)
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+publishing {
|
||||
+ publications.create<MavenPublication>("maven") {
|
||||
+ artifact(tasks.shadowJar)
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+relocation {
|
||||
+ // Order matters here - e.g. craftbukkit proper must be relocated before any of the libs are relocated into the cb package
|
||||
+ relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$craftbukkitPackageVersion") {
|
||||
+ exclude("org.bukkit.craftbukkit.Main*")
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+tasks.shadowJar {
|
||||
+ configurations = listOf(project.configurations.vanillaServer.get())
|
||||
+ archiveClassifier.set("mojang-mapped")
|
||||
+
|
||||
+ for (relocation in relocation.relocations.get()) {
|
||||
+ relocate(relocation.fromPackage, relocation.toPackage) {
|
||||
+ for (exclude in relocation.excludes) {
|
||||
+ exclude(exclude)
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+tasks.test {
|
||||
+ exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
|
||||
+ useJUnitPlatform()
|
||||
+}
|
||||
+
|
||||
+fun TaskContainer.registerRunTask(
|
||||
+ name: String,
|
||||
+ block: JavaExec.() -> Unit
|
||||
+): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
+ group = "paper"
|
||||
+ mainClass.set("org.bukkit.craftbukkit.Main")
|
||||
+ standardInput = System.`in`
|
||||
+ workingDir = rootProject.layout.projectDirectory
|
||||
+ .dir(providers.gradleProperty("paper.runWorkDir").getOrElse("run"))
|
||||
+ .asFile
|
||||
+ javaLauncher.set(project.javaToolchains.defaultJavaLauncher(project))
|
||||
+
|
||||
+ if (rootProject.childProjects["test-plugin"] != null) {
|
||||
+ val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }
|
||||
+ inputs.file(testPluginJar)
|
||||
+ args("-add-plugin=${testPluginJar.get().asFile.absolutePath}")
|
||||
+ }
|
||||
+
|
||||
+ args("--nogui")
|
||||
+ systemProperty("net.kyori.adventure.text.warnWhenLegacyFormattingDetected", true)
|
||||
+ if (providers.gradleProperty("paper.runDisableWatchdog").getOrElse("false") == "true") {
|
||||
+ systemProperty("disable.watchdog", true)
|
||||
+ }
|
||||
+ systemProperty("io.papermc.paper.suppress.sout.nags", true)
|
||||
+
|
||||
+ val memoryGb = providers.gradleProperty("paper.runMemoryGb").getOrElse("2")
|
||||
+ minHeapSize = "${memoryGb}G"
|
||||
+ maxHeapSize = "${memoryGb}G"
|
||||
+
|
||||
+ doFirst {
|
||||
+ workingDir.mkdirs()
|
||||
+ }
|
||||
+
|
||||
+ block(this)
|
||||
+}
|
||||
+
|
||||
+val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatMap { it.elements }
|
||||
+ .zip(configurations.vanillaServer.map { it.singleFile.absolutePath }) { runtime, vanilla ->
|
||||
+ runtime.filterNot { it.asFile.absolutePath == vanilla }
|
||||
+ }
|
||||
+
|
||||
+tasks.registerRunTask("runShadow") {
|
||||
+ description = "Spin up a test server from the shadowJar archiveFile"
|
||||
+ classpath(tasks.shadowJar.flatMap { it.archiveFile })
|
||||
+ classpath(runtimeClasspathWithoutVanillaServer)
|
||||
+}
|
||||
+
|
||||
+tasks.registerRunTask("runReobf") {
|
||||
+ description = "Spin up a test server from the reobfJar output jar"
|
||||
+ classpath(tasks.reobfJar.flatMap { it.outputJar })
|
||||
+ classpath(runtimeClasspathWithoutVanillaServer)
|
||||
+}
|
||||
+
|
||||
+tasks.registerRunTask("runDev") {
|
||||
+ description = "Spin up a non-relocated Mojang-mapped test server"
|
||||
+ classpath(sourceSets.main.map { it.runtimeClasspath })
|
||||
+}
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
deleted file mode 100644
|
||||
index 6ebce22b21550442716de605149e9d9eb6bee481..0000000000000000000000000000000000000000
|
||||
--- a/pom.xml
|
||||
+++ /dev/null
|
||||
@@ -1,602 +0,0 @@
|
||||
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
- <modelVersion>4.0.0</modelVersion>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot</artifactId>
|
||||
- <packaging>jar</packaging>
|
||||
- <version>1.20.3-R0.1-SNAPSHOT</version>
|
||||
- <name>Spigot</name>
|
||||
- <url>https://www.spigotmc.org/</url>
|
||||
-
|
||||
- <parent>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot-parent</artifactId>
|
||||
- <version>dev-SNAPSHOT</version>
|
||||
- <relativePath>../pom.xml</relativePath>
|
||||
- </parent>
|
||||
-
|
||||
- <properties>
|
||||
- <skipTests>true</skipTests>
|
||||
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
- <api.version>unknown</api.version>
|
||||
- <bt.name>git</bt.name>
|
||||
- <minecraft_version>1_20_R3</minecraft_version>
|
||||
- <maven.compiler.source>17</maven.compiler.source>
|
||||
- <maven.compiler.target>17</maven.compiler.target>
|
||||
- </properties>
|
||||
-
|
||||
- <repositories>
|
||||
- <repository>
|
||||
- <id>minecraft-libraries</id>
|
||||
- <name>Minecraft Libraries</name>
|
||||
- <url>https://libraries.minecraft.net/</url>
|
||||
- </repository>
|
||||
- </repositories>
|
||||
-
|
||||
- <dependencies>
|
||||
- <dependency>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot-api</artifactId>
|
||||
- <version>${project.version}</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>minecraft-server</artifactId>
|
||||
- <version>${project.version}</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>jline</groupId>
|
||||
- <artifactId>jline</artifactId>
|
||||
- <version>2.12.1</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.logging.log4j</groupId>
|
||||
- <artifactId>log4j-iostreams</artifactId>
|
||||
- <version>2.19.0</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.ow2.asm</groupId>
|
||||
- <artifactId>asm</artifactId>
|
||||
- <version>9.5</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <!-- Mojang depends -->
|
||||
- <dependency>
|
||||
- <groupId>com.github.oshi</groupId>
|
||||
- <artifactId>oshi-core</artifactId>
|
||||
- <version>6.4.5</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>com.mojang</groupId>
|
||||
- <artifactId>authlib</artifactId>
|
||||
- <version>5.0.51</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>com.mojang</groupId>
|
||||
- <artifactId>brigadier</artifactId>
|
||||
- <version>1.2.9</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>com.mojang</groupId>
|
||||
- <artifactId>datafixerupper</artifactId>
|
||||
- <version>6.0.8</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>com.mojang</groupId>
|
||||
- <artifactId>logging</artifactId>
|
||||
- <version>1.1.1</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>commons-io</groupId>
|
||||
- <artifactId>commons-io</artifactId>
|
||||
- <version>2.13.0</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-buffer</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-codec</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-common</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-handler</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-resolver</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-transport</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-transport-classes-epoll</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-transport-native-epoll</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <classifier>linux-x86_64</classifier>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-transport-native-epoll</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <classifier>linux-aarch_64</classifier>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>io.netty</groupId>
|
||||
- <artifactId>netty-transport-native-unix-common</artifactId>
|
||||
- <version>4.1.97.Final</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>it.unimi.dsi</groupId>
|
||||
- <artifactId>fastutil</artifactId>
|
||||
- <version>8.5.12</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>net.java.dev.jna</groupId>
|
||||
- <artifactId>jna</artifactId>
|
||||
- <version>5.13.0</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>net.java.dev.jna</groupId>
|
||||
- <artifactId>jna-platform</artifactId>
|
||||
- <version>5.13.0</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>net.sf.jopt-simple</groupId>
|
||||
- <artifactId>jopt-simple</artifactId>
|
||||
- <version>5.0.4</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.commons</groupId>
|
||||
- <artifactId>commons-lang3</artifactId>
|
||||
- <version>3.13.0</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.logging.log4j</groupId>
|
||||
- <artifactId>log4j-core</artifactId>
|
||||
- <version>2.19.0</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.logging.log4j</groupId>
|
||||
- <artifactId>log4j-slf4j2-impl</artifactId>
|
||||
- <version>2.19.0</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.slf4j</groupId>
|
||||
- <artifactId>slf4j-api</artifactId>
|
||||
- <version>2.0.7</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <!-- deprecated API depend -->
|
||||
- <dependency>
|
||||
- <groupId>commons-lang</groupId>
|
||||
- <artifactId>commons-lang</artifactId>
|
||||
- <version>2.6</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <!-- deprecated API depend -->
|
||||
- <dependency>
|
||||
- <groupId>com.googlecode.json-simple</groupId>
|
||||
- <artifactId>json-simple</artifactId>
|
||||
- <version>1.1.1</version>
|
||||
- <scope>runtime</scope>
|
||||
- <exclusions>
|
||||
- <exclusion>
|
||||
- <groupId>junit</groupId>
|
||||
- <artifactId>junit</artifactId>
|
||||
- </exclusion>
|
||||
- </exclusions>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.xerial</groupId>
|
||||
- <artifactId>sqlite-jdbc</artifactId>
|
||||
- <version>3.42.0.1</version>
|
||||
- <scope>runtime</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>com.mysql</groupId>
|
||||
- <artifactId>mysql-connector-j</artifactId>
|
||||
- <version>8.1.0</version>
|
||||
- <scope>runtime</scope>
|
||||
- </dependency>
|
||||
- <!-- add these back in as they are not exposed by the API -->
|
||||
- <dependency>
|
||||
- <groupId>org.apache.maven</groupId>
|
||||
- <artifactId>maven-resolver-provider</artifactId>
|
||||
- <version>3.8.5</version>
|
||||
- <scope>runtime</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.maven.resolver</groupId>
|
||||
- <artifactId>maven-resolver-connector-basic</artifactId>
|
||||
- <version>1.7.3</version>
|
||||
- <scope>runtime</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.maven.resolver</groupId>
|
||||
- <artifactId>maven-resolver-transport-http</artifactId>
|
||||
- <version>1.7.3</version>
|
||||
- <scope>runtime</scope>
|
||||
- </dependency>
|
||||
- <!-- annotations -->
|
||||
- <dependency>
|
||||
- <groupId>org.jetbrains</groupId>
|
||||
- <artifactId>annotations-java5</artifactId>
|
||||
- <version>24.0.1</version>
|
||||
- <scope>provided</scope>
|
||||
- </dependency>
|
||||
- <!-- testing -->
|
||||
- <dependency>
|
||||
- <groupId>org.junit.jupiter</groupId>
|
||||
- <artifactId>junit-jupiter</artifactId>
|
||||
- <version>5.10.0</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.hamcrest</groupId>
|
||||
- <artifactId>hamcrest</artifactId>
|
||||
- <version>2.2</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.mockito</groupId>
|
||||
- <artifactId>mockito-core</artifactId>
|
||||
- <version>5.5.0</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
-
|
||||
- <!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
- <build>
|
||||
- <plugins>
|
||||
- <plugin>
|
||||
- <groupId>net.md-5</groupId>
|
||||
- <artifactId>scriptus</artifactId>
|
||||
- <version>0.5.0</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <id>ex-spigot</id>
|
||||
- <configuration>
|
||||
- <format>${bt.name}-Spigot-%s</format>
|
||||
- <scmDirectory>../</scmDirectory>
|
||||
- <descriptionProperty>spigot.desc</descriptionProperty>
|
||||
- </configuration>
|
||||
- <phase>initialize</phase>
|
||||
- <goals>
|
||||
- <goal>describe</goal>
|
||||
- </goals>
|
||||
- </execution>
|
||||
- <execution>
|
||||
- <id>ex-craftbukkit</id>
|
||||
- <configuration>
|
||||
- <format>-%s</format>
|
||||
- <scmDirectory>../../CraftBukkit</scmDirectory>
|
||||
- <descriptionProperty>craftbukkit.desc</descriptionProperty>
|
||||
- </configuration>
|
||||
- <phase>initialize</phase>
|
||||
- <goals>
|
||||
- <goal>describe</goal>
|
||||
- </goals>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-clean-plugin</artifactId>
|
||||
- <version>3.2.0</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>initialize</phase>
|
||||
- <goals>
|
||||
- <goal>clean</goal>
|
||||
- </goals>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-jar-plugin</artifactId>
|
||||
- <version>3.3.0</version>
|
||||
- <configuration>
|
||||
- <archive>
|
||||
- <manifest>
|
||||
- <addDefaultEntries>false</addDefaultEntries>
|
||||
- </manifest>
|
||||
- <manifestEntries>
|
||||
- <Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
|
||||
- <Implementation-Title>CraftBukkit</Implementation-Title>
|
||||
- <Implementation-Version>${spigot.desc}${craftbukkit.desc}</Implementation-Version>
|
||||
- <Implementation-Vendor>${project.build.outputTimestamp}</Implementation-Vendor>
|
||||
- <Specification-Title>Bukkit</Specification-Title>
|
||||
- <Specification-Version>${api.version}</Specification-Version>
|
||||
- <Specification-Vendor>Bukkit Team</Specification-Vendor>
|
||||
- <Multi-Release>true</Multi-Release>
|
||||
- </manifestEntries>
|
||||
- <manifestSections>
|
||||
- <manifestSection>
|
||||
- <name>net/bukkit/</name>
|
||||
- <manifestEntries>
|
||||
- <Sealed>true</Sealed>
|
||||
- </manifestEntries>
|
||||
- </manifestSection>
|
||||
- <manifestSection>
|
||||
- <name>com/bukkit/</name>
|
||||
- <manifestEntries>
|
||||
- <Sealed>true</Sealed>
|
||||
- </manifestEntries>
|
||||
- </manifestSection>
|
||||
- <manifestSection>
|
||||
- <name>org/bukkit/</name>
|
||||
- <manifestEntries>
|
||||
- <Sealed>true</Sealed>
|
||||
- </manifestEntries>
|
||||
- </manifestSection>
|
||||
- </manifestSections>
|
||||
- </archive>
|
||||
- </configuration>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-shade-plugin</artifactId>
|
||||
- <version>3.5.0</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>package</phase>
|
||||
- <goals>
|
||||
- <goal>shade</goal>
|
||||
- </goals>
|
||||
- <configuration>
|
||||
- <createSourcesJar>${shadeSourcesJar}</createSourcesJar>
|
||||
- <artifactSet>
|
||||
- <includes>
|
||||
- <include>org.spigotmc:minecraft-server</include>
|
||||
- </includes>
|
||||
- </artifactSet>
|
||||
- <relocations>
|
||||
- <relocation>
|
||||
- <pattern>org.bukkit.craftbukkit</pattern>
|
||||
- <shadedPattern>org.bukkit.craftbukkit.v${minecraft_version}</shadedPattern>
|
||||
- <excludes>
|
||||
- <exclude>org.bukkit.craftbukkit.bootstrap.*</exclude>
|
||||
- <exclude>org.bukkit.craftbukkit.Main*</exclude>
|
||||
- </excludes>
|
||||
- </relocation>
|
||||
- </relocations>
|
||||
- </configuration>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>net.md-5</groupId>
|
||||
- <artifactId>specialsource-maven-plugin</artifactId>
|
||||
- <version>2.0.2</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>package</phase>
|
||||
- <goals>
|
||||
- <goal>remap</goal>
|
||||
- </goals>
|
||||
- <id>remap-members</id>
|
||||
- <configuration>
|
||||
- <useProjectDependencies>false</useProjectDependencies>
|
||||
- <logFile>${project.build.directory}/server.txt</logFile>
|
||||
- <srgIn>org.spigotmc:minecraft-server:${project.version}:csrg:maps-spigot-members</srgIn>
|
||||
- <reverse>true</reverse>
|
||||
- </configuration>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>net.nicoulaj.maven.plugins</groupId>
|
||||
- <artifactId>checksum-maven-plugin</artifactId>
|
||||
- <version>1.11</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>package</phase>
|
||||
- <goals>
|
||||
- <goal>artifacts</goal>
|
||||
- <goal>dependencies</goal>
|
||||
- </goals>
|
||||
- <configuration>
|
||||
- <algorithms>
|
||||
- <algorithm>SHA-256</algorithm>
|
||||
- </algorithms>
|
||||
- <quiet>true</quiet>
|
||||
- <scopes>
|
||||
- <scope>compile</scope>
|
||||
- <scope>runtime</scope>
|
||||
- </scopes>
|
||||
- <shasumSummary>true</shasumSummary>
|
||||
- <transitive>true</transitive>
|
||||
- </configuration>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-assembly-plugin</artifactId>
|
||||
- <version>3.6.0</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>package</phase>
|
||||
- <goals>
|
||||
- <goal>single</goal>
|
||||
- </goals>
|
||||
- <configuration>
|
||||
- <archive>
|
||||
- <manifest>
|
||||
- <addDefaultEntries>false</addDefaultEntries>
|
||||
- </manifest>
|
||||
- <manifestEntries>
|
||||
- <Main-Class>org.bukkit.craftbukkit.bootstrap.Main</Main-Class>
|
||||
- </manifestEntries>
|
||||
- </archive>
|
||||
- <attach>false</attach>
|
||||
- <descriptors>
|
||||
- <descriptor>${project.basedir}/src/assembly/bootstrap.xml</descriptor>
|
||||
- </descriptors>
|
||||
- </configuration>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-compiler-plugin</artifactId>
|
||||
- <version>3.11.0</version>
|
||||
- <configuration>
|
||||
- <!-- we use the Eclipse compiler as it doesn't need a JDK -->
|
||||
- <compilerId>eclipse</compilerId>
|
||||
- <!-- default changed with version 3.11.0 -->
|
||||
- <showWarnings>false</showWarnings>
|
||||
- </configuration>
|
||||
- <dependencies>
|
||||
- <dependency>
|
||||
- <groupId>org.codehaus.plexus</groupId>
|
||||
- <artifactId>plexus-compiler-eclipse</artifactId>
|
||||
- <version>2.13.0</version>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-surefire-plugin</artifactId>
|
||||
- <version>3.1.0</version>
|
||||
- <configuration>
|
||||
- <workingDirectory>${basedir}/target/test-server</workingDirectory>
|
||||
- <excludes>
|
||||
- <exclude>org/bukkit/craftbukkit/inventory/ItemStack*Test.java</exclude>
|
||||
- </excludes>
|
||||
- </configuration>
|
||||
- </plugin>
|
||||
- </plugins>
|
||||
- </build>
|
||||
-
|
||||
- <profiles>
|
||||
- <profile>
|
||||
- <id>shadeSourcesJar</id>
|
||||
- <properties>
|
||||
- <shadeSourcesJar>true</shadeSourcesJar>
|
||||
- <shadeSourcesContent>true</shadeSourcesContent>
|
||||
- </properties>
|
||||
- </profile>
|
||||
- <profile>
|
||||
- <id>development</id>
|
||||
- <properties>
|
||||
- <skipTests>false</skipTests>
|
||||
- </properties>
|
||||
- <build>
|
||||
- <plugins>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-checkstyle-plugin</artifactId>
|
||||
- <version>3.3.0</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>test-compile</phase>
|
||||
- <goals>
|
||||
- <goal>check</goal>
|
||||
- </goals>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- <configuration>
|
||||
- <configLocation>checkstyle.xml</configLocation>
|
||||
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
- </configuration>
|
||||
- <dependencies>
|
||||
- <dependency>
|
||||
- <groupId>com.puppycrawl.tools</groupId>
|
||||
- <artifactId>checkstyle</artifactId>
|
||||
- <version>8.45.1</version>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
- </plugin>
|
||||
- </plugins>
|
||||
- </build>
|
||||
- </profile>
|
||||
- <profile>
|
||||
- <id>remapped</id>
|
||||
- <build>
|
||||
- <plugins>
|
||||
- <plugin>
|
||||
- <groupId>net.md-5</groupId>
|
||||
- <artifactId>specialsource-maven-plugin</artifactId>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>verify</phase>
|
||||
- <goals>
|
||||
- <goal>remap</goal>
|
||||
- </goals>
|
||||
- <id>remap-obf</id>
|
||||
- <configuration>
|
||||
- <useProjectDependencies>false</useProjectDependencies>
|
||||
- <srgIn>org.spigotmc:minecraft-server:${project.version}:csrg:maps-spigot</srgIn>
|
||||
- <reverse>true</reverse>
|
||||
- <remappedArtifactAttached>true</remappedArtifactAttached>
|
||||
- <remappedClassifierName>remapped-obf</remappedClassifierName>
|
||||
- </configuration>
|
||||
- </execution>
|
||||
- <execution>
|
||||
- <phase>verify</phase>
|
||||
- <goals>
|
||||
- <goal>remap</goal>
|
||||
- </goals>
|
||||
- <id>remap-mojang</id>
|
||||
- <configuration>
|
||||
- <useProjectDependencies>false</useProjectDependencies>
|
||||
- <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
||||
- <srgIn>org.spigotmc:minecraft-server:${project.version}:txt:maps-mojang</srgIn>
|
||||
- <remappedArtifactAttached>true</remappedArtifactAttached>
|
||||
- <remappedClassifierName>remapped-mojang</remappedClassifierName>
|
||||
- </configuration>
|
||||
- </execution>
|
||||
- </executions>
|
||||
- </plugin>
|
||||
- </plugins>
|
||||
- </build>
|
||||
- </profile>
|
||||
- </profiles>
|
||||
-</project>
|
226
patches/server/0002-Remap-fixes.patch
Normal file
226
patches/server/0002-Remap-fixes.patch
Normal file
|
@ -0,0 +1,226 @@
|
|||
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] Remap fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
index ad3035da44c6af2fa7cc53926f33526a43740313..e89fa618fa20e3e843d8de81629e6dc551777823 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||||
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
@@ -278,9 +278,11 @@ public class BlockPos extends Vec3i {
|
||||
|
||||
public static Iterable<BlockPos> withinManhattan(BlockPos center, int rangeX, int rangeY, int rangeZ) {
|
||||
int i = rangeX + rangeY + rangeZ;
|
||||
- int j = center.getX();
|
||||
- int k = center.getY();
|
||||
- int l = center.getZ();
|
||||
+ // Paper start - rename variables to fix conflict with anonymous class (remap fix)
|
||||
+ int centerX = center.getX();
|
||||
+ int centerY = center.getY();
|
||||
+ int centerZ = center.getZ();
|
||||
+ // Paper end
|
||||
return () -> {
|
||||
return new AbstractIterator<BlockPos>() {
|
||||
private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
|
||||
@@ -295,7 +297,7 @@ public class BlockPos extends Vec3i {
|
||||
protected BlockPos computeNext() {
|
||||
if (this.zMirror) {
|
||||
this.zMirror = false;
|
||||
- this.cursor.setZ(l - (this.cursor.getZ() - l));
|
||||
+ this.cursor.setZ(centerZ - (this.cursor.getZ() - centerZ)); // Paper - remap fix
|
||||
return this.cursor;
|
||||
} else {
|
||||
BlockPos blockPos;
|
||||
@@ -321,7 +323,7 @@ public class BlockPos extends Vec3i {
|
||||
int k = this.currentDepth - Math.abs(i) - Math.abs(j);
|
||||
if (k <= rangeZ) {
|
||||
this.zMirror = k != 0;
|
||||
- blockPos = this.cursor.set(j + i, k + j, l + k);
|
||||
+ blockPos = this.cursor.set(centerX + i, centerY + j, centerZ + k); // Paper - remap fix
|
||||
}
|
||||
}
|
||||
|
||||
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 1915b138ea89790ef8b7456b7fddcbd5d97e5444..ba9f6d288d8773f275e35a9513f7f59ad3f666c0 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
|
||||
@@ -173,11 +173,11 @@ public class BehaviorUtils {
|
||||
|
||||
return optional.map((uuid) -> {
|
||||
return ((ServerLevel) entity.level()).getEntity(uuid);
|
||||
- }).map((entity) -> {
|
||||
+ }).map((entity1) -> { // Paper - remap fix
|
||||
LivingEntity entityliving1;
|
||||
|
||||
- if (entity instanceof LivingEntity) {
|
||||
- LivingEntity entityliving2 = (LivingEntity) entity;
|
||||
+ if (entity1 instanceof LivingEntity) { // Paper - remap fix
|
||||
+ LivingEntity entityliving2 = (LivingEntity) entity1; // Paper - remap fix
|
||||
|
||||
entityliving1 = entityliving2;
|
||||
} else {
|
||||
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 17c42cfcec69385f0b65e2d42d735e8b8f6e7b04..04adc10f24f96804a5cb14e884224bb672360464 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
@@ -193,7 +193,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||
Builder<ResourceLocation, RecipeHolder<?>> builder = ImmutableMap.builder();
|
||||
|
||||
recipes.forEach((recipeholder) -> {
|
||||
- Map<ResourceLocation, RecipeHolder<?>> map1 = (Map) map.computeIfAbsent(recipeholder.value().getType(), (recipes) -> {
|
||||
+ Map<ResourceLocation, RecipeHolder<?>> map1 = (Map) map.computeIfAbsent(recipeholder.value().getType(), (recipes_) -> { // Paper - remap fix
|
||||
return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
|
||||
});
|
||||
ResourceLocation minecraftkey = recipeholder.id();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
index 95a5ce711150c4c999a9d17f28a497f034638610..214215d203892b8009595539f25ce26e8752debd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
@@ -251,8 +251,8 @@ public class LootTable {
|
||||
|
||||
public static class Builder implements FunctionUserBuilder<LootTable.Builder> {
|
||||
|
||||
- private final Builder<LootPool> pools = ImmutableList.builder();
|
||||
- private final Builder<LootItemFunction> functions = ImmutableList.builder();
|
||||
+ private final ImmutableList.Builder<LootPool> pools = ImmutableList.builder();
|
||||
+ private final ImmutableList.Builder<LootItemFunction> functions = ImmutableList.builder();
|
||||
private LootContextParamSet paramSet;
|
||||
private Optional<ResourceLocation> randomSequence;
|
||||
|
||||
diff --git a/src/test/java/org/bukkit/DyeColorsTest.java b/src/test/java/org/bukkit/DyeColorsTest.java
|
||||
index b70450722da13bc4d358a70d3d1d2f30a2cca2b9..86d86c292bdeeb7f42685691287c3b4bd476ea14 100644
|
||||
--- a/src/test/java/org/bukkit/DyeColorsTest.java
|
||||
+++ b/src/test/java/org/bukkit/DyeColorsTest.java
|
||||
@@ -3,7 +3,6 @@ package org.bukkit;
|
||||
import static org.bukkit.support.MatcherAssert.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
-import net.minecraft.world.item.DyeColor;
|
||||
import org.bukkit.support.AbstractTestingBase;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
@@ -14,7 +13,7 @@ public class DyeColorsTest extends AbstractTestingBase {
|
||||
@EnumSource(DyeColor.class)
|
||||
public void checkColor(DyeColor dye) {
|
||||
Color color = dye.getColor();
|
||||
- float[] nmsColorArray = DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors();
|
||||
+ float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix
|
||||
Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255));
|
||||
assertThat(color, is(nmsColor));
|
||||
}
|
||||
@@ -23,7 +22,7 @@ public class DyeColorsTest extends AbstractTestingBase {
|
||||
@EnumSource(org.bukkit.DyeColor.class)
|
||||
public void checkFireworkColor(org.bukkit.DyeColor dye) {
|
||||
Color color = dye.getFireworkColor();
|
||||
- int nmsColor = DyeColor.byId(dye.getWoolData()).getFireworkColor();
|
||||
+ int nmsColor = net.minecraft.world.item.DyeColor.byId(dye.getWoolData()).getFireworkColor(); // Paper - remap fix
|
||||
assertThat(color, is(Color.fromRGB(nmsColor)));
|
||||
}
|
||||
}
|
||||
diff --git a/src/test/java/org/bukkit/ParticleTest.java b/src/test/java/org/bukkit/ParticleTest.java
|
||||
index 1edc58410316eaf45858db56897179587e8b22ee..cf6f34e506570e7bb9624c5899fbcdd762d8e0c4 100644
|
||||
--- a/src/test/java/org/bukkit/ParticleTest.java
|
||||
+++ b/src/test/java/org/bukkit/ParticleTest.java
|
||||
@@ -231,7 +231,7 @@ public class ParticleTest extends AbstractTestingBase {
|
||||
Check in CraftParticle if the conversion is still correct.
|
||||
""", bukkit.getKey()));
|
||||
|
||||
- DataResult<Tag> encoded = assertDoesNotThrow(() -> minecraft.codec().encodeStart(DynamicOpsNBT.INSTANCE, particleParam),
|
||||
+ DataResult<Tag> encoded = assertDoesNotThrow(() -> minecraft.codec().encodeStart(NbtOps.INSTANCE, particleParam), // Paper - remap fix
|
||||
String.format("""
|
||||
Could not encoded particle param for particle %s.
|
||||
This can indicated, that the wrong particle param is created in CraftParticle.
|
||||
diff --git a/src/test/java/org/bukkit/RegistryConstantsTest.java b/src/test/java/org/bukkit/RegistryConstantsTest.java
|
||||
index 6be404dafe1f0ae5ab39a0782e4c3ca7c0923752..545a329a52be0dc1f3cf8ca1315152d8b4a465dd 100644
|
||||
--- a/src/test/java/org/bukkit/RegistryConstantsTest.java
|
||||
+++ b/src/test/java/org/bukkit/RegistryConstantsTest.java
|
||||
@@ -19,17 +19,17 @@ public class RegistryConstantsTest extends AbstractTestingBase {
|
||||
|
||||
@Test
|
||||
public void testTrimMaterial() {
|
||||
- this.testExcessConstants(TrimMaterial.class, Registry.TRIM_MATERIAL);
|
||||
+ this.testExcessConstants(TrimMaterial.class, org.bukkit.Registry.TRIM_MATERIAL); // Paper - remap fix
|
||||
this.testMissingConstants(TrimMaterial.class, Registries.TRIM_MATERIAL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrimPattern() {
|
||||
- this.testExcessConstants(TrimPattern.class, Registry.TRIM_PATTERN);
|
||||
+ this.testExcessConstants(TrimPattern.class, org.bukkit.Registry.TRIM_PATTERN); // Paper - remap fix
|
||||
this.testMissingConstants(TrimPattern.class, Registries.TRIM_PATTERN);
|
||||
}
|
||||
|
||||
- private <T extends Keyed> void testExcessConstants(Class<T> clazz, Registry<T> registry) {
|
||||
+ private <T extends Keyed> void testExcessConstants(Class<T> clazz, org.bukkit.Registry<T> registry) { // Paper - remap fix
|
||||
List<NamespacedKey> excessKeys = new ArrayList<>();
|
||||
|
||||
for (Field field : clazz.getFields()) {
|
||||
diff --git a/src/test/java/org/bukkit/RegistryLoadOrderTest.java b/src/test/java/org/bukkit/RegistryLoadOrderTest.java
|
||||
index e4298c14eb793743081cb0088427bb5a50d74b46..194ff80040eec0427acfef644cd85666370902fa 100644
|
||||
--- a/src/test/java/org/bukkit/RegistryLoadOrderTest.java
|
||||
+++ b/src/test/java/org/bukkit/RegistryLoadOrderTest.java
|
||||
@@ -20,7 +20,7 @@ public class RegistryLoadOrderTest extends AbstractTestingBase {
|
||||
|
||||
private static boolean initInterface = false;
|
||||
private static boolean initAbstract = false;
|
||||
- private static Registry<Keyed> registry;
|
||||
+ private static org.bukkit.Registry<Keyed> registry; // Paper - remap fix
|
||||
|
||||
public static Stream<Arguments> data() {
|
||||
return Stream.of(
|
||||
diff --git a/src/test/java/org/bukkit/entity/EntityTypesTest.java b/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
||||
index 32df0090aab65b551b524603cce0b96e461cc358..952924abae79cc504342bbdb6f6953ab8a6cc295 100644
|
||||
--- a/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
||||
+++ b/src/test/java/org/bukkit/entity/EntityTypesTest.java
|
||||
@@ -6,7 +6,6 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
-import net.minecraft.world.entity.EntityType;
|
||||
import org.bukkit.support.AbstractTestingBase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -16,8 +15,8 @@ public class EntityTypesTest extends AbstractTestingBase {
|
||||
public void testMaps() {
|
||||
Set<EntityType> allBukkit = Arrays.stream(EntityType.values()).filter((b) -> b.getName() != null).collect(Collectors.toSet());
|
||||
|
||||
- for (EntityType<?> nms : BuiltInRegistries.ENTITY_TYPE) {
|
||||
- ResourceLocation key = EntityType.getKey(nms);
|
||||
+ for (net.minecraft.world.entity.EntityType<?> nms : BuiltInRegistries.ENTITY_TYPE) { // Paper - remap fix
|
||||
+ ResourceLocation key = net.minecraft.world.entity.EntityType.getKey(nms); // Paper - remap fix
|
||||
|
||||
org.bukkit.entity.EntityType bukkit = org.bukkit.entity.EntityType.fromName(key.getPath());
|
||||
assertNotNull(bukkit, "Missing nms->bukkit " + key);
|
||||
diff --git a/src/test/java/org/bukkit/entity/PandaGeneTest.java b/src/test/java/org/bukkit/entity/PandaGeneTest.java
|
||||
index 5818bfa69a8573a2a8f350066f829d587cbc546b..8e421a1bee0c526e3024eab9ba4cc0b320842de2 100644
|
||||
--- a/src/test/java/org/bukkit/entity/PandaGeneTest.java
|
||||
+++ b/src/test/java/org/bukkit/entity/PandaGeneTest.java
|
||||
@@ -2,7 +2,6 @@ package org.bukkit.entity;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
-import net.minecraft.world.entity.animal.Panda;
|
||||
import org.bukkit.craftbukkit.entity.CraftPanda;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -10,8 +9,8 @@ public class PandaGeneTest {
|
||||
|
||||
@Test
|
||||
public void testBukkit() {
|
||||
- for (Panda.Gene gene : Panda.Gene.values()) {
|
||||
- Panda.Gene nms = CraftPanda.toNms(gene);
|
||||
+ for (Panda.Gene gene : Panda.Gene.values()) { // Paper - remap fix
|
||||
+ net.minecraft.world.entity.animal.Panda.Gene nms = CraftPanda.toNms(gene); // Paper - remap fix
|
||||
|
||||
assertNotNull(nms, "NMS gene null for " + gene);
|
||||
assertEquals(gene.isRecessive(), nms.isRecessive(), "Recessive status did not match " + gene);
|
||||
@@ -21,7 +20,7 @@ public class PandaGeneTest {
|
||||
|
||||
@Test
|
||||
public void testNMS() {
|
||||
- for (Panda.Gene gene : Panda.Gene.values()) {
|
||||
+ for (net.minecraft.world.entity.animal.Panda.Gene gene : net.minecraft.world.entity.animal.Panda.Gene.values()) { // Paper - remap fix
|
||||
org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene);
|
||||
|
||||
assertNotNull(bukkit, "Bukkit gene null for " + gene);
|
167
patches/server/0003-Build-system-changes.patch
Normal file
167
patches/server/0003-Build-system-changes.patch
Normal file
|
@ -0,0 +1,167 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 20:40:33 -0600
|
||||
Subject: [PATCH] Build system changes
|
||||
|
||||
== AT ==
|
||||
public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/net/URI;)Ljava/nio/file/Path;
|
||||
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 3be7f53046d821d6777481b92b3aa6e3df51ed8f..ff4d0f970990187e9b46324b5cf051fcc546119f 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -9,10 +9,9 @@ plugins {
|
||||
dependencies {
|
||||
implementation(project(":paper-api"))
|
||||
implementation("jline:jline:2.12.1")
|
||||
- implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") {
|
||||
- exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
||||
- }
|
||||
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
|
||||
implementation("org.ow2.asm:asm:9.5")
|
||||
+ implementation("org.ow2.asm:asm-commons:9.5") // Paper - ASM event executor generation
|
||||
implementation("commons-lang:commons-lang:2.6")
|
||||
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
|
||||
runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
|
||||
@@ -35,6 +34,7 @@ tasks.jar {
|
||||
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
|
||||
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
||||
+ val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
@@ -43,6 +43,9 @@ tasks.jar {
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
"Specification-Vendor" to "Bukkit Team",
|
||||
+ "Git-Branch" to gitBranch, // Paper
|
||||
+ "Git-Commit" to gitHash, // Paper
|
||||
+ "CraftBukkit-Package-Version" to craftbukkitPackageVersion, // Paper
|
||||
)
|
||||
for (tld in setOf("net", "com", "org")) {
|
||||
attributes("$tld/bukkit", "Sealed" to true)
|
||||
@@ -50,6 +53,11 @@ tasks.jar {
|
||||
}
|
||||
}
|
||||
|
||||
+tasks.compileJava {
|
||||
+ // incremental compilation is currently broken due to patched files having compiled counterparts already on the compile classpath
|
||||
+ options.setIncremental(false)
|
||||
+}
|
||||
+
|
||||
publishing {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
artifact(tasks.shadowJar)
|
||||
@@ -76,6 +84,17 @@ tasks.shadowJar {
|
||||
}
|
||||
}
|
||||
|
||||
+// Paper start
|
||||
+val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
|
||||
+ badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
|
||||
+ jarToScan.set(tasks.shadowJar.flatMap { it.archiveFile })
|
||||
+ classpath.from(configurations.compileClasspath)
|
||||
+}
|
||||
+tasks.check {
|
||||
+ dependsOn(scanJar)
|
||||
+}
|
||||
+// Paper end
|
||||
+
|
||||
tasks.test {
|
||||
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
|
||||
useJUnitPlatform()
|
||||
@@ -134,7 +153,14 @@ tasks.registerRunTask("runReobf") {
|
||||
classpath(runtimeClasspathWithoutVanillaServer)
|
||||
}
|
||||
|
||||
+val runtimeClasspathForRunDev = sourceSets.main.flatMap { src ->
|
||||
+ src.runtimeClasspath.elements.map { elements ->
|
||||
+ elements.filterNot { file -> file.asFile.endsWith("minecraft.jar") }
|
||||
+ }
|
||||
+}
|
||||
tasks.registerRunTask("runDev") {
|
||||
description = "Spin up a non-relocated Mojang-mapped test server"
|
||||
- classpath(sourceSets.main.map { it.runtimeClasspath })
|
||||
+ classpath(tasks.filterProjectDir.flatMap { it.outputJar })
|
||||
+ classpath(runtimeClasspathForRunDev)
|
||||
+ jvmArgs("-DPaper.isRunDev=true")
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java
|
||||
index 68e3d54c79924d72b22eb3bc142ff47aa1700895..d3300e43523429fdd0e61c5aa9aed2e6bc78e07e 100644
|
||||
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java
|
||||
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
|
||||
@@ -26,6 +26,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
|
||||
public static final char NAMESPACE_SEPARATOR = ':';
|
||||
public static final String DEFAULT_NAMESPACE = "minecraft";
|
||||
public static final String REALMS_NAMESPACE = "realms";
|
||||
+ public static final String PAPER_NAMESPACE = "paper"; // Paper
|
||||
private final String namespace;
|
||||
private final String path;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 602964d92ddf9e4ec47ed3cb45787fdd061a881e..6b0a1ff870e013a83f7922021ab296bb1c716079 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -105,6 +105,17 @@ public class Main {
|
||||
*/ // CraftBukkit end
|
||||
|
||||
try {
|
||||
+ // Paper start
|
||||
+ if (Boolean.getBoolean("Paper.isRunDev")) {
|
||||
+ net.minecraft.server.packs.VanillaPackResourcesBuilder.developmentConfig = builder -> {
|
||||
+ try {
|
||||
+ builder.pushAssetPath(net.minecraft.server.packs.PackType.SERVER_DATA, net.minecraft.server.packs.VanillaPackResourcesBuilder.safeGetPath(java.util.Objects.requireNonNull(Main.class.getResource("/data/.paperassetsroot"), "Missing required .paperassetsroot file").toURI()).getParent());
|
||||
+ } catch (java.net.URISyntaxException | IOException ex) {
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
|
||||
index a2a8bce29ec5540de89095574dfdc0ca9b17bbd3..d92cd89373f8373c367ce422328b9836de09096d 100644
|
||||
--- a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
|
||||
+++ b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java
|
||||
@@ -32,7 +32,7 @@ public class ServerPacksSource extends BuiltInPackSource {
|
||||
|
||||
@VisibleForTesting
|
||||
public static VanillaPackResources createVanillaPackSource() {
|
||||
- return (new VanillaPackResourcesBuilder()).setMetadata(BUILT_IN_METADATA).exposeNamespace("minecraft").applyDevelopmentConfig().pushJarResources().build();
|
||||
+ return (new VanillaPackResourcesBuilder()).setMetadata(BUILT_IN_METADATA).exposeNamespace("minecraft", ResourceLocation.PAPER_NAMESPACE).applyDevelopmentConfig().pushJarResources().build(); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index d837882f91dcc684873010ba2d93ffe035d89c57..16cee5f32f980d91a6a616a2cd47016b80f2146e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -209,7 +209,7 @@ public class Main {
|
||||
}
|
||||
|
||||
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
||||
- Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L);
|
||||
+ 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, -3);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 93046379d0cefd5d3236fc59e698809acdc18f80..774556a62eb240da42e84db4502e2ed43495be17 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.spigotmc/spigot-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
diff --git a/src/main/resources/data/.paperassetsroot b/src/main/resources/data/.paperassetsroot
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
119
patches/server/0004-Test-changes.patch
Normal file
119
patches/server/0004-Test-changes.patch
Normal file
|
@ -0,0 +1,119 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 13 Feb 2023 14:14:56 -0800
|
||||
Subject: [PATCH] Test changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index ff4d0f970990187e9b46324b5cf051fcc546119f..844eff88c9ad95871900c2d8aa3136b3f2928bf9 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -58,6 +58,12 @@ tasks.compileJava {
|
||||
options.setIncremental(false)
|
||||
}
|
||||
|
||||
+// Paper start - compile tests with -parameters for better junit parameterized test names
|
||||
+tasks.compileTestJava {
|
||||
+ options.compilerArgs.add("-parameters")
|
||||
+}
|
||||
+// Paper end
|
||||
+
|
||||
publishing {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
artifact(tasks.shadowJar)
|
||||
diff --git a/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e070aa1bb69859224493d958621389ee757f8752
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import java.util.Optional;
|
||||
+import java.util.stream.Stream;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.resources.ResourceKey;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import org.bukkit.support.AbstractTestingBase;
|
||||
+import org.junit.jupiter.api.BeforeAll;
|
||||
+import org.junit.jupiter.params.ParameterizedTest;
|
||||
+import org.junit.jupiter.params.provider.MethodSource;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
+
|
||||
+class RegistryKeyTest extends AbstractTestingBase {
|
||||
+
|
||||
+ @BeforeAll
|
||||
+ static void before() throws ClassNotFoundException {
|
||||
+ Class.forName(RegistryKey.class.getName()); // load all keys so they are found for the test
|
||||
+ }
|
||||
+
|
||||
+ static Stream<RegistryKey<?>> data() {
|
||||
+ return RegistryKeyImpl.REGISTRY_KEYS.stream();
|
||||
+ }
|
||||
+
|
||||
+ @ParameterizedTest
|
||||
+ @MethodSource("data")
|
||||
+ void testApiRegistryKeysExist(final RegistryKey<?> key) {
|
||||
+ final Optional<Registry<Object>> registry = AbstractTestingBase.REGISTRY_CUSTOM.registry(ResourceKey.createRegistryKey(new ResourceLocation(key.key().asString())));
|
||||
+ assertTrue(registry.isPresent(), "Missing vanilla registry for " + key.key().asString());
|
||||
+
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/io/papermc/paper/util/EmptyTag.java b/src/test/java/io/papermc/paper/util/EmptyTag.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6eb95a5e2534974c0e52e2b78b04e7c2b2f28525
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/util/EmptyTag.java
|
||||
@@ -0,0 +1,31 @@
|
||||
+package io.papermc.paper.util;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+import java.util.Set;
|
||||
+import org.bukkit.Keyed;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.Tag;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public record EmptyTag(NamespacedKey key) implements Tag<Keyed> {
|
||||
+
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ public EmptyTag() {
|
||||
+ this(NamespacedKey.randomKey());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull NamespacedKey getKey() {
|
||||
+ return this.key;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isTagged(@NotNull final Keyed item) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Set<Keyed> getValues() {
|
||||
+ return Collections.emptySet();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
||||
index d96efc9aa90debcca5f237c949ba11b10070223a..d1253a07a90aa4cc29d0140795203a71118c827a 100644
|
||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
||||
@@ -38,6 +38,15 @@ public final class DummyServer {
|
||||
|
||||
when(instance.getRegistry(any())).then(mock -> CraftRegistry.createRegistry(mock.getArgument(0), AbstractTestingBase.REGISTRY_CUSTOM));
|
||||
|
||||
+ // Paper start - testing additions
|
||||
+ final Thread currentThread = Thread.currentThread();
|
||||
+ when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
|
||||
+
|
||||
+ final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
||||
+ when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||
+ when(instance.getTag(anyString(), any(org.bukkit.NamespacedKey.class), any())).thenAnswer(ignored -> new io.papermc.paper.util.EmptyTag());
|
||||
+ // paper end - testing additions
|
||||
+
|
||||
Bukkit.setServer(instance);
|
||||
} catch (Throwable t) {
|
||||
throw new Error(t);
|
5066
patches/server/0005-Paper-config-files.patch
Normal file
5066
patches/server/0005-Paper-config-files.patch
Normal file
File diff suppressed because it is too large
Load diff
246
patches/server/0006-MC-Dev-fixes.patch
Normal file
246
patches/server/0006-MC-Dev-fixes.patch
Normal file
File diff suppressed because one or more lines are too long
7018
patches/server/0007-ConcurrentUtil.patch
Normal file
7018
patches/server/0007-ConcurrentUtil.patch
Normal file
File diff suppressed because it is too large
Load diff
129
patches/server/0008-CB-fixes.patch
Normal file
129
patches/server/0008-CB-fixes.patch
Normal file
|
@ -0,0 +1,129 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 25 Feb 2022 07:14:48 -0800
|
||||
Subject: [PATCH] CB fixes
|
||||
|
||||
* Missing Level -> LevelStem generic in StructureCheck
|
||||
Need to use the right for injectDatafixingContext (Spottedleaf)
|
||||
|
||||
* Removed incorrect parent perm for `minecraft.debugstick.always` (Machine_Maker)
|
||||
|
||||
* Fixed method signature of Marker#addPassenger (Machine_Maker)
|
||||
|
||||
* Removed unneeded UOE in CustomWorldChunkManager (extends BiomeSource) (Machine_Maker)
|
||||
|
||||
* Honor Server#getLootTable method contract (Machine_Maker)
|
||||
|
||||
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 659d2d5cab4b953c21f560b65b37d9586d9a1c01..9e2b67993ff7d263576d9579885ec1eaea6144df 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -296,7 +296,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
long l = minecraftserver.getWorldData().worldGenOptions().seed();
|
||||
|
||||
- this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
|
||||
+ this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), this.getTypeKey(), chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer); // Paper - Fix missing CB diff
|
||||
this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), this.structureCheck); // CraftBukkit
|
||||
if ((this.dimension() == Level.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) || env == org.bukkit.World.Environment.THE_END) { // CraftBukkit - Allow to create EnderDragonBattle in default and custom END
|
||||
this.dragonFight = new EndDragonFight(this, this.serverLevelData.worldGenOptions().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
index 869f60e9407ed1c5bee536ef91a21f4d11f8f964..3aa98f7c282cb4884589cb83b1546b924e66f096 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
@@ -445,9 +445,9 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void actuallyHurt(DamageSource source, float amount) {
|
||||
+ protected boolean damageEntity0(DamageSource source, float amount) { // Paper - fix CB method rename issue
|
||||
this.standUpInstantly();
|
||||
- super.actuallyHurt(source, amount);
|
||||
+ return super.damageEntity0(source, amount); // Paper - fix CB method rename issue
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
|
||||
index 161ad6ab1443b2ce33a2d7d91d189c855db0453b..15a9736a870055d639d03063c7cf67fd769fff36 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java
|
||||
@@ -43,7 +43,7 @@ public class StructureCheck {
|
||||
private final Registry<Biome> biomes;
|
||||
private final Registry<Structure> structureConfigs;
|
||||
private final StructureTemplateManager structureTemplateManager;
|
||||
- private final ResourceKey<Level> dimension;
|
||||
+ private final ResourceKey<net.minecraft.world.level.dimension.LevelStem> dimension; // Paper - fix missing CB diff
|
||||
private final ChunkGenerator chunkGenerator;
|
||||
private final RandomState randomState;
|
||||
private final LevelHeightAccessor heightAccessor;
|
||||
@@ -53,7 +53,7 @@ public class StructureCheck {
|
||||
private final Long2ObjectMap<Object2IntMap<Structure>> loadedChunks = new Long2ObjectOpenHashMap<>();
|
||||
private final Map<Structure, Long2BooleanMap> featureChecks = new HashMap<>();
|
||||
|
||||
- public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey<Level> worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) {
|
||||
+ public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey<net.minecraft.world.level.dimension.LevelStem> worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff
|
||||
this.storageAccess = chunkIoWorker;
|
||||
this.registryAccess = registryManager;
|
||||
this.structureTemplateManager = structureTemplateManager;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
||||
index 6ab2fd523b7f4e5cacef4ebb95f6812f391985d1..85133c388eff009ea1ffa391824b6556f7bf2014 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
||||
@@ -174,4 +174,11 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
|
||||
org.bukkit.loot.LootTable table = (org.bukkit.loot.LootTable) obj;
|
||||
return table.getKey().equals(this.getKey());
|
||||
}
|
||||
+
|
||||
+ // Paper start - satisfy equals/hashCode contract
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return java.util.Objects.hash(key);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3a0f31f25f4956248b708ae736b6604d0b957647..ead95ec10f93918215ea88d43aa5ad9e451ec3db 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2454,7 +2454,13 @@ public final class CraftServer implements Server {
|
||||
Preconditions.checkArgument(key != null, "NamespacedKey key cannot be null");
|
||||
|
||||
LootDataManager registry = this.getServer().getLootData();
|
||||
- return new CraftLootTable(key, registry.getLootTable(CraftNamespacedKey.toMinecraft(key)));
|
||||
+ // Paper start - honor method contract
|
||||
+ final ResourceLocation lootTableKey = CraftNamespacedKey.toMinecraft(key);
|
||||
+ if (registry.getLootTable(lootTableKey) == net.minecraft.world.level.storage.loot.LootTable.EMPTY) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ return new CraftLootTable(key, registry.getLootTable(lootTableKey));
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 098b5d68cd910ae95a3512c8921b9465d9446d3b..fc9406f5f85c1f6180dbb666129a264b2baa55a3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -122,6 +122,7 @@ public class Main {
|
||||
|
||||
this.acceptsAll(Main.asList("forceUpgrade"), "Whether to force a world upgrade");
|
||||
this.acceptsAll(Main.asList("eraseCache"), "Whether to force cache erase during world upgrade");
|
||||
+ this.accepts("safeMode", "Loads level with vanilla datapack only"); // Paper
|
||||
this.acceptsAll(Main.asList("nogui"), "Disables the graphical console");
|
||||
|
||||
this.acceptsAll(Main.asList("nojline"), "Disables jline and emulates the vanilla console");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
|
||||
index 5ac25dab93fd4c9e9533c80d1ca3d93446d7a365..245ad120a36b6defca7e6889faae1ca5fc33d0c7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
|
||||
@@ -15,7 +15,7 @@ public final class CraftDefaultPermissions {
|
||||
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".nbt.place", "Gives the user the ability to place restricted blocks with NBT in creative", org.bukkit.permissions.PermissionDefault.OP, parent);
|
||||
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".nbt.copy", "Gives the user the ability to copy NBT in creative", org.bukkit.permissions.PermissionDefault.TRUE, parent);
|
||||
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick", "Gives the user the ability to use the debug stick in creative", org.bukkit.permissions.PermissionDefault.OP, parent);
|
||||
- DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick.always", "Gives the user the ability to use the debug stick in all game modes", org.bukkit.permissions.PermissionDefault.FALSE, parent);
|
||||
+ DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick.always", "Gives the user the ability to use the debug stick in all game modes", org.bukkit.permissions.PermissionDefault.FALSE/* , parent */); // Paper - should not have this parent, as it's not a "vanilla" utility
|
||||
// Spigot end
|
||||
parent.recalculatePermissibles();
|
||||
}
|
8359
patches/server/0009-MC-Utils.patch
Normal file
8359
patches/server/0009-MC-Utils.patch
Normal file
File diff suppressed because it is too large
Load diff
5040
patches/server/0010-Adventure.patch
Normal file
5040
patches/server/0010-Adventure.patch
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue