Skip to content

Commit f102a88

Browse files
committed
Threaded chunk changes broadcasting
1 parent ffdcff0 commit f102a88

8 files changed

Lines changed: 73 additions & 694 deletions

File tree

patches_removed/0026-Run-unsupported-plugins-in-sync.patch

Lines changed: 0 additions & 434 deletions
This file was deleted.

patches_removed/0028-Threaded-chunk-changes-broadcasting.patch

Lines changed: 0 additions & 218 deletions
This file was deleted.

shreddedpaper-server/minecraft-patches/sources/net/minecraft/server/commands/CloneCommands.java.patch

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,6 @@
2121
List<CloneCommands.CloneBlockInfo> list = Lists.newArrayList();
2222
List<CloneCommands.CloneBlockInfo> list1 = Lists.newArrayList();
2323
List<CloneCommands.CloneBlockInfo> list2 = Lists.newArrayList();
24-
@@ -329,6 +_,15 @@
25-
}
26-
27-
serverLevel1.getBlockTicks().copyAreaFrom(serverLevel.getBlockTicks(), boundingBox, blockPos4);
28-
+
29-
+ // ShreddedPaper start - clear cached chunk packets for destination chunks
30-
+ for (int chunkX = boundingBox1.minX() >> 4; chunkX <= boundingBox1.maxX() >> 4; chunkX++) {
31-
+ for (int chunkZ = boundingBox1.minZ() >> 4; chunkZ <= boundingBox1.maxZ() >> 4; chunkZ++) {
32-
+ net.minecraft.world.level.chunk.LevelChunk chunk = serverLevel1.getChunkIfLoaded(chunkX, chunkZ);
33-
+ if (chunk != null) chunk.cachedChunkPacket = null;
34-
+ }
35-
+ }
36-
+ // ShreddedPaper end - clear cached chunk packets for destination chunks
37-
} catch (Throwable var35) {
38-
try {
39-
scopedCollector.close();
4024
@@ -336,17 +_,19 @@
4125
var35.addSuppressed(var34);
4226
}

shreddedpaper-server/minecraft-patches/sources/net/minecraft/server/commands/FillCommand.java.patch

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,9 @@
1616
int i2 = 0;
1717

1818
for (BlockPos blockPos : BlockPos.betweenClosed(box.minX(), box.minY(), box.minZ(), box.maxX(), box.maxY(), box.maxZ())) {
19-
@@ -223,13 +_,24 @@
20-
level.updateNeighboursOnBlockSet(updatedPosition.pos, updatedPosition.oldState);
19+
@@ -224,12 +_,14 @@
2120
}
2221

23-
+ // ShreddedPaper start - clear cached chunk packets for affected chunks
24-
+ for (int chunkX = box.minX() >> 4; chunkX <= box.maxX() >> 4; chunkX++) {
25-
+ for (int chunkZ = box.minZ() >> 4; chunkZ <= box.maxZ() >> 4; chunkZ++) {
26-
+ net.minecraft.world.level.chunk.LevelChunk chunk = level.getChunkIfLoaded(chunkX, chunkZ);
27-
+ if (chunk != null) chunk.cachedChunkPacket = null;
28-
+ }
29-
+ }
30-
+ // ShreddedPaper end - clear cached chunk packets for affected chunks
31-
+
3222
if (i2 == 0) {
3323
- throw ERROR_FAILED.create();
3424
+ source.sendFailure(Component.translatable("commands.fill.failed")); // ShreddedPaper - run on correct region thread - send failure message instead of throwing

shreddedpaper-server/minecraft-patches/sources/net/minecraft/server/commands/SetBlockCommand.java.patch

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
boolean flag;
1717
if (mode == SetBlockCommand.Mode.DESTROY) {
1818
level.destroyBlock(pos, true);
19-
@@ -117,15 +_,21 @@
19+
@@ -117,15 +_,16 @@
2020
BlockState blockState = level.getBlockState(pos);
2121
if (flag
2222
&& !block.place(level, pos, Block.UPDATE_CLIENTS | (strict ? Block.UPDATE_SKIP_ALL_SIDEEFFECTS : Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS))) {
@@ -27,11 +27,6 @@
2727
level.updateNeighboursOnBlockSet(pos, blockState);
2828
}
2929

30-
+ // ShreddedPaper start - clear cached chunk packet
31-
+ net.minecraft.world.level.chunk.LevelChunk chunk = level.getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4);
32-
+ if (chunk != null) chunk.cachedChunkPacket = null;
33-
+ // ShreddedPaper end - clear cached chunk packet
34-
+
3530
source.sendSuccess(() -> Component.translatable("commands.setblock.success", pos.getX(), pos.getY(), pos.getZ()), true);
3631
- return 1;
3732
}

shreddedpaper-server/minecraft-patches/sources/net/minecraft/server/level/ChunkHolder.java.patch

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
--- a/net/minecraft/server/level/ChunkHolder.java
22
+++ b/net/minecraft/server/level/ChunkHolder.java
3-
@@ -1,5 +_,10 @@
3+
@@ -1,5 +_,11 @@
44
package net.minecraft.server.level;
55

66
+import ca.spottedleaf.moonrise.common.util.TickThread;
77
+import ca.spottedleaf.moonrise.common.util.WorldUtil;
88
+import com.mojang.logging.LogUtils;
99
+import io.multipaper.shreddedpaper.region.RegionPos;
10+
+import io.multipaper.shreddedpaper.threading.ShreddedPaperChangesBroadcaster;
1011
+import io.multipaper.shreddedpaper.util.SimpleStampedLock;
1112
import it.unimi.dsi.fastutil.shorts.ShortOpenHashSet;
1213
import it.unimi.dsi.fastutil.shorts.ShortSet;

0 commit comments

Comments
 (0)