Skip to content

Commit

Permalink
Updated Upstream (Gale/Purpur)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed May 24, 2024
1 parent cc0981a commit d104be6
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 68 deletions.
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 = cn.dreeam.leaf
mcVersion = 1.20.6
version = 1.20.6-R0.1-SNAPSHOT

galeCommit = 92855c65222446b288938dfc39cc9a19d3749257
galeCommit = 8a47f583dfe7bf9f4ae448c572ccbacdeccdaad8

org.gradle.caching = true
org.gradle.parallel = true
Expand Down
6 changes: 3 additions & 3 deletions patches/api/0004-Purpur-API-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur API Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 3d2569397afa45a8988762081cdff594e96a2c6c
Commit: 1bbb0334799623b7d50beb920f35bd5f591471d1

Patches below are removed in this patch:
Pufferfish-API-Changes.patch
Expand Down Expand Up @@ -257,10 +257,10 @@ index 918a045165cdcde264bc24082b7afebb407271de..687d11619379aead7f665d4a5f8f8bcc
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 81f9ad99699a78b97e4accaaf1a98eacf29493ce..e3e996d932db689ba62a43f7f01d6f003f8337d3 100644
index 4f7f91b5e2903ce3b180c637cb463e01a860271e..5b14cea8d246f31c51b09baa731e673f305aea6e 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -5701,4 +5701,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -5733,4 +5733,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
}
return Registry.BLOCK.get(material.key);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur generated-api Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 3d2569397afa45a8988762081cdff594e96a2c6c
Commit: 1bbb0334799623b7d50beb920f35bd5f591471d1

diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 43f4deacef349502cbb207aafc4f9cb7a75177c5..6b692c24a62e2172116a6b9c371b1c0e2411c27e 100644
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0001-Rebrand.patch
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ index 4f3cc14d48690bb183d09bb7a5ba1e23e8a0c08a..d8ebcd1c94ce0f78e9d16c603a79a492
stringbuilder.append(CrashReport.getErrorComment());
stringbuilder.append("\n\n");
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 33f06c2cdc8727529b2547e1cb3cb15266be2602..17af0e5be9245573bfcd2ead2be3b6434cd8f576 100644
index 964f981123b5ea3f2c8f8545739c09fd29e855a9..d88a74af3e6eaa523033b245221c4159b0aa544a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -949,7 +949,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -946,7 +946,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
Expand Down
47 changes: 23 additions & 24 deletions patches/server/0011-Purpur-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ From: Github Actions <no-reply@github.com>
Date: Mon, 29 Apr 2024 09:05:40 +0000
Subject: [PATCH] Purpur Server Changes

TODO - Dreeam: Check TODOs in ServerGamePacketListenerImpl & Tadpole
Fix-pufferfish-issues.patch
TODO - Dreeam: Check TODOs in ServerGamePacketListenerImpl & Fix-pufferfish-issues.patch

Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 3d2569397afa45a8988762081cdff594e96a2c6c
Commit: 1bbb0334799623b7d50beb920f35bd5f591471d1

