9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-03 22:26:19 +00:00

Updated Upstream (Gale/Purpur)

This commit is contained in:
Dreeam
2024-05-25 03:07:39 +08:00
parent cc0981a66a
commit d104be61d4
13 changed files with 67 additions and 68 deletions

View File

@@ -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
@@ -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 {
@@ -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 {
@@ -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
@@ -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
@@ -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) {
@@ -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
@@ -778,7 +777,7 @@ 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();
@@ -786,7 +785,7 @@ index a976002437a5d9c761835691213e11b14d9a7d45..1f4b3412396b1c5d142c0ad9123cacc2
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);
@@ -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()) {
@@ -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
@@ -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;
@@ -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 {
@@ -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;
@@ -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
@@ -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)
@@ -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 {
@@ -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;
}
@@ -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
@@ -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