Skip to content

Commit

Permalink
update folia + some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AltronMaxX committed Nov 29, 2024
1 parent 88af822 commit c29748b
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 178 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
plugins {
java
`maven-publish`
id("io.papermc.paperweight.patcher") version "1.7.2-SNAPSHOT"
id("io.papermc.paperweight.patcher") version "1.7.5"
}

val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
Expand Down Expand Up @@ -75,7 +75,7 @@ paperweight {
decompileRepo.set(paperMavenPublicUrl)

useStandardUpstream("Folia") {
url.set(github("Edenor-Minecraft", "Folia"))
url.set(github("PaperMC", "Folia"))
ref.set(providers.gradleProperty("foliaRef"))

withStandardPatcher {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group=dev.edenor.foldenor

version=1.21.1-R0.1-SNAPSHOT
mcVersion=1.21.1
foliaRef=06d719d57d7ca9df0bda9f881d330b05aca99ebd
foliaRef=2e7bc0721af95196c85500c7bb136aeea0bc12ce

org.gradle.caching=true
org.gradle.parallel=true
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0002-Feature-secure-seed.patch
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ index d6431376184e5650b370cbab204e28bc31f4dac6..a462bfa26f2df4a21bed4024bd8ea166
return GsonHelper.parse(!s1.isEmpty() ? s1 : "{}");
}, new JsonObject()), (String) this.get("level-type", (s1) -> {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 135fa024d81b962761f0edc6896a2a507b6981f9..8ec743bbb76e402a2a0b92bdafe49d70493b2dc9 100644
index f7311d6efc2119b9dbe062a439850a890c9bf6b8..ca3a0f4bcbea47f824cdb5a21a9a2616c1da4fea 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -599,6 +599,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -604,6 +604,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}

public ChunkGenerator getGenerator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ Date: Wed, 31 Jul 2024 14:59:46 +0400
Subject: [PATCH] Redirect-CraftScheduler-to-GlobalRegionScheduler


diff --git a/build.gradle.kts b/build.gradle.kts
index 5548c10b3ced9def2e3062f0bbdc922e99839851..b13eff962e65653bfcb15a94498bace6d3b8e18a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,3 +1,4 @@
+
import io.papermc.paperweight.util.*
import java.time.Instant

diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 5a24902b735cbd64dd5cd5ad46b096c4bdfa799f..3d6c4d0cb4a92660c353fb9604e6bbff93dc692f 100644
index 5a24902b735cbd64dd5cd5ad46b096c4bdfa799f..8ecf35fe449683e34b4bcdecbad54d5c98e5b8a3 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -3,21 +3,17 @@ package org.bukkit.craftbukkit.scheduler;
Expand Down Expand Up @@ -90,9 +99,9 @@ index 5a24902b735cbd64dd5cd5ad46b096c4bdfa799f..3d6c4d0cb4a92660c353fb9604e6bbff
- if (true) throw new UnsupportedOperationException(); // Folia - region threading
+ //if (true) throw new UnsupportedOperationException(); // Folia - region threading
+ Plugin owner = task.getOwner();
+ if (owner == null) {
+ /*if (owner == null) {
+ throw new IllegalCallerException("Attempt to call task without the owning plugin");
+ }
+ }*/
+ boolean repeat = task.getPeriod() != CraftTask.NO_REPEATING;
// Paper start
if (!this.isAsyncScheduler && !task.isSync()) {
Expand Down Expand Up @@ -158,7 +167,7 @@ index 5a24902b735cbd64dd5cd5ad46b096c4bdfa799f..3d6c4d0cb4a92660c353fb9604e6bbff
}

diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index ba369f3dcfdf498e971dc4405d39657a9b6e97cc..4a79c28fe61bec567db40936ad65ae8a60874ff7 100644
index ba369f3dcfdf498e971dc4405d39657a9b6e97cc..1cd8e107c33d05f89f291fbe52be1d39c0bed64a 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.scheduler;
Expand All @@ -182,27 +191,28 @@ index ba369f3dcfdf498e971dc4405d39657a9b6e97cc..4a79c28fe61bec567db40936ad65ae8a
@Override
public final Plugin getOwner() {
- return this.plugin;
+ if (this.plugin == null && this.scheduledTask.getOwningPlugin() != null)
+ if (this.plugin == null && this.scheduledTask != null && this.scheduledTask.getOwningPlugin() != null)
+ return this.scheduledTask.getOwningPlugin();
+ else
+ return this.plugin;
}

@Override
@@ -124,12 +129,18 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -124,12 +129,19 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot

@Override
public boolean isCancelled() {
- return (this.period == CraftTask.CANCEL);
+ //return (this.period == CraftTask.CANCEL);
+ return scheduledTask.isCancelled();
+ return scheduledTask != null ? scheduledTask.isCancelled() : (this.period == CraftTask.CANCEL);
}

@Override
public void cancel() {
- Bukkit.getScheduler().cancelTask(this.id);
+ //Bukkit.getScheduler().cancelTask(this.id);
+ scheduledTask.cancel();
+ if (this.scheduledTask != null)
+ scheduledTask.cancel();
+ }
+
+ protected void setScheduledTask(ScheduledTask scheduledTask) {
Expand Down
30 changes: 15 additions & 15 deletions patches/server/0027-Purpur-Remove-timings.patch
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ index 97817400b70b2579f3a8750f7f33197a5db7ba94..a63b738f567099347cefc7c79911894f
final int packetTimerId = profiler.getOrCreateTimerAndStart(() -> "Packet Handler: ".concat(io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName()))); try { // Folia - profiler
packet.handle(listener);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b97ce0451ce12be8e7e499e1b9e4527b6851fb7d..f1b33ea2ecb3b13562e13cfd5158d7c45c74fe8a 100644
index fb0a0099c5cc475300dc7474fcb1ccd13c64ec2c..cabe6325bd961f902f479dfe9da6ec1a77ecd417 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,7 +3,6 @@ package net.minecraft.server;
Expand Down Expand Up @@ -1050,10 +1050,10 @@ index 74524dcd4539a31e9d0037cd607ffbfce02f414c..d117bd2687b8e9b9cff53e2dbfc96af7
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Iterables;
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 8ec743bbb76e402a2a0b92bdafe49d70493b2dc9..0f03598d459ca4f9194a03769fcd3973b27b1398 100644
index ca3a0f4bcbea47f824cdb5a21a9a2616c1da4fea..56a5b00f0860cbcc833bca2717eb38c52f3dec4b 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -355,9 +355,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -360,9 +360,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon

public void save(boolean flush) {
// Paper - rewrite chunk system
Expand All @@ -1065,7 +1065,7 @@ index 8ec743bbb76e402a2a0b92bdafe49d70493b2dc9..0f03598d459ca4f9194a03769fcd3973
}

@Override
@@ -394,7 +394,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -399,7 +399,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle profiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler
this.level.getProfiler().push("purge");
Expand All @@ -1074,7 +1074,7 @@ index 8ec743bbb76e402a2a0b92bdafe49d70493b2dc9..0f03598d459ca4f9194a03769fcd3973
profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_HOLDER_MANAGER_TICK); try { // Folia - profiler
if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot
this.distanceManager.purgeStaleTickets();
@@ -402,24 +402,24 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -407,24 +407,24 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon

this.runDistanceManagerUpdates();
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_HOLDER_MANAGER_TICK); } // Folia - profiler
Expand Down Expand Up @@ -1104,7 +1104,7 @@ index 8ec743bbb76e402a2a0b92bdafe49d70493b2dc9..0f03598d459ca4f9194a03769fcd3973
this.level.getProfiler().pop();
this.clearCache();
}
@@ -459,13 +459,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -464,13 +464,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.CHUNK_TICK_COLLECT_CHUNKS); } // Folia - profiler
// Paper end - chunk tick iteration optimisations
Iterator iterator = null; // Paper - chunk tick iteration optimisations
Expand All @@ -1120,7 +1120,7 @@ index 8ec743bbb76e402a2a0b92bdafe49d70493b2dc9..0f03598d459ca4f9194a03769fcd3973
int k = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - Optional per player mob spawns
int naturalSpawnChunkCount = k;
@@ -492,7 +492,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -497,7 +497,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.MOB_SPAWN_ENTITY_COUNT); } // Folia - profiler
// Paper end - Optional per player mob spawns
Expand All @@ -1129,7 +1129,7 @@ index 8ec743bbb76e402a2a0b92bdafe49d70493b2dc9..0f03598d459ca4f9194a03769fcd3973