Patches below are removed in this patch:
Metrics changes in Purpur-config-files.patch
Expand Down Expand Up @@ -521,7 +520,7 @@ index 59d7e8a3d83d3ab7aa28606401bb129ccaeff240..684536f600cca94ea346129a139ec4aa
boolean flag1 = this.source.acceptsSuccess() && !this.silent;
boolean flag2 = broadcastToOps && this.source.shouldInformAdmins() && !this.silent;
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index fe33a834f8684b175165c87a910ab39f6ec4356f..c0bd91b1cab7066f9582d2c734f61ee50e76098d 100644
index d7a10df4fa65b562c33fcf0458d8646d71ec84bf..00a9348b4585d9e69364e0d1ac88a59f43ebeee6 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -220,8 +220,8 @@ public class Commands {
Expand Down Expand Up @@ -700,7 +699,7 @@ index 76ef195a5074006b009acd9cc1744667c6aecbb9..659577549e132754281df76a7a1bfd88
public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) {
this.gameTime = time;
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index bbeb88843f210abdf1cafed11394380cfcab0e09..e68ecaf8d60517fe6398338702a7a7968d67d32b 100644
index 8841f0376a7676922362b6d06c2af752d1319737..207f8f864f0cf5874f8cad9bd15fa5e9ffa3fc12 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -119,6 +119,12 @@ public class Main {
Expand All @@ -717,7 +716,7 @@ index bbeb88843f210abdf1cafed11394380cfcab0e09..e68ecaf8d60517fe6398338702a7a796
Bootstrap.bootStrap();
Bootstrap.validate();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a976002437a5d9c761835691213e11b14d9a7d45..1f4b3412396b1c5d142c0ad9123cacc2f225494b 100644
index 37ce8377f6fff96953137d8e0bf2a57543a0ead3..c7c4a56cb09ca513abdbaf5674c325e551ea2909 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -282,6 +282,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Expand All @@ -737,7 +736,7 @@ index a976002437a5d9c761835691213e11b14d9a7d45..1f4b3412396b1c5d142c0ad9123cacc2

public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper
@@ -966,6 +969,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -963,6 +966,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
MinecraftTimings.stopServer(); // Paper
Expand All @@ -752,7 +751,7 @@ index a976002437a5d9c761835691213e11b14d9a7d45..1f4b3412396b1c5d142c0ad9123cacc2
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -1048,6 +1059,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1045,6 +1056,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.safeShutdown(waitForShutdown, false);
}
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
Expand All @@ -761,7 +760,7 @@ index a976002437a5d9c761835691213e11b14d9a7d45..1f4b3412396b1c5d142c0ad9123cacc2
this.isRestarting = isRestarting;
this.hasLoggedStop = true; // Paper - Debugging
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
@@ -1169,6 +1182,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1166,6 +1179,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end - Add onboarding message for initial server start

Expand All @@ -778,15 +777,15 @@ index a976002437a5d9c761835691213e11b14d9a7d45..1f4b3412396b1c5d142c0ad9123cacc2
while (this.running) {
// Paper start - rewrite chunk system
// guarantee that nothing can stop the server from halting if it can at least still tick
@@ -1211,6 +1234,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1208,6 +1231,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.recentTps[0] = tps1.getAverage();
this.recentTps[1] = tps5.getAverage();
this.recentTps[2] = tps15.getAverage();
+ lagging = recentTps[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur
tickSection = currentTime;
}
// Paper end - further improve server tick loop
@@ -1228,6 +1252,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1225,6 +1249,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
lastTickProperTime = (System.nanoTime() - tickProperStart) / 1000000L; // Gale - YAPFA - last tick time
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos);
Expand All @@ -799,7 +798,7 @@ index a976002437a5d9c761835691213e11b14d9a7d45..1f4b3412396b1c5d142c0ad9123cacc2
this.startMeasuringTaskExecutionTime();
this.waitUntilNextTick();
this.finishMeasuringTaskExecutionTime();
@@ -1724,7 +1754,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1721,7 +1751,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long worldTime = level.getGameTime();
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
for (Player entityhuman : level.players()) {
Expand All @@ -808,7 +807,7 @@ index a976002437a5d9c761835691213e11b14d9a7d45..1f4b3412396b1c5d142c0ad9123cacc2
continue;
}
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
@@ -1745,6 +1775,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1742,6 +1772,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
worldserver.updateLagCompensationTick(); // Paper - lag compensation
Expand Down Expand Up @@ -3019,7 +3018,7 @@ index 7c7e9f40b1d46b1780f55e1cfbf89b6dbd82f2ae..d06c5d16d312187b6a53c8995d524c0e

this.gameEvent(GameEvent.ELYTRA_GLIDE);
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index ad08008a9d3f50bab1ae05603aab4cf3be8e2d54..446237ffe4f40cf287c57c28a9866dfea39ed1bb 100644
index 54cc3b7baa0988972151319245e0ff89151efa5e..1f787798b6d557a2379546f9a4910a7e7a12b178 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -74,6 +74,7 @@ import net.minecraft.world.item.SpawnEggItem;
Expand Down Expand Up @@ -14490,7 +14489,7 @@ index eb152f9ab41fc7b7219f9be26b574d61506c55d5..e9e0c91299b2669e0ff452176bf9758c
Set<BlockPos> set = Sets.newHashSet();
boolean flag = true;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 5854c76fadd8fe08d0d0ca5d01ce218b86a508c1..1397f54cef6cc23ba99a4faa36bf862318da9270 100644
index ba2c1672a018dbd0a179e71f7166fb9df87782dd..45adf5a7c46ee4e3a06e62fbbb22548175359180 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -175,6 +175,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Expand All @@ -14501,9 +14500,9 @@ index 5854c76fadd8fe08d0d0ca5d01ce218b86a508c1..1397f54cef6cc23ba99a4faa36bf8623
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter;
@@ -194,6 +195,49 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
// Paper end - fix and optimise world upgrading
@@ -185,6 +186,49 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

public final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(this.random.nextLong()); // Gale - Pufferfish - move random tick random

+ // Purpur start
+ private com.google.common.cache.Cache<BreedingCooldownPair, Object> playerBreedingCooldowns;
Expand Down Expand Up @@ -14551,7 +14550,7 @@ index 5854c76fadd8fe08d0d0ca5d01ce218b86a508c1..1397f54cef6cc23ba99a4faa36bf8623
public CraftWorld getWorld() {
return this.world;
}
@@ -233,6 +277,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -224,6 +268,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
this.galeConfig = galeWorldConfigCreator.apply(this.spigotConfig); // Gale - Gale configuration
Expand All @@ -14560,7 +14559,7 @@ index 5854c76fadd8fe08d0d0ca5d01ce218b86a508c1..1397f54cef6cc23ba99a4faa36bf8623
this.generator = gen;
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);

