Skip to content

Commit

Permalink
finish port to hardfork
Browse files Browse the repository at this point in the history
  • Loading branch information
AltronMaxX committed Jan 16, 2025
1 parent 22b6501 commit 5ecb0f3
Show file tree
Hide file tree
Showing 154 changed files with 4,500 additions and 6,930 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Patch and Build

on:
#push:
#branches: [ "1.21.4" ]
push:
branches: [ "1.21.4" ]
workflow_dispatch:
#workflow_run:
#workflows: ["Automatically update Folia commit"]
Expand Down
36 changes: 25 additions & 11 deletions foldenor-server/build.gradle.kts.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
+++ b/folia-server/build.gradle.kts
@@ -22,6 +_,7 @@
// gitFilePatches = true

val fork = forks.register("folia") {
+ rootDirectory = upstreamsDirectory().map { it.dir("folia") }
upstream.patchDir("paperServer") {
upstreamPath = "paper-server"
excludes = setOf("src/minecraft", "patches", "build.gradle.kts")
@@ -30,7 +_,22 @@
@@ -30,7 +_,24 @@
}
}

Expand All @@ -19,17 +19,19 @@
+ upstreamRepo = fork.patchedRepo("paperServer")
+ patchesDir = rootDirectory.dir("foldenor-server/paper-patches")
+ outputDir = rootDirectory.dir("paper-server")
+ rejectsDir = file("foldenor-server/paper-rejects")
+ }
+ upstream.patchDir("foliaServer") {
+ upstreamPath = "folia-server"
+ excludes = setOf("src/minecraft", "paper-patches", "minecraft-patches", "build.gradle.kts", "build.gradle.kts.patch")
+ patchesDir = rootDirectory.dir("foldenor-server/folia-patches")
+ outputDir = rootDirectory.dir("folia-server")
+ rejectsDir = file("foldenor-server/rejects")
+ }
+ }
+
+ activeFork = foldenor

paper {
paperServerDir = upstreamsDirectory().map { it.dir("paper/paper-server") }
@@ -120,10 +_,14 @@
Expand All @@ -56,23 +58,35 @@
implementation("ca.spottedleaf:concurrentutil:0.0.3")
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
@@ -177,6 +_,11 @@
runtimeOnly("com.mysql:mysql-connector-j:9.1.0")
runtimeOnly("com.lmax:disruptor:3.4.4")

+ // LinearPaper start
+ implementation("com.github.luben:zstd-jni:1.5.6-6")
+ implementation("org.lz4:lz4-java:1.8.0")
+ // LinearPaper end
+
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
@@ -216,14 +_,14 @@
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
- "Implementation-Title" to "Folia", // Folia
+ "Implementation-Title" to "Foldenor", // Folia // Foldenor
- "Implementation-Title" to "Folia",
+ "Implementation-Title" to "Foldenor",
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date,
- "Specification-Title" to "Folia", // Folia
+ "Specification-Title" to "Foldenor", // Folia // Foldenor
- "Specification-Title" to "Folia",
+ "Specification-Title" to "Foldenor",
"Specification-Version" to project.version,
- "Specification-Vendor" to "Paper Team",
- "Brand-Id" to "papermc:folia", // Folia
- "Brand-Name" to "Folia", // Folia
- "Brand-Id" to "papermc:folia",
- "Brand-Name" to "Folia",
+ "Specification-Vendor" to "Edenor",
+ "Brand-Id" to "edenor:foldenor", // Folia // Foldenor
+ "Brand-Name" to "Foldenor", // Folia // Foldenor
+ "Brand-Id" to "edenor:foldenor",
+ "Brand-Name" to "Foldenor",
"Build-Number" to (build ?: ""),
"Build-Time" to buildTime.toString(),
"Git-Branch" to gitBranch,
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java
@@ -8,9 +_,9 @@

public boolean moonrise$doesRegionFileNotExistNoIO(final int chunkX, final int chunkZ);

- public RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ);
+ public com.triassic.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); // LinearPaper

- public RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException;
+ public com.triassic.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; // LinearPaper

public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite(
final int chunkX, final int chunkZ, final CompoundTag compound
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
@@ -1462,7 +_,7 @@

public static interface IORunnable {

- public void run(final RegionFile regionFile) throws IOException;
+ public void run(final com.triassic.linearpaper.region.AbstractRegionFile regionFile) throws IOException; // LinearPaper

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- a/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java
@@ -8,5 +_,5 @@

public void moonrise$setWriteOnClose(final boolean value);

- public void moonrise$write(final RegionFile regionFile) throws IOException;
+ public void moonrise$write(final com.triassic.linearpaper.region.AbstractRegionFile regionFile) throws IOException; // LinearPaper
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- /dev/null
+++ b/com/triassic/linearpaper/region/AbstractRegionFile.java
@@ -1,0 +_,28 @@
+package com.triassic.linearpaper.region;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.file.Path;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.world.level.ChunkPos;
+
+public interface AbstractRegionFile extends AutoCloseable {
+
+ Path getPath();
+ DataInputStream getChunkDataInputStream(ChunkPos pos) throws IOException;
+ DataOutputStream getChunkDataOutputStream(ChunkPos pos) throws IOException;
+ CompoundTag getOversizedData(int x, int z) throws IOException;
+
+ boolean hasChunk(ChunkPos pos);
+ boolean doesChunkExist(ChunkPos pos);
+ boolean isOversized(int x, int z);
+ boolean recalculateHeader() throws IOException;
+
+ void flush() throws IOException;
+ void close() throws IOException;
+ void clear(ChunkPos pos) throws IOException;
+ void setOversized(int x, int z, boolean oversized) throws IOException;
+ void write(ChunkPos pos, ByteBuffer buf) throws IOException;
+}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--- /dev/null
+++ b/com/triassic/linearpaper/region/AbstractRegionFileFactory.java
@@ -1,0 +_,22 @@
+package com.triassic.linearpaper.region;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import net.minecraft.world.level.chunk.storage.RegionFile;
+import net.minecraft.world.level.chunk.storage.RegionFileVersion;
+import net.minecraft.world.level.chunk.storage.RegionStorageInfo;
+
+public class AbstractRegionFileFactory {
+
+ public static AbstractRegionFile getAbstractRegionFile(RegionStorageInfo storageKey, Path directory, Path path, boolean dsync) throws IOException {
+ return getAbstractRegionFile(storageKey, directory, path, RegionFileVersion.getCompressionFormat(), dsync);
+ }
+
+ public static AbstractRegionFile getAbstractRegionFile(RegionStorageInfo storageKey, Path path, Path directory, RegionFileVersion compressionFormat, boolean dsync) throws IOException {
+ if (path.toString().endsWith(".linear")) {
+ return new LinearRegionFile(path, storageKey.linearCompressionLevel());
+ } else {
+ return new RegionFile(storageKey, path, directory, compressionFormat, dsync);
+ }
+ }
+}
Loading

0 comments on commit 5ecb0f3

Please sign in to comment.