Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Commit

Permalink
Updated Upstream and Sidestream(s) (Tuinity/AirplaneLite)
Browse files Browse the repository at this point in the history
Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
06ce05b Fix broken chunk loading while under high block update stress

AirplaneLite Changes:
1b05468 Always reset comment list
adbefaa DEAR merged! (fix comment)
6e86873 Merge branch 'perf/activation-ranges'
12c221c Merge pull request #2 from Encode42/master
6095a90 Fix webhook build status
9ec74d9 Fix compile error
b0adfa5 Hoglin support
829a3a2 Rebuild patches
553e5c4 Merge branch 'master' into perf/activation-ranges
95fb8ac Merge branch 'master' into perf/activation-ranges
4444971 ok
767e9e1 DEAR for piglins
ce074ea Merge branch 'master' into perf/activation-ranges
f12fce4 lower bound on activation prio
d9962ce Add villager dynamic EAR ticking
10929cc Spelling
21d241c Merge branch 'master' into perf/activation-ranges
8f0039a Add configuration to activation ranges
c758dfa Merge branch 'master' into perf/activation-ranges
17605f8 Raise lowest tick amount to 1s
1b604ca Fix Paper inactive tick, finish our range impl
72f27b7 Merge master
dafa5a9 Merge branch 'master' into perf/activation-ranges
55c051f Tuning, still needs config
089d995 First pass at dynamic activation range
  • Loading branch information
Titaniumtown committed Jan 26, 2021
1 parent 0ae19b2 commit 18c2464
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 47 deletions.
85 changes: 45 additions & 40 deletions patches/Tuinity/patches/server/0061-Rewrite-the-light-engine.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4650,7 +4650,7 @@ index 1aa070db60f5473576fb5d056cadde5106766489..24e6f3141ff4434f770e956a8d240bf8
}

