Fix some compile errors from patches

This commit is contained in:
Spottedleaf 2024-10-24 11:20:51 -07:00
parent 3d7b5708ef
commit 1d341dfda3
4 changed files with 71 additions and 26 deletions

View file

@ -1275,6 +1275,19 @@ index 61893f8216ddaedd899b573322f3ad0088074ac5..36b96e0ed5c0d25068ec4678eddd8a19
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 509a67aff07bcdcad47eb77e923d442349a4f20c..537a755d097d7713404d83dc47cd17828b15a906 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -272,7 +272,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return true;
}
- public final void loadChunksForMoveAsync(AABB axisalignedbb, ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority priority,
+ public final void loadChunksForMoveAsync(AABB axisalignedbb, ca.spottedleaf.concurrentutil.util.Priority priority,
java.util.function.Consumer<List<net.minecraft.world.level.chunk.ChunkAccess>> onLoad) {
if (Thread.currentThread() != this.thread) {
this.getChunkSource().mainThreadProcessor.execute(() -> {
diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
index f18c2b85ed9541f646f157184221e333d0ae58bd..aff4c3d63a97d5bbde004a616f7e14fca59b5ab9 100644
--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java

View file

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Thu, 24 Oct 2024 11:13:42 -0700
Subject: [PATCH] fixup! More Teleport API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index f473df7a5aea6a89fb1eed28c9071b7eb3269cf8..4209434ff066670000dadb0c59fea297f03300f4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1020,7 +1020,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
java.util.concurrent.CompletableFuture<Boolean> ret = new java.util.concurrent.CompletableFuture<>();
world.loadChunksForMoveAsync(getHandle().getBoundingBoxAt(locationClone.getX(), locationClone.getY(), locationClone.getZ()),
- this instanceof CraftPlayer ? ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.HIGHER : ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.NORMAL, (list) -> {
+ this instanceof CraftPlayer ? ca.spottedleaf.concurrentutil.util.Priority.HIGHER : ca.spottedleaf.concurrentutil.util.Priority.NORMAL, (list) -> {
net.minecraft.server.level.ServerChunkCache chunkProviderServer = world.getChunkSource();
for (net.minecraft.world.level.chunk.ChunkAccess chunk : list) {
chunkProviderServer.addTicketAtLevel(net.minecraft.server.level.TicketType.POST_TELEPORT, chunk.getPos(), 33, CraftEntity.this.getEntityId());

View file

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Thu, 24 Oct 2024 11:17:10 -0700
Subject: [PATCH] fixup! Timings v2
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..350bfa9c891130b1aa2ab973e86668de187ee1e0 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -427,7 +427,6 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.pop();
this.clearCache();
}
- if (this.level.getServer().tickRateManager().runsNormally()) this.level.timings.chunkTicks.startTiming(); // Paper
private void tickChunks() {
long i = this.level.getGameTime();

View file

@ -8241,10 +8241,10 @@ index 0000000000000000000000000000000000000000..a0e5fc2eff605e17704f0726d20e79cb
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java
new file mode 100644
index 0000000000000000000000000000000000000000..120ce31729dc8d4bba0901ca06d3212f3158d089
index 0000000000000000000000000000000000000000..f3c453773e0413276935ca653b60bbe64fa4b169
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java
@@ -0,0 +1,1037 @@
@@ -0,0 +1,1036 @@
+package ca.spottedleaf.moonrise.patches.chunk_system.scheduling;
+
+import ca.spottedleaf.concurrentutil.executor.PrioritisedExecutor;
@ -8253,7 +8253,6 @@ index 0000000000000000000000000000000000000000..120ce31729dc8d4bba0901ca06d3212f
+import ca.spottedleaf.concurrentutil.lock.ReentrantAreaLock;
+import ca.spottedleaf.concurrentutil.util.ConcurrentUtil;
+import ca.spottedleaf.concurrentutil.util.Priority;
+import ca.spottedleaf.moonrise.common.config.moonrise.MoonriseConfig;
+import ca.spottedleaf.moonrise.common.util.CoordinateUtils;
+import ca.spottedleaf.moonrise.common.util.JsonUtil;
+import ca.spottedleaf.moonrise.common.util.MoonriseCommon;
@ -26258,7 +26257,7 @@ index 65206fdfa5b94eaca139e433b4865c16b16641f3..bf4463bcb5dc439ac5a3fa08dd60845a
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..aea24a874c5d7d0ca40c604e72e07a867ede2482 100644
index 350bfa9c891130b1aa2ab973e86668de187ee1e0..4b5985c284faac7b06c0f99d53065f5060ecff4a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -52,7 +52,7 @@ import net.minecraft.world.level.storage.DimensionDataStorage;
@ -26644,7 +26643,7 @@ index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..aea24a874c5d7d0ca40c604e72e07a86
this.tickChunks();
this.level.timings.chunks.stopTiming(); // Paper - timings
this.chunkMap.tick();
@@ -445,7 +502,10 @@ public class ServerChunkCache extends ChunkSource {
@@ -444,7 +501,10 @@ public class ServerChunkCache extends ChunkSource {
gameprofilerfiller.push("filteringTickingChunks");
this.collectTickingChunks(list);
gameprofilerfiller.popPush("shuffleChunks");
@ -26656,7 +26655,7 @@ index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..aea24a874c5d7d0ca40c604e72e07a86
this.tickChunks(gameprofilerfiller, j, list);
gameprofilerfiller.pop();
} finally {
@@ -478,14 +538,26 @@ public class ServerChunkCache extends ChunkSource {
@@ -477,14 +537,26 @@ public class ServerChunkCache extends ChunkSource {
}
private void collectTickingChunks(List<LevelChunk> chunks) {
@ -26688,7 +26687,7 @@ index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..aea24a874c5d7d0ca40c604e72e07a86
}
private void tickChunks(ProfilerFiller profiler, long timeDelta, List<LevelChunk> chunks) {
@@ -529,7 +601,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -528,7 +600,7 @@ public class ServerChunkCache extends ChunkSource {
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, list1);
}
@ -26697,7 +26696,7 @@ index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..aea24a874c5d7d0ca40c604e72e07a86
this.level.tickChunk(chunk, k);
}
}
@@ -546,11 +618,13 @@ public class ServerChunkCache extends ChunkSource {
@@ -545,11 +617,13 @@ public class ServerChunkCache extends ChunkSource {
}
private void getFullChunk(long pos, Consumer<LevelChunk> chunkConsumer) {
@ -26715,7 +26714,7 @@ index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..aea24a874c5d7d0ca40c604e72e07a86
}
@@ -644,6 +718,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -643,6 +717,12 @@ public class ServerChunkCache extends ChunkSource {
this.chunkMap.setServerViewDistance(watchDistance);
}
@ -26728,7 +26727,7 @@ index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..aea24a874c5d7d0ca40c604e72e07a86
public void setSimulationDistance(int simulationDistance) {
this.distanceManager.updateSimulationDistance(simulationDistance);
}
@@ -735,21 +815,19 @@ public class ServerChunkCache extends ChunkSource {
@@ -734,21 +814,19 @@ public class ServerChunkCache extends ChunkSource {
@Override
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
public boolean pollTask() {
@ -26773,7 +26772,7 @@ index bc0f1aa61e68d2a8638d89c10bc5c71922d057f9..79c88b315481fe70f037bae834f2b072
if (!list.equals(this.lastPassengers)) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 509a67aff07bcdcad47eb77e923d442349a4f20c..e01cbfa395a2ed1056313296fac9c91631e94a01 100644
index 537a755d097d7713404d83dc47cd17828b15a906..f657bf73c4d5965dda2490e259aabbf082a0a98e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -187,7 +187,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@ -26796,7 +26795,7 @@ index 509a67aff07bcdcad47eb77e923d442349a4f20c..e01cbfa395a2ed1056313296fac9c916
private final SleepStatus sleepStatus;
@@ -274,15 +274,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public final void loadChunksForMoveAsync(AABB axisalignedbb, ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority priority,
public final void loadChunksForMoveAsync(AABB axisalignedbb, ca.spottedleaf.concurrentutil.util.Priority priority,
java.util.function.Consumer<List<net.minecraft.world.level.chunk.ChunkAccess>> onLoad) {
- if (Thread.currentThread() != this.thread) {
- this.getChunkSource().mainThreadProcessor.execute(() -> {
@ -29474,7 +29473,7 @@ index e185a33b5b1f8e8e0a0e666b24ba3e9186a8a7ff..5d7a6e4b73f032db356e7ec369b15001
// Paper start - Affects Spawning API
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e92def0ccc 100644
index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..5d4a49d009aee30cd3e83b18ecd5e9399eeb2d56 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -83,6 +83,7 @@ import net.minecraft.world.level.storage.LevelData;
@ -29490,7 +29489,7 @@ index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e9
// CraftBukkit end
-public abstract class Level implements LevelAccessor, AutoCloseable {
+public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel, ca.spottedleaf.moonrise.patches.chunk_system.world.ChunkSystemEntityGetter, ca.spottedleaf.moonrise.patches.collisions.world.CollisionLevel { // Paper - rewrite chunk system // Paper - optimise collisions
+public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel, ca.spottedleaf.moonrise.patches.chunk_system.world.ChunkSystemEntityGetter { // Paper - rewrite chunk system // Paper - optimise collisions
public static final Codec<ResourceKey<Level>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
public static final ResourceKey<Level> OVERWORLD = ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld"));
@ -30134,19 +30133,15 @@ index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e9
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.generator = gen;
@@ -271,6 +904,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -271,6 +904,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
+ this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system
+ // Paper start - optimise collisions
+ this.minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection(this);
+ this.maxSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMaxSection(this);
+ // Paper end - optimise collisions
}
// Paper start - Cancel hit for vanished players
@@ -535,7 +1173,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -535,7 +1169,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
}
@ -30155,7 +30150,7 @@ index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e9
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
}
@@ -800,6 +1438,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -800,6 +1434,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
boolean flag = this.tickRateManager().runsNormally();
@ -30164,7 +30159,7 @@ index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e9
int tilesThisCycle = 0;
var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
toRemove.add(null); // Paper - Fix MC-117075
@@ -815,6 +1455,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -815,6 +1451,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot end
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
tickingblockentity.tick();
@ -30176,7 +30171,7 @@ index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e9
}
}
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
@@ -837,12 +1482,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -837,12 +1478,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
// Paper end - Prevent block entity and entity crashes
}
@ -30198,7 +30193,7 @@ index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e9
}
// Paper end - Option to prevent armor stands from doing entity lookups
@@ -894,7 +1547,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -894,7 +1543,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
// Paper end - Perf: Optimize capturedTileEntities lookup
// CraftBukkit end
@ -30207,7 +30202,7 @@ index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e9
}
public void setBlockEntity(BlockEntity blockEntity) {
@@ -986,26 +1639,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -986,26 +1635,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Profiler.get().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
@ -30240,7 +30235,7 @@ index d048d0e4b16459b5bad44ebfa3c6a8f336f6762b..0c1d1139a68c06ba056dcfe96284e3e9
}
@Override
@@ -1020,36 +1662,94 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1020,36 +1658,94 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE);
}