Skip to content

Commit

Permalink
Merge branch 'PaperMC:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Q2297045667 authored Jul 4, 2024
2 parents 4bf4032 + d797082 commit 8f6f82d
Show file tree
Hide file tree
Showing 24 changed files with 1,778 additions and 1,781 deletions.
12 changes: 5 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import io.papermc.paperweight.tasks.RebuildGitPatches
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.12"
id("io.papermc.paperweight.patcher") version "1.7.1"
}

val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
Expand All @@ -17,8 +16,8 @@ repositories {
}

dependencies {
remapper("net.fabricmc:tiny-remapper:0.10.1:fat")
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
decompiler("org.vineflower:vineflower:1.10.1")
paperclip("io.papermc:paperclip:3.0.3")
}

Expand All @@ -28,15 +27,15 @@ allprojects {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion.set(JavaLanguageVersion.of(21))
}
}
}

subprojects {
tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
options.release.set(21)
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
Expand Down Expand Up @@ -76,7 +75,6 @@ paperweight {

tasks.generateDevelopmentBundle {
apiCoordinates.set("dev.folia:folia-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
group=dev.folia
version=1.20.6-R0.1-SNAPSHOT
mcVersion=1.20.6

version=1.20.4-R0.1-SNAPSHOT
mcVersion=1.20.4
paperRef=5436d44bf2509ff89129f8790ee4643f09c72871
paperRef=e41d44fa873466064879ebed476d280932379a9c

org.gradle.caching=true
org.gradle.parallel=true
Expand Down
4 changes: 2 additions & 2 deletions patches/api/0002-Region-scheduler-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Add both a location based scheduler, an entity based scheduler,
and a global region scheduler.

diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index fc2dae69165776d08274e34a69962cc70445f411..06149045a44148bf0af5f52952ff0092fe2c70cb 100644
index 003bece642b682985625db93cad93026352bfc66..065352b383d6398382b4f14641859dbfe2e6a355 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -544,9 +544,9 @@ public final class SimplePluginManager implements PluginManager {
@@ -557,9 +557,9 @@ public final class SimplePluginManager implements PluginManager {
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ index bcf91d048d84144f6acf9bfd2095df9ada2e585f..3072f95dc1cafb47c1820dc67c8d2499
+
}
diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
index c0691a849831f99268fdcb7b0f471f80a1a2a70e..6f1d3935c2c398571c32e1be9786f74ec911c7bd 100644
index a857e46fa6f0c212db93193e1fdd8b0ea9c33c38..90cd9568363a7532d600b627de605c12a7b816c7 100644
--- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
+++ b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
@@ -259,6 +259,21 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
private Set<PluginAwareness> awareness = ImmutableSet.of();
private String apiVersion = null;
private List<String> libraries = ImmutableList.of();
+
@@ -267,6 +267,19 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
return this.paperPluginLoader;
}
// Paper end - plugin loader api
+ // Folia start - block plugins not marked as supported
+ private String foliaSupported;
+ private static final String FOLIA_SUPPORTED_KEY = "folia-supported";
Expand All @@ -52,11 +51,10 @@ index c0691a849831f99268fdcb7b0f471f80a1a2a70e..6f1d3935c2c398571c32e1be9786f74e
+ return this.foliaSupported != null && this.foliaSupported.equalsIgnoreCase("true");
+ }
+ // Folia end - block plugins not marked as supported
+
// Paper start - oh my goddddd
/**
* Don't use this.
@@ -1242,6 +1257,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
@@ -1267,6 +1280,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
if (map.get("prefix") != null) {
prefix = map.get("prefix").toString();
}
Expand All @@ -68,7 +66,7 @@ index c0691a849831f99268fdcb7b0f471f80a1a2a70e..6f1d3935c2c398571c32e1be9786f74e
}

@NotNull
@@ -1318,6 +1338,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
@@ -1343,6 +1361,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
if (prefix != null) {
map.put("prefix", prefix);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ the schedulers depending on the result of the ownership
check.

diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 9a428153f34291bdc026a71f7e60e285b7794b0c..c37904d1aae749030620e1bbdb955e25c91ab1f8 100644
index 47039514503d99e84cb99f4941707a7726286516..15049641b8123abf03edcbb49257fb4f3db0a5ec 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2879,6 +2879,14 @@ public final class Bukkit {
@@ -2908,6 +2908,14 @@ public final class Bukkit {
return server.isOwnedByCurrentRegion(entity);
}
// Paper end - Folia region threading API
Expand All @@ -30,10 +30,10 @@ index 9a428153f34291bdc026a71f7e60e285b7794b0c..c37904d1aae749030620e1bbdb955e25
@NotNull
public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 4ff1b38eb65f97344257204cf018f176f247ed36..15395ef52505087e7eef3b1a5981e787dcc16508 100644
index 0614bd7e2d658172a7765925adf81b75b5620f11..1f51f80e8516cfac7ed4078ed96e535389a31f25 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2518,4 +2518,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2546,4 +2546,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
// Paper end - Folia region threading API
Expand Down
108 changes: 50 additions & 58 deletions patches/server/0001-Build-changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,38 @@ Subject: [PATCH] Build changes


diff --git a/build.gradle.kts b/build.gradle.kts
index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..12f9f9d46c098c5c88058cb1f73ae39a7d1debd5 100644
index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..eb2f9941b24af591f1e56339b97f5284a765cf81 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating

dependencies {
- implementation(project(":paper-api"))
- implementation(project(":paper-mojangapi"))
+ // Folia start
+ implementation(project(":folia-api"))
+ implementation("io.papermc.paper:paper-mojangapi:${project.version}") {
+ exclude("io.papermc.paper", "paper-api")
+ }
+ // Folia end
+ implementation(project(":folia-api")) // Folia
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -71,7 +75,7 @@ tasks.jar {
@@ -80,14 +80,14 @@ tasks.jar {
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
- "Implementation-Version" to "git-Paper-$implementationVersion",
+ "Implementation-Version" to "git-Folia-$implementationVersion", // Folia
- "Implementation-Title" to "Paper",
+ "Implementation-Title" to "Folia", // Folia
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
- "Specification-Title" to "Paper",
+ "Specification-Title" to "Folia", // Folia
"Specification-Version" to project.version,
@@ -150,7 +154,7 @@ fun TaskContainer.registerRunTask(
"Specification-Vendor" to "Paper Team",
- "Brand-Id" to "papermc:paper",
- "Brand-Name" to "Paper",
+ "Brand-Id" to "papermc:folia", // Folia
+ "Brand-Name" to "Folia", // Folia
"Build-Number" to (build ?: ""),
"Build-Time" to Instant.now().toString(),
"Git-Branch" to gitBranch, // Paper
@@ -144,7 +144,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
Expand Down Expand Up @@ -69,55 +73,43 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..cb60d58d4a7556dd896f31d0cd249f86
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..e2f704c115fd6e00960bb56bb0779f1100c89c17 100644
index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..29bd788ae8bc61c1e62a4f84b9e259931a7041ce 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher {
@Nonnull
@Override
public Component getVersionMessage(@Nonnull String serverVersion) {
- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
+ String[] parts = serverVersion.substring("git-Folia-".length()).split("[-\\s]"); // Folia
+ final Component updateMessage = getUpdateStatusMessage("PaperMC/Folia", GITHUB_BRANCH_NAME, parts[0]); // Folia
final Component history = getHistory();
@@ -49,7 +49,7 @@ public class PaperVersionFetcher implements VersionFetcher {
if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) {
updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
} else {
- updateMessage = getUpdateStatusMessage("PaperMC/Paper", build);
+ updateMessage = getUpdateStatusMessage("PaperMC/Folia", build); // Folia
}
final @Nullable Component history = this.getHistory();

return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
@@ -85,7 +85,7 @@ public class PaperVersionFetcher implements VersionFetcher {
if (siteApiVersion == null) { return -1; }
@@ -86,7 +86,7 @@ public class PaperVersionFetcher implements VersionFetcher {
private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) {
try {
try (BufferedReader reader = Resources.asCharSource(
- new URL("https://api.papermc.io/v2/projects/paper/versions/" + siteApiVersion),
+ new URL("https://api.papermc.io/v2/projects/folia/versions/" + siteApiVersion), // Folia
try (final BufferedReader reader = Resources.asCharSource(
- URI.create("https://api.papermc.io/v2/projects/paper/versions/" + build.minecraftVersionId()).toURL(),
+ URI.create("https://api.papermc.io/v2/projects/folia/versions/" + build.minecraftVersionId()).toURL(), // Folia
Charsets.UTF_8
).openBufferedStream()) {
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c8772c773f9933ed1d1debfe707af4373c458152..50055e362a0de853c169a38c6cbd8681b73fc96d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1865,7 +1865,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

@DontObfuscate
public String getServerModName() {
- return "Paper"; // Paper
+ return "Folia"; // Paper // Folia - Folia
}

public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c490a29bcf7410bc54959ee71375605964379ed5..b63effd92be5a8a75db6c37e5a1b91541020ec75 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper

public final class CraftServer implements Server {
- private final String serverName = "Paper"; // Paper
+ private final String serverName = "Folia"; // Folia // Paper
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
final JsonObject json = new Gson().fromJson(reader, JsonObject.class);
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index 790bad0494454ca12ee152e3de6da3da634d9b20..e741201fdbea0dbbc0e42313ebd33368014c9dc4 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -42,9 +42,9 @@ public record ServerBuildInfoImpl(
this(
getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID)
.map(Key::key)
- .orElse(BRAND_PAPER_ID),
+ .orElse(Key.key("papermc", "folia")), // Folia
getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME)
- .orElse(BRAND_PAPER_NAME),
+ .orElse("Folia"), // Folia
SharedConstants.getCurrentVersion().getId(),
SharedConstants.getCurrentVersion().getName(),
getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER)
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 774556a62eb240da42e84db4502e2ed43495be17..e9b6ca3aa25e140467ae866d572483050ea3fa0e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
Expand Down
52 changes: 23 additions & 29 deletions patches/server/0002-MC-Dev-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,32 @@ Subject: [PATCH] MC-Dev fixes


diff --git a/src/main/java/net/minecraft/world/entity/ai/Brain.java b/src/main/java/net/minecraft/world/entity/ai/Brain.java
index dea20f16ac97402f754c8e47d03e9ef38de73190..21e5d1451f90194aa415cf0a183d1a731854f605 100644
index afbb027021acfbe25d534a84f1750e420bbde6e0..af6f91c66e9cc7e0d491e6efed992a140947155e 100644
--- a/src/main/java/net/minecraft/world/entity/ai/Brain.java
+++ b/src/main/java/net/minecraft/world/entity/ai/Brain.java
@@ -72,15 +72,15 @@ public class Brain<E extends LivingEntity> {
}
@@ -79,7 +79,7 @@ public class Brain<E extends LivingEntity> {
}

public <T> DataResult<Brain<E>> decode(DynamicOps<T> dynamicOps, MapLike<T> mapLike) {
- MutableObject<DataResult<ImmutableList.Builder<Brain.MemoryValue<?>>>> mutableObject = new MutableObject<>(DataResult.success(ImmutableList.builder()));
+ MutableObject<DataResult<ImmutableList.Builder<Brain.MemoryValue<?>>>> mutableObject2 = new MutableObject<>(DataResult.success(ImmutableList.builder())); // Folia - decompile fix
mapLike.entries().forEach((pair) -> {
DataResult<MemoryModuleType<?>> dataResult = BuiltInRegistries.MEMORY_MODULE_TYPE.byNameCodec().parse(dynamicOps, pair.getFirst());
DataResult<? extends Brain.MemoryValue<?>> dataResult2 = dataResult.flatMap((memoryType) -> {
return this.captureRead(memoryType, dynamicOps, (T)pair.getSecond());
});
- mutableObject.setValue(mutableObject.getValue().apply2(ImmutableList.Builder::add, dataResult2));
+ mutableObject2.setValue(mutableObject2.getValue().apply2(ImmutableList.Builder::add, dataResult2)); // Folia - decompile fix
});
- ImmutableList<Brain.MemoryValue<?>> immutableList = mutableObject.getValue().resultOrPartial(Brain.LOGGER::error).map(ImmutableList.Builder::build).orElseGet(ImmutableList::of);
+ ImmutableList<Brain.MemoryValue<?>> immutableList = mutableObject2.getValue().resultOrPartial(Brain.LOGGER::error).map(ImmutableList.Builder::build).orElseGet(ImmutableList::of); // Folia - decompile fix
return DataResult.success(new Brain<>(memoryModules, sensors, immutableList, mutableObject::getValue));
}

@@ -181,14 +181,14 @@ public class Brain<E extends LivingEntity> {
public <T> DataResult<Brain<E>> decode(DynamicOps<T> dynamicOps, MapLike<T> mapLike) {
- MutableObject<DataResult<Builder<Brain.MemoryValue<?>>>> mutableObject = new MutableObject<>(
+ MutableObject<DataResult<Builder<Brain.MemoryValue<?>>>> mutableObject2 = new MutableObject<>( // Folia - decompile fix
DataResult.success(ImmutableList.builder())
);
mapLike.entries()
@@ -91,10 +91,10 @@ public class Brain<E extends LivingEntity> {
DataResult<? extends Brain.MemoryValue<?>> dataResult2 = dataResult.flatMap(
memoryType -> this.captureRead((MemoryModuleType<T>)memoryType, dynamicOps, (T)pair.getSecond())
);
- mutableObject.setValue(mutableObject.getValue().apply2(Builder::add, dataResult2));
+ mutableObject2.setValue(mutableObject2.getValue().apply2(Builder::add, dataResult2)); // Folia - decompile fix
}
);
- ImmutableList<Brain.MemoryValue<?>> immutableList = mutableObject.getValue()
+ ImmutableList<Brain.MemoryValue<?>> immutableList = mutableObject2.getValue() // Folia - decompile fix
.resultOrPartial(Brain.LOGGER::error)
.map(Builder::build)
.orElseGet(ImmutableList::of);
@@ -194,14 +194,14 @@ public class Brain<E extends LivingEntity> {
if (optional == null) {
throw new IllegalStateException("Unregistered memory fetched: " + type);
} else {
Expand All @@ -44,12 +47,3 @@ index dea20f16ac97402f754c8e47d03e9ef38de73190..21e5d1451f90194aa415cf0a183d1a73
}

public <U> long getTimeUntilExpiry(MemoryModuleType<U> type) {
@@ -483,7 +483,7 @@ public class Brain<E extends LivingEntity> {
private final Optional<? extends ExpirableValue<U>> value;

static <U> Brain.MemoryValue<U> createUnchecked(MemoryModuleType<U> type, Optional<? extends ExpirableValue<?>> data) {
- return new Brain.MemoryValue<>(type, data);
+ return new Brain.MemoryValue<>(type, (Optional<? extends ExpirableValue<U>>)data); // Folia - decompile fix
}

MemoryValue(MemoryModuleType<U> type, Optional<? extends ExpirableValue<U>> data) {
Loading

0 comments on commit 8f6f82d

Please sign in to comment.