Skip to content

Commit

Permalink
easy fork
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed May 7, 2024
1 parent 531a3bb commit 040724b
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 100 deletions.
22 changes: 10 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ allprojects {
repositories {
maven {
name = "githubPackage"
url = uri("https://maven.pkg.github.com/PlazmaMC/PlazmaBukkit")
url = uri("https://maven.pkg.github.com/${property("projectRepo")}")

credentials {
username = System.getenv("GITHUB_USERNAME")
Expand Down Expand Up @@ -85,25 +85,23 @@ subprojects {
mavenCentral()
maven("https://jitpack.io")
maven("https://papermc.io/repo/repository/maven-public/")
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "sonatype-oss-snapshots"
}
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}

paperweight {
serverProject = project(":plazma-server")
serverProject = project(":${property("projectName").toString().lowercase()}-server")

remapRepo = "https://repo.papermc.io/repository/maven-public/"
decompileRepo = "https://repo.papermc.io/repository/maven-public/"

usePaperUpstream(providers.gradleProperty("paperCommit")) {
withPaperPatcher {
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("Plazma-API"))
apiOutputDir.set(layout.projectDirectory.dir("${property("projectName")}-API"))

serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("Plazma-Server"))
serverOutputDir.set(layout.projectDirectory.dir("${property("projectName")}-Server"))
}

patchTasks.register("generatedApi") {
Expand All @@ -117,7 +115,7 @@ paperweight {
isBareDirectory = true
upstreamDirPath = "Paper-MojangAPI"
patchDir = layout.projectDirectory.dir("patches/mojang-api")
outputDir = layout.projectDirectory.dir("Plazma-MojangAPI")
outputDir = layout.projectDirectory.dir("${property("projectName")}-MojangAPI")
}
}
}
Expand Down Expand Up @@ -148,19 +146,19 @@ tasks {
}

generateDevelopmentBundle {
apiCoordinates.set("org.plazmamc.plazma:plazma-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
apiCoordinates.set("${group}:${property("projectName").toString().lowercase()}-api")
mojangApiCoordinates.set("${group}:${property("projectName").toString().lowercase()}-mojangapi")
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
"https://maven.pkg.github.com/PlazmaMC/Plazma",
"https://maven.pkg.github.com/${property("projectRepo")}",
"https://papermc.io/repo/repository/maven-public/"
)
}

clean {
doLast {
projectDir.resolve(".gradle/caches").deleteRecursively()
listOf("Plazma-API", "Plazma-MojangAPI", "Plazma-Server", "paper-api-generator", "run").forEach {
listOf("${property("projectName")}-API", "${property("projectName")}-MojangAPI", "${property("projectName")}-Server", "paper-api-generator", "run").forEach {
projectDir.resolve(it).deleteRecursively()
}

Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ paper.runDisableWatchdog = true
org.plazmamc.alwaysuptodate.paper.repository = https://github.com/PaperMC/Paper
org.plazmamc.alwaysuptodate.purpur.repository = https://github.com/PurpurMC/Purpur

projectName = Plazma
projectRepo = PlazmaMC/PlazmaBukkit

version = 1.20.6-R0.1-SNAPSHOT
mcVersion = 1.20.6
jdkVersion = 21
Expand Down
4 changes: 2 additions & 2 deletions patches/mojang-api/0001-Rebrand.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: [PATCH] Rebrand


diff --git a/build.gradle.kts b/build.gradle.kts
index a278ee93d7001e8dc7fd2f5409c2f528c637cb2f..a00cf1659f1fd9dff3ff34561d78732645b51dfb 100644
index e60be45e2513ea49a8605682c3d80835df4c58ee..4ca37af5e5c68c8e8dbd0cdf9cc92285deecf269 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,7 +9,7 @@ java {
}

dependencies {
- implementation(project(":paper-api"))
+ implementation(project(":plazma-api")) // Plazma - Rebrand
+ implementation(project(":${property("projectName").toString().lowercase()}-api")) // Plazma - Rebrand
api("com.mojang:brigadier:1.0.18")

compileOnly("it.unimi.dsi:fastutil:8.5.6")
158 changes: 110 additions & 48 deletions patches/server/0003-Rebrand.patch

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions patches/server/0005-Plazma-Configurations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Plazma Configurations


diff --git a/build.gradle.kts b/build.gradle.kts
index 902c2eeedeeced8135ec97f64f08420c0996731b..41c335bc9d80abb40e58dfbc4842b66db23e0cba 100644
index e6b6d1f26fd673f35f66a09a64c83810e092e757..1bccc21fa2130e577bd5c64b6ca08e9b2853cc22 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -22,6 +22,7 @@ dependencies {
Expand Down Expand Up @@ -517,18 +517,18 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
+
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c7f09b129920b95d2885dee469dc0bdacd49b8b7..68e1c2d944272689d97e521867a3944526e05b60 100644
index b797f719acb2258bee1cc93394561f14a9df5296..aa02d9390a90e235476a25db31c915668ebc0ec9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -314,6 +314,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -316,6 +316,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final double[] recentTps = new double[ 4 ]; // Purpur
// Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
+ public final org.plazmamc.plazma.configurations.PlazmaConfigurations plazmaConfigurations; // Plazma - Configurable Plazma
public static long currentTickLong = 0L; // Paper - track current tick as a long
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
public boolean lagging = false; // Purpur
@@ -425,6 +426,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -427,6 +428,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
Expand Down
18 changes: 9 additions & 9 deletions patches/server/0008-Development-Build.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Fri, 26 Jan 2024 15:34:53 +0900
Date: Tue, 7 May 2024 22:42:25 +0900
Subject: [PATCH] Development Build


diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index 80159d9c8432f21aa774d3ade9e2ae84b2d5261c..f2a034a5062b58f3d6bde25150e13fe1cff3af0e 100644
index 0a846802f053c545992763e0447e15565204e764..31edd38bbcd117dcde867e4cf7d25f657ea16468 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -24,7 +24,7 @@ public class PaperVersionFetcher implements VersionFetcher {
private static int distance = -2; public int distance() { return distance; }
// Purpur end
private static @Nullable String mcVer;
- public static final boolean DEVELOPMENT = false; // Plazma
+ public static final boolean DEVELOPMENT = true; // Plazma
@@ -27,7 +27,7 @@ public class PaperVersionFetcher implements VersionFetcher {
private static final String PROJECT_NAME = "Plazma";
private static final String PROJECT_REPO = "PlazmaMC/PlazmaBukkit";
private static final String DOWNLOAD_PAGE = "https://docs.plazmamc.org/plazma/about/downloads";
- public static final boolean DEVELOPMENT = false;
+ public static final boolean DEVELOPMENT = true;
// Plazma end

@Override
public long getCacheTime() {
10 changes: 5 additions & 5 deletions patches/server/0009-Port-SparklyPaper-patches.patch
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,18 @@ index f164256d59b761264876ca0c85f812d101bfd5de..deaeb134c47da8710afa747bf980bd00
final TrackedChunk chunk = this.byChunk.get(CoordinateUtils.getChunkKey(chunkX, chunkZ));

diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2903c9a2480ac505f0931d29ac3c5013037e65f1..39f7a4d3711a182b30d5b8eb77c2354170b26720 100644
index aa02d9390a90e235476a25db31c915668ebc0ec9..dc64018795a213d6ddbdf2cff465108eff466d55 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -323,6 +323,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -325,6 +325,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
+ public final Set<Entity> entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run

public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -1731,17 +1732,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1733,17 +1734,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
//MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper // Purpur
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
Expand All @@ -175,7 +175,7 @@ index 2903c9a2480ac505f0931d29ac3c5013037e65f1..39f7a4d3711a182b30d5b8eb77c23541
// Paper end - Folia scheduler API
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
//this.profiler.push("commandFunctions"); // Purpur
@@ -1808,7 +1807,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1810,7 +1809,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

try {
//worldserver.timings.doTick.startTiming(); // Spigot // Purpur
Expand All @@ -192,7 +192,7 @@ index 2903c9a2480ac505f0931d29ac3c5013037e65f1..39f7a4d3711a182b30d5b8eb77c23541
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
regionManager.recalculateRegions();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 8289334e77999f72214c330a3306cbfeb17afbf1..f661418d27f5692a51b880f64180866f7d19d66a 100644
index 5fb36396bf0391361d23007c95b05dbffa30c1b0..f116d7163c71d35668ef7a3c77a627d925bb3550 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -224,6 +224,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
Expand Down
22 changes: 11 additions & 11 deletions patches/server/0015-Completely-remove-Mojang-Profiler.patch
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ index f626a2f28f2aebb3237cebb6afef3c4fa1a6cb37..467e17bfce31d0919d603698c9d88a04
public int forkLimit() {
return this.forkLimit;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 39f7a4d3711a182b30d5b8eb77c2354170b26720..d1dec1a4671f59fb1b7fe6a2188bd7581a33e40e 100644
index dc64018795a213d6ddbdf2cff465108eff466d55..56859a5aebdff201a829b40716c655a0ab7f7e72 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -104,18 +104,18 @@ import net.minecraft.util.datafix.DataFixers;
Expand Down Expand Up @@ -97,7 +97,7 @@ index 39f7a4d3711a182b30d5b8eb77c2354170b26720..d1dec1a4671f59fb1b7fe6a2188bd758
import net.minecraft.util.thread.ReentrantBlockableEventLoop;
import net.minecraft.world.Difficulty;
import net.minecraft.world.RandomSequences;
@@ -220,14 +220,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -222,14 +222,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public LevelStorageSource.LevelStorageAccess storageSource;
public final PlayerDataStorage playerDataStorage;
private final List<Runnable> tickables = Lists.newArrayList();
Expand All @@ -120,7 +120,7 @@ index 39f7a4d3711a182b30d5b8eb77c2354170b26720..d1dec1a4671f59fb1b7fe6a2188bd758
private ServerConnectionListener connection;
public final ChunkProgressListenerFactory progressListenerFactory;
@Nullable
@@ -2584,10 +2584,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2586,10 +2586,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}

Expand All @@ -133,15 +133,15 @@ index 39f7a4d3711a182b30d5b8eb77c2354170b26720..d1dec1a4671f59fb1b7fe6a2188bd758

public abstract boolean isSingleplayerOwner(GameProfile profile);

@@ -2831,6 +2833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2833,6 +2835,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// CraftBukkit end

+ /* // Plazma - Completely remove Mojang's Profiler
private void startMetricsRecordingTick() {
if (false && this.willStartRecordingMetrics) { // Purpur
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
@@ -2857,12 +2860,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2859,12 +2862,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}

public void startRecordingMetrics(Consumer<ProfileResults> resultConsumer, Consumer<Path> dumpConsumer) {
Expand All @@ -156,39 +156,39 @@ index 39f7a4d3711a182b30d5b8eb77c2354170b26720..d1dec1a4671f59fb1b7fe6a2188bd758
}

public void stopRecordingMetrics() {
@@ -2877,6 +2880,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2879,6 +2882,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
//this.metricsRecorder.cancel(); // Purpur
//this.profiler = this.metricsRecorder.getProfiler(); // Purpur
}
+ */ // Plazma - Completely remove Mojang's Profiler

public Path getWorldPath(LevelResource worldSavePath) {
return this.storageSource.getLevelPath(worldSavePath);
@@ -2927,6 +2931,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2929,6 +2933,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.isSaving;
}

+ /* // Plazma - Completely remove Mojang's Profiler
public boolean isTimeProfilerRunning() {
return false; //this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null; // Purpur
}
@@ -2945,6 +2950,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2947,6 +2952,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return methodprofilerresults;
}
}
+ */ // Plazma - Completely remove Mojang's Profiler

public int getMaxChainedNeighborUpdates() {
return 1000000;
@@ -2996,6 +3002,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2998,6 +3004,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}

+ /* // Plazma - Completely remove Mojang's Profiler
private static class TimeProfiler {

final long startNanos;
@@ -3045,6 +3052,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -3047,6 +3054,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
};
}
}
Expand Down Expand Up @@ -361,7 +361,7 @@ index 8c587f829c5e8c6b6df3150024c4ae704988c47b..319f484b535143a94ee2da11114acacc
}
+// Plazma end - Completely remove Mojang's Profiler
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index ddfbc49a693d3100e915f5083f1f8e99df2d4b64..6d39a0d5455fbb0af3916b751d02386af3aa3598 100644
index 1dc1536df986862396aa0f58e834c9c1599bf38e..2d704c3e24505314ec9754cb407fce54e914511b 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -923,11 +923,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0017-Reduce-create-random-instance.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce create random instance


diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d1dec1a4671f59fb1b7fe6a2188bd7581a33e40e..ee5914eddb70adbda4c24b7c31fc4ca34ce06005 100644
index 56859a5aebdff201a829b40716c655a0ab7f7e72..e460bbcdc370ef300e6c4fbbacb71fe6172c944c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -235,6 +235,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -237,6 +237,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Nullable
private ServerStatus.Favicon statusIcon;
private final RandomSource random;
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0033-Add-more-MSPT.patch
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ index 03be23690a94a14d7343526acad67ccf53b85c70..416c0a736edf47f76a37be0bc5fe8678
)
);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ee5914eddb70adbda4c24b7c31fc4ca34ce06005..b2a5d324d0f364193c7aee8ef55c50c57f17e250 100644
index e460bbcdc370ef300e6c4fbbacb71fe6172c944c..33530e53634385bb0ebbf74ec819adc578193b28 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -257,8 +257,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -259,8 +259,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private final long[] tickTimesNanos;
private long aggregatedTickTimesNanos;
// Paper start - Add tick times API and /mspt command
Expand All @@ -108,7 +108,7 @@ index ee5914eddb70adbda4c24b7c31fc4ca34ce06005..b2a5d324d0f364193c7aee8ef55c50c5
public final TickTimes tickTimes60s = new TickTimes(1200);
// Paper end - Add tick times API and /mspt command
@Nullable
@@ -1813,8 +1815,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1815,8 +1817,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.tick(shouldKeepTicking);
long after = Util.getNanos() - before;

Expand Down
Loading

0 comments on commit 040724b

Please sign in to comment.