Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Nov 10, 2024
1 parent e9f5738 commit 88579f1
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 51 deletions.
45 changes: 33 additions & 12 deletions patches/server/0015-Remove-Timings.patch
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,18 @@ index e2c24813f59c2fd075c740ac1842a38f20ed8554..1f7f68aad97ee73763c042837f239bdc
} catch (Exception exception) {
if (exception instanceof ReportedException) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1999d5d4599436c527ca4e6e531c5fe91edaa0cb..db1fe9818331df1b9e7131b3615bbaed3b31a7aa 100644
index 1999d5d4599436c527ca4e6e531c5fe91edaa0cb..ccd94b0a8822b17bd218aa95e302a28196849027 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -187,8 +187,6 @@ import org.bukkit.craftbukkit.CraftRegistry;
@@ -3,7 +3,6 @@ package net.minecraft.server;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
-import co.aikar.timings.Timings;
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
@@ -187,8 +186,6 @@ import org.bukkit.craftbukkit.CraftRegistry;
import org.bukkit.event.server.ServerLoadEvent;
// CraftBukkit end

Expand All @@ -850,23 +858,23 @@ index 1999d5d4599436c527ca4e6e531c5fe91edaa0cb..db1fe9818331df1b9e7131b3615bbaed
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer { // Paper - rewrite chunk system

public static final int SERVER_THREAD_PRIORITY = Integer.getInteger("gale.thread.priority.server", -1); // Gale - server thread priority environment variable
@@ -1025,7 +1023,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1025,7 +1022,6 @@ 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
this.server.spark.disable(); // Paper - spark
// Purpur start
if (upnp) {
@@ -1496,7 +1493,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1496,7 +1492,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}

protected void waitUntilNextTick() {
- //this.executeAll(); // Paper - move this into the tick method for timings
long tickOversleepStart = System.nanoTime(); // Gale - YAPFA - last tick time
this.managedBlock(() -> {
return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick
@@ -1608,15 +1604,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1608,15 +1603,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}

public void tickServer(BooleanSupplier shouldKeepTicking) {
Expand All @@ -884,7 +892,7 @@ index 1999d5d4599436c527ca4e6e531c5fe91edaa0cb..db1fe9818331df1b9e7131b3615bbaed
// Paper end
this.server.spark.tickStart(); // Paper - spark
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
@@ -1650,11 +1645,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1650,11 +1644,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.isSaving = false;
}
// Paper end - Incremental chunk and player saving
Expand All @@ -896,15 +904,15 @@ index 1999d5d4599436c527ca4e6e531c5fe91edaa0cb..db1fe9818331df1b9e7131b3615bbaed
// Paper start - Server Tick Events
long endTime = System.nanoTime();
long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
@@ -1675,7 +1666,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1675,7 +1665,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - Add tick times API and /mspt command
this.logTickMethodTime(i);
org.spigotmc.WatchdogThread.tick(); // Spigot
- co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}

private void logTickMethodTime(long tickStartTime) {
@@ -1746,9 +1736,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1746,9 +1735,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
Expand All @@ -914,7 +922,7 @@ index 1999d5d4599436c527ca4e6e531c5fe91edaa0cb..db1fe9818331df1b9e7131b3615bbaed
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
getAllLevels().forEach(level -> {
@@ -1764,20 +1752,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1764,20 +1751,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
});
// Paper end - Folia scheduler API
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
Expand All @@ -935,15 +943,15 @@ index 1999d5d4599436c527ca4e6e531c5fe91edaa0cb..db1fe9818331df1b9e7131b3615bbaed
// Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - Perf: Optimize time updates
for (final ServerLevel level : this.getAllLevels()) {
@@ -1797,7 +1780,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1797,7 +1779,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Paper end - Perf: Optimize time updates
- MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper

this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked
Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; move down
@@ -1816,9 +1798,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1816,9 +1797,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end */

try {
Expand All @@ -953,7 +961,7 @@ index 1999d5d4599436c527ca4e6e531c5fe91edaa0cb..db1fe9818331df1b9e7131b3615bbaed
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");

@@ -1830,21 +1810,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1830,21 +1809,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked

Expand Down Expand Up @@ -1379,6 +1387,19 @@ index d3de0362dd1ef3954d05c4d8fa56a25edfe1bb2b..6ac3dfab99cfb0b51c81cc20e71da126
public boolean trackDeltas() {
return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS;
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 64013ae4bdaabf10ac0dbbab8ccfa6430df76b83..1e2e90af2ab65938c6d711a187dd4d65a93b1280 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -157,8 +157,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
// CraftBukkit end

-import co.aikar.timings.MinecraftTimings; // Paper
-
public abstract class LivingEntity extends Entity implements Attackable {

private static final Logger LOGGER = LogUtils.getLogger();
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
index 9379dd4056018b52c93ed4888dcdc94579bd9691..c6a7bb3e710b0e3f7e00a11fa5057a24aee8d7a3 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0030-Leaves-Protocol-Core.patch
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ index 1967c43ee3a12e63365cc40ee6565307e2fd73cf..6e376d0db5321d8e9b6e0b54617ffd17

assert isValidPath(path);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index db1fe9818331df1b9e7131b3615bbaed3b31a7aa..451f2e87457b8da3eeac1c42e5c816c2d3f7578f 100644
index ccd94b0a8822b17bd218aa95e302a28196849027..bc4f50c55741c2a664f456a3b7555644ad224d53 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1816,6 +1816,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1815,6 +1815,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
GameTestTicker.SINGLETON.tick();
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0037-Leaves-Replay-Mod-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ index b455c7e9d18bac3654daa8510f85cc21202e254b..1f8d52ee2ad0463b8cb1072190f836ea
if (((List) object).size() >= i) {
return (List) object;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 451f2e87457b8da3eeac1c42e5c816c2d3f7578f..30aa461464eb5ede941b914e01428977c4f6fa1b 100644
index bc4f50c55741c2a664f456a3b7555644ad224d53..7c8d28fe612ef2e37d5d02d449946dce2bb7d524 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1711,7 +1711,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1710,7 +1710,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}

private ServerStatus.Players buildPlayerStatus() {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0045-Fix-sprint-glitch.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Fix sprint glitch


diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 64013ae4bdaabf10ac0dbbab8ccfa6430df76b83..291ae21d002a4215407d18806c94a51e9c32a7c2 100644
index 1e2e90af2ab65938c6d711a187dd4d65a93b1280..d0755333e86009bbb584481f4796cfc60643a53f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1430,7 +1430,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1428,7 +1428,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
player.setRealHealth(health);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0049-Linear-region-file-format.patch
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ index 3218cbf84f54daf06e84442d5eb1a36d8da6b215..ec9b27177dc526510e86d85f48f167b4
synchronized (cache) {
regionFile = ((ChunkSystemRegionFileStorage)(Object)cache).moonrise$getRegionFileIfLoaded(chunkX, chunkZ);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 645c97aef6abf63f0c631a506ccff0e3b9a49dec..ffdecadd2194dd5ab9bd0a814616acb68cf4c3f1 100644
index 7c8d28fe612ef2e37d5d02d449946dce2bb7d524..a226a8f066754fe609583071004395abef9d4709 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -968,10 +968,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -967,10 +967,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator1.hasNext()) {
ServerLevel worldserver2 = (ServerLevel) iterator1.next();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ index c03608fec96b51e1867f43d8f42e5aefb1520e46..15b21fa3907db1b77ed5b5d1050a37f4
throw new IllegalStateException("Ticking retired scheduler");
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ffdecadd2194dd5ab9bd0a814616acb68cf4c3f1..705becd8d234ff6b73c1a1e88d2d0b0633a3479b 100644
index a226a8f066754fe609583071004395abef9d4709..a6d6e3ad434420223178f813953d9c53db26034a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -311,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -310,6 +310,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation

public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("Leaf Async Mob Spawn Thread"); // Pufferfish - optimize mob spawning // Leaf - Unify thread name
+ public final Set<Entity> entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // SparklyPaper - skip EntityScheduler's executeTick checks if there isn't any tasks to be run (concurrent because plugins may schedule tasks async)

public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -1739,6 +1740,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1738,6 +1739,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
Expand All @@ -105,7 +105,7 @@ index ffdecadd2194dd5ab9bd0a814616acb68cf4c3f1..705becd8d234ff6b73c1a1e88d2d0b06
getAllLevels().forEach(level -> {
for (final Entity entity : level.moonrise$getEntityLookup().getAllCopy()) { // Paper - rewrite chunk system
if (entity.isRemoved()) {
@@ -1750,6 +1763,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1749,6 +1762,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Remove stream in entity visible effects filter


diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 291ae21d002a4215407d18806c94a51e9c32a7c2..9e771e3aa2dbf5afb1f5fe9c3d9e6f16031f8df1 100644
index d0755333e86009bbb584481f4796cfc60643a53f..92b253e0f96c742e02a8c8316cd669b949cabf42 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1010,7 +1010,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1008,7 +1008,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
}

private void updateSynchronizedMobEffectParticles() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Replace Entity active effects map with optimized collection
Dreeam TODO: check this

diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 9e771e3aa2dbf5afb1f5fe9c3d9e6f16031f8df1..6d9b94e08fc8cdc5b2f31753484359a4f673a722 100644
index 92b253e0f96c742e02a8c8316cd669b949cabf42..21fbf1f88dbf8e767549a8fd0a7e9a8e0e434d54 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -200,6 +200,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -198,6 +198,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
public static final String ATTRIBUTES_FIELD = "attributes";
private final AttributeMap attributes;
public CombatTracker combatTracker = new CombatTracker(this);
Expand All @@ -20,7 +20,7 @@ index 9e771e3aa2dbf5afb1f5fe9c3d9e6f16031f8df1..6d9b94e08fc8cdc5b2f31753484359a4
public final Map<Holder<MobEffect>, MobEffectInstance> activeEffects = Maps.newHashMap();
private final NonNullList<ItemStack> lastHandItemStacks;
private final NonNullList<ItemStack> lastArmorItemStacks;
@@ -1012,8 +1016,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1010,8 +1014,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
private void updateSynchronizedMobEffectParticles() {
// Leaf start - Remove stream in entity visible effects filter
List<ParticleOptions> list = new ArrayList<>();
Expand All @@ -31,7 +31,7 @@ index 9e771e3aa2dbf5afb1f5fe9c3d9e6f16031f8df1..6d9b94e08fc8cdc5b2f31753484359a4
if (effect.isVisible()) {
list.add(effect.getParticleOptions());
}
@@ -1021,7 +1026,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1019,7 +1024,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
// Leaf end - Remove stream in entity visible effects filter

this.entityData.set(LivingEntity.DATA_EFFECT_PARTICLES, list);
Expand Down
Loading

0 comments on commit 88579f1

Please sign in to comment.