diff --git a/src/main/java/net/minecraft/server/IChunkAccess.java b/src/main/java/net/minecraft/server/IChunkAccess.java
index 180b6b58dc5663158db84b6f1257591439b48c31..564703d87c47eab34a23cb5d159cc66cdbfc00a3 100644
index 180b6b58dc5663158db84b6f1257591439b48c31..eb0d794b7275af7f860e7c7b85a9e3b2aa4a863f 100644
--- a/src/main/java/net/minecraft/server/IChunkAccess.java
+++ b/src/main/java/net/minecraft/server/IChunkAccess.java
@@ -24,6 +24,36 @@ public interface IChunkAccess extends IBlockAccess, IStructureAccess {
Expand Down Expand Up @@ -4698,14 +4698,16 @@ index 180b6b58dc5663158db84b6f1257591439b48c31..564703d87c47eab34a23cb5d159cc66c
Stream<BlockPosition> m();

TickList<Block> n();
@@ -142,6 +173,7 @@ public interface IChunkAccess extends IBlockAccess, IStructureAccess {
@@ -142,7 +173,9 @@ public interface IChunkAccess extends IBlockAccess, IStructureAccess {
return ashortlist[i];
}

+ default boolean isLit() { return this.r(); } // Tuinity - OBFHELPER
boolean r();

+ default void setLit(boolean lit) { this.b(lit); } // Tuinity - OBFHELPER
void b(boolean flag);
}
diff --git a/src/main/java/net/minecraft/server/ILightAccess.java b/src/main/java/net/minecraft/server/ILightAccess.java
index be5384ee41290b24b0c419c3e8f4553db34b2399..df28f7a6bf4c650a22ddf046eae4d5e8ca5879a9 100644
--- a/src/main/java/net/minecraft/server/ILightAccess.java
Expand All @@ -4724,7 +4726,7 @@ index be5384ee41290b24b0c419c3e8f4553db34b2399..df28f7a6bf4c650a22ddf046eae4d5e8

IBlockAccess getWorld();
diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java
index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..168fe23177dfaa401396c1e460f56273ee0a59e4 100644
index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..7833846ffa52353f5a67da16df030f6edf2d30ec 100644
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java
@@ -2,6 +2,11 @@ package net.minecraft.server;
Expand Down Expand Up @@ -4840,8 +4842,8 @@ index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..168fe23177dfaa401396c1e460f56273
+ } else {
+ this.holdingChunks.put(coordinate, current + 1);
+ }
+ }
+
}
+ protected final void releaseLightWorkChunk(int chunkX, int chunkZ) {
+ final long coordinate = MCUtil.getCoordinateKey(chunkX, chunkZ);
+ final int current = this.holdingChunks.get(coordinate);
Expand Down Expand Up @@ -4906,8 +4908,8 @@ index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..168fe23177dfaa401396c1e460f56273
+ }
+
+ return CompletableFuture.completedFuture(playerChunk.getAvailableChunkNow());
}
+ }
+
+ // note: task is discarded if the chunk is not at light status or if the chunk is not lit
+ protected final void scheduleLightWorkTask(int chunkX, int chunkZ, LightEngineThreaded.Update type, Runnable task) {
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
Expand Down Expand Up @@ -5059,47 +5061,38 @@ index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..168fe23177dfaa401396c1e460f56273
this.a(chunkcoordintpair.x, chunkcoordintpair.z, () -> {
return 0;
}, LightEngineThreaded.Update.PRE_UPDATE, SystemUtils.a(() -> {
@@ -277,6 +526,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
return;
}
// Paper end
+ if (this.theLightEngine == null) { // Tuinity - replace light engine impl
ChunkSection[] achunksection = ichunkaccess.getSections();
@@ -264,6 +513,30 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
public CompletableFuture<IChunkAccess> a(IChunkAccess ichunkaccess, boolean flag) {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();

for (int i = 0; i < 16; ++i) {
@@ -293,16 +543,29 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
super.a(blockposition, ichunkaccess.g(blockposition));
});
}
+ } else { // Tuinity start - replace light engine impl
+ // Tuinity start - replace light engine
+ if (this.theLightEngine != null) {
+ // make the completion of this future only depend on pre-update execution
+ // post-update is used for block updates, so by using pre here we prioritise chunk lighting
+ return CompletableFuture.supplyAsync(() -> {
+ Boolean[] emptySections = com.tuinity.tuinity.chunk.light.StarLightEngine.getEmptySectionsForChunk(ichunkaccess);
+ if (!flag) {
+ ichunkaccess.setLit(false);
+ this.theLightEngine.lightChunk(ichunkaccess, emptySections);
+ ichunkaccess.setLit(true);
+ } else {
+ this.theLightEngine.forceLoadInChunk(ichunkaccess, emptySections);
+ // can't really force the chunk to be edged checked, as we need neighbouring chunks - but we don't have
+ // them, so if it's not loaded then i guess we can't do edge checks. later loads of the chunk should
+ // catch what we miss here.
+ this.theLightEngine.checkChunkEdges(chunkcoordintpair.x, chunkcoordintpair.z);
+ }
+
+ } // Tuinity end - replace light engine impl

// this.d.c(chunkcoordintpair); // Paper - move into post task below
}, () -> {
return "lightChunk " + chunkcoordintpair + " " + flag;
// Paper start - merge the 2 together
}), () -> {
- this.d.c(chunkcoordintpair); // Paper - release light tickets as post task to ensure they stay loaded until fully done
+ this.d.c(chunkcoordintpair); // Paper - release light tickets as post task to ensure they stay loaded until fully done // Tuinity - diff on change, copied to top of method for early return if the chunk is already lit
if (skippedPre[0]) return; // Paper - future's already complete
ichunkaccess.b(true);
- super.b(chunkcoordintpair, false);
+ if (this.theLightEngine == null) super.b(chunkcoordintpair, false); // Tuinity - replace light engine impl
// Paper start
future.complete(ichunkaccess);
});
@@ -311,7 +574,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
+ // safe to move the release light to here, as all the work required is done now
+ this.playerChunkMap.removeLightTicket(chunkcoordintpair); // copied from below
+ return ichunkaccess;
+ }, (runnable) -> {
+ this.scheduleTask(chunkcoordintpair.x, chunkcoordintpair.z, LightEngineThreaded.Update.PRE_UPDATE, runnable);
+ });
+ }
+ // Tuinity end - replace light engine
+
// Paper start
//ichunkaccess.b(false); // Don't need to disable this
long pair = chunkcoordintpair.pair();
@@ -311,7 +584,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
}