regionizedWorldData.lastSpawnState = spawnercreature_d; // Folia - region threading
gameprofilerfiller.popPush("spawnAndTick");
@@ -541,21 +541,21 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -546,21 +546,21 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
profiler.addCounter(ca.spottedleaf.leafprofiler.LProfilerRegistry.SPAWN_CHUNK_COUNT, spawnChunkCount); // Folia - profiler
profiler.addCounter(ca.spottedleaf.leafprofiler.LProfilerRegistry.RANDOM_CHUNK_TICK_COUNT, randomChunkCount); // Folia - profiler
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.SPAWN_AND_RANDOM_TICK); } // Folia - profiler
Expand All @@ -1155,7 +1155,7 @@ index 8ec743bbb76e402a2a0b92bdafe49d70493b2dc9..0f03598d459ca4f9194a03769fcd3973
profiler.startTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BROADCAST_BLOCK_CHANGES); try { // Folia - profiler
{
final it.unimi.dsi.fastutil.objects.ObjectArrayList<net.minecraft.server.level.ServerChunkCache.ChunkAndHolder> chunks = (it.unimi.dsi.fastutil.objects.ObjectArrayList<net.minecraft.server.level.ServerChunkCache.ChunkAndHolder>)list;
@@ -571,7 +571,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -576,7 +576,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
}
} finally { profiler.stopTimer(ca.spottedleaf.leafprofiler.LProfilerRegistry.BROADCAST_BLOCK_CHANGES); } // Folia - profiler
Expand Down Expand Up @@ -1363,7 +1363,7 @@ index e0c8152024e9ce9f9b22cf697ca2d6058fc34a9a..4812ea7217bb59c43341f4997265a4f5

}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f692a5da9e9a378e056e75e94593301a03c2325b..70cd2a56c65d835298691cad9b1415bbaca2c4e0 100644
index 3b9d59b585a12dd3f95cf4b37d2f110470e7cf54..7338663a1f5e69eb0c7da7fa6d0df373c5db579a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1,6 +1,5 @@
Expand Down Expand Up @@ -1563,7 +1563,7 @@ index 3e739362046d624dd46412f7c50a7220d26593cf..de8170368cb0cd658fc7ab06385757b5
//co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper // Folia - region threading
gameprofilerfiller.pop();
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index dd02f20e965e6e4aaaf5992ea3c4bb0b7f3cc270..f6d94cde5b20c6a25e73a0f739e564b302936815 100644
index 1023b0d4f52a79bc4db27130d47b6c93b464794a..8cdd5e3adf11098b71996530c9c58757d76747ed 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -128,7 +128,7 @@ public final class NaturalSpawner {
Expand All @@ -1575,7 +1575,7 @@ index dd02f20e965e6e4aaaf5992ea3c4bb0b7f3cc270..f6d94cde5b20c6a25e73a0f739e564b3
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
int i = aenumcreaturetype.length;

@@ -181,7 +181,7 @@ public final class NaturalSpawner {
@@ -180,7 +180,7 @@ public final class NaturalSpawner {
}
}

Expand Down Expand Up @@ -1662,7 +1662,7 @@ index 6bc1db349cb1ff6652f0e48159e7b31b8d99e2e1..234751ee1a71809993ad7a6791595ef9
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 3d6c4d0cb4a92660c353fb9604e6bbff93dc692f..63fbcd316b974be65db7a1faa4228a54c5fa68f9 100644
index 8ecf35fe449683e34b4bcdecbad54d5c98e5b8a3..42850d23ea2cfdb6721cdf3767c9770749a5005f 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -1,6 +1,5 @@
Expand Down Expand Up @@ -1722,7 +1722,7 @@ index 3d6c4d0cb4a92660c353fb9604e6bbff93dc692f..63fbcd316b974be65db7a1faa4228a54

private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index 4a79c28fe61bec567db40936ad65ae8a60874ff7..551ac25383730ff553f6be8286cc8a5dbd816887 100644
index 1cd8e107c33d05f89f291fbe52be1d39c0bed64a..be43d1bca7e974ab26f1a81a9dbfa9f4e6a5543b 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -2,16 +2,10 @@ package org.bukkit.craftbukkit.scheduler;
Expand Down Expand Up @@ -1844,7 +1844,7 @@ index 7948267b6b91100a2fd2dcb24817037c75f6953c..c9d4b94a00e4a3256dd530103d074461

@Override
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 24b45224b6a9e3b86ddba550e720b62bd5638c5d..69784dbf1fc50b27d15582ca058b7b0027fa49ae 100644
index ee5be8154ae8f6c8dbdf057bd57d1e6c717837ec..e1091ed36858b2087dc5df9af4abcb6ab0de6570 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -34,7 +34,6 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity;
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0038-Add-linear-format-from-LinearPurpur.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add linear format from LinearPurpur


diff --git a/build.gradle.kts b/build.gradle.kts
index 5548c10b3ced9def2e3062f0bbdc922e99839851..ba7dde3345cf90e47c9f5f9675be78eecb35a54c 100644
index b13eff962e65653bfcb15a94498bace6d3b8e18a..fa7207297fae80cb99eeade66494f2a77fbb2126 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -30,6 +30,10 @@ dependencies {
@@ -31,6 +31,10 @@ dependencies {
alsoShade(log4jPlugins.output)
implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol
// Paper end
Expand Down Expand Up @@ -152,7 +152,7 @@ index f57a71b1182b3b8e03d3f42ecc6e1b55cb93b788..db2c92e8fd7d811639f3fb0bb7cff675
dearEnabled = getBoolean("dab.enabled", true);
startDistance = getInt("dab.start-distance", 12,
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f1b33ea2ecb3b13562e13cfd5158d7c45c74fe8a..4d8dac65d273f732e287728f80cd0b9be3dd8ed3 100644
index cabe6325bd961f902f479dfe9da6ec1a77ecd417..562ab50cb8bdfa6492fb3edf570c6d797c1733bf 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1000,10 +1000,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Paper PR: Prevent zombie reinforcements loading chunks


diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 9460ffdede40a2e3601d3c97b1d1ca4e62dcbf29..9de2ba661b75ff6b819cb8361baa0d59870fd139 100644
index 2b43337ac63d051718a2074fcc46e128a1d65129..3613742ac666c8e97742e3d0905afda5ffc02610 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -341,6 +341,12 @@ public class Zombie extends Monster {
Expand Down
Loading

0 comments on commit c29748b

Please sign in to comment.