@@ -1917,4 +1963,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1908,4 +1954,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return null;
}
// Paper end - optimize redstone (Alternate Current)
Expand Down Expand Up @@ -16957,7 +16956,7 @@ index 9d93130f23addb18b97d7f5ec013faef17a74529..29d2fb87a65778926aea2cfc7a5b486c
+ // Purpur end - OfflinePlayer API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2d46b81faf0f4fdf73ebe26b561e960c6ef451d0..c735be3db72fc0bb9000476a41758711ca551d17 100644
index 32002eb8b7fd81ef1d0e2ca79292ccb1354b3b02..c10ad40f02009006552691642c057b328904f4b8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -409,6 +409,20 @@ public final class CraftServer implements Server {
Expand Down Expand Up @@ -17005,7 +17004,7 @@ index 2d46b81faf0f4fdf73ebe26b561e960c6ef451d0..c735be3db72fc0bb9000476a41758711
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");

@@ -1581,6 +1598,55 @@ public final class CraftServer implements Server {
@@ -1576,6 +1593,55 @@ public final class CraftServer implements Server {
return true;
}

Expand Down Expand Up @@ -17061,7 +17060,7 @@ index 2d46b81faf0f4fdf73ebe26b561e960c6ef451d0..c735be3db72fc0bb9000476a41758711
@Override
public List<Recipe> getRecipesFor(ItemStack result) {
Preconditions.checkArgument(result != null, "ItemStack cannot be null");
@@ -3051,6 +3117,18 @@ public final class CraftServer implements Server {
@@ -3046,6 +3112,18 @@ public final class CraftServer implements Server {
}
// Gale end - Gale configuration - API

Expand All @@ -17080,7 +17079,7 @@ index 2d46b81faf0f4fdf73ebe26b561e960c6ef451d0..c735be3db72fc0bb9000476a41758711
@Override
public void restart() {
org.spigotmc.RestartCommand.restart();
@@ -3333,4 +3411,15 @@ public final class CraftServer implements Server {
@@ -3328,4 +3406,15 @@ public final class CraftServer implements Server {
}
// Gale end - YAPFA - last tick time - API

Expand Down
8 changes: 4 additions & 4 deletions patches/server/0012-Fix-Pufferfish-and-Purpur-patches.patch
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ index e94224ed280247ee69dfdff8dc960f2b8729be33..5b9725a9a81c0850dc2809c150529e5f

for (Component component : formatProviders(spigotPlugins, sender)) { // Purpur
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1f4b3412396b1c5d142c0ad9123cacc2f225494b..561426280dff2af8015fec3108a8b8514d994679 100644
index c7c4a56cb09ca513abdbaf5674c325e551ea2909..ede6cd55688e573e003a6568100b18d5e620f878 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -293,7 +293,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Expand All @@ -48,15 +48,15 @@ index 1f4b3412396b1c5d142c0ad9123cacc2f225494b..561426280dff2af8015fec3108a8b851

public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -977,6 +977,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -974,6 +974,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
LOGGER.error("[UPnP] Failed to close port {}", this.getPort());
}
}
+ // Purpur end
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -1231,9 +1232,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1228,9 +1229,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
tps15.add(currentTps, diff);

// Backwards compat with bad plugins
Expand Down Expand Up @@ -186,7 +186,7 @@ index d06c5d16d312187b6a53c8995d524c0ec2d9f921..d55d869f0a389d58d001e59e26b1b591
// Purpur start
if (entity instanceof LivingEntity entityliving) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 446237ffe4f40cf287c57c28a9866dfea39ed1bb..3a153b7f1092c2d4ac6e0115f611d60907619a40 100644
index 1f787798b6d557a2379546f9a4910a7e7a12b178..6264d70f45be0aaee26c0ed0478228ceb36614d0 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -747,7 +747,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0013-Purpur-Configurable-server-mod-name.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 561426280dff2af8015fec3108a8b8514d994679..68d560a5fc5b6d2f058625d4210b9a75c09e1da3 100644
index ede6cd55688e573e003a6568100b18d5e620f878..9b18c076cabdbfc4b266fa605f38e2ad375e8271 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1922,7 +1922,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1919,7 +1919,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

@DontObfuscate
public String getServerModName() {
Expand Down
Loading

0 comments on commit d104be6

Please sign in to comment.