public void queueUpdate() {
Expand All @@ -5108,7 +5101,7 @@ index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..168fe23177dfaa401396c1e460f56273
this.b.a((() -> { // Paper - decompile error
this.b();
this.g.set(false);
@@ -325,17 +588,36 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
@@ -325,17 +598,36 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
private final java.util.List<Runnable> pre = new java.util.ArrayList<>();
private final java.util.List<Runnable> post = new java.util.ArrayList<>();
private void b() {
Expand Down Expand Up @@ -5293,6 +5286,18 @@ index 8b4ab23563a9a0c047267143dc3c6c5545d6c125..ac82f1791ce07e9a23cf97ca34974ab2
}

}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index caaffea1b670ddfd20bf39cbd55da1c5cf561288..9be1581868627b99709bcd446de6dc89c34b42d3 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1316,6 +1316,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Tuinity end - force competion on the main thread
}

+ protected final void removeLightTicket(ChunkCoordIntPair chunkcoordintpair) { this.c(chunkcoordintpair); } // Tuinity - OBFHELPER
protected void c(ChunkCoordIntPair chunkcoordintpair) {
this.executor.a(SystemUtils.a(() -> {
this.chunkDistanceManager.b(TicketType.LIGHT, chunkcoordintpair, 33 + ChunkStatus.a(ChunkStatus.FEATURES), chunkcoordintpair);
diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java
index a3ac883500eaebb353ad3108a17b5c740e384b03..d8b759874545293764690b2ba08a4bd7605c76ae 100644
--- a/src/main/java/net/minecraft/server/ProtoChunk.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ index 55fa3911703f96cf1f97c82b19d8e2d0d220016b..b92ca4a6de01f3f86367fb8dfe3591b0
Vec3D vec3d = new Vec3D(((double) pathpoint.a + this.a.locX()) / 2.0D, ((double) pathpoint.b + this.a.locY()) / 2.0D, ((double) pathpoint.c + this.a.locZ()) / 2.0D);

diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index caaffea1b670ddfd20bf39cbd55da1c5cf561288..e136195f3e806c50492b89811e82940fd38bafa6 100644
index 9be1581868627b99709bcd446de6dc89c34b42d3..5fe928e4511f320aef1f3b94a092d2a7d8450706 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -291,7 +291,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ index 13d067f48647dea63ef1bf3a2a3e0868074ba75f..04afd7f285db2f281a038e0be6f557b8
this.a(Long.MAX_VALUE, i, j, flag);
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index e136195f3e806c50492b89811e82940fd38bafa6..16779ffa00caf32752170700e1d88092802fa932 100644
index 5fe928e4511f320aef1f3b94a092d2a7d8450706..a42571cfd2c9c80df27e59db832cb64c2a64e141 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -838,6 +838,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Fix LightEngineThreaded memory leak


diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java
index 168fe23177dfaa401396c1e460f56273ee0a59e4..4141cf02690e13350a10cdfa5e09344c56703f04 100644
index 7833846ffa52353f5a67da16df030f6edf2d30ec..d100d5626960f5274b800a3635cf7bf2a653978e 100644
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java
@@ -110,6 +110,8 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
Expand Down
2 changes: 1 addition & 1 deletion upstream/AirplaneLite
2 changes: 1 addition & 1 deletion upstream/Tuinity
2 changes: 1 addition & 1 deletion upstreamCommits/AirplaneLite
Original file line number Diff line number Diff line change
@@ -1 +1 @@
459bb20578ad026c4cb879ac8206ed68de0b7602
1b054681ed6b0263eee1d10864ee58e3ea04bc29
2 changes: 1 addition & 1 deletion upstreamCommits/Tuinity
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d3ee22224addb3d6997feedf4eba95962786f7d7
06ce05bbd9c96c8a34cbbb8b3666fc0c52363855

0 comments on commit 18c2464

Please sign in to comment.