Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected tick hook position #32

Merged
merged 2 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions patches/server/0053-Leaves-Protocol-core.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ Subject: [PATCH] Leaves Protocol core
This patch is Powered by Leaves(https://github.com/LeavesMC/Leaves)
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) (https://github.com/LeavesMC/Leaves?tab=License-1-ov-file)

diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/FoliaGlobalRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/FoliaGlobalRegionScheduler.java
index d306f911757a4d556c82c0070d4837db87afc497..671616b35efe03bfa97b5f52abccdd47da06ef75 100644
--- a/src/main/java/io/papermc/paper/threadedregions/scheduler/FoliaGlobalRegionScheduler.java
+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/FoliaGlobalRegionScheduler.java
@@ -29,6 +29,8 @@ public class FoliaGlobalRegionScheduler implements GlobalRegionScheduler {
}
}
diff --git a/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java b/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
index d22d3a7e9c5bb9913e28c73c5de9a6320281710e..f80df258cd1efc7e169f9387ba381631b55cc632 100644
--- a/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
+++ b/src/main/java/io/papermc/paper/threadedregions/RegionizedServer.java
@@ -314,6 +314,8 @@ public final class RegionizedServer {

+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol
// player list
MinecraftServer.getServer().getPlayerList().tick();
+
if (run == null) {
return;
}
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol
}

private void tickPlayerSample() {
diff --git a/src/main/java/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/src/main/java/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
index 0211311b3b63bcdea7ebf7bcb24629674c771402..c05a72f4928ee2cec28a61ed06a9079d52634900 100644
--- a/src/main/java/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
Expand Down
14 changes: 6 additions & 8 deletions patches/server/0054-Leaves-Jade-protocol.patch
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ index 3df389bd7703a59ce3c862570867125f17259b2a..eebe61df39a8129f9fd4d81393004358
protected CompositeLootItemCondition(List<LootItemCondition> terms, Predicate<LootContext> predicate) {
diff --git a/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..f0187900acb70eabd3558fb4583348f68110b777
index 0000000000000000000000000000000000000000..999273c739e449e0a8d39f88bc68a651ad61f3b6
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java
@@ -0,0 +1,399 @@
@@ -0,0 +1,397 @@
+package org.leavesmc.leaves.protocol.jade;
+
+import com.mojang.logging.LogUtils;
Expand Down Expand Up @@ -333,8 +333,7 @@ index 0000000000000000000000000000000000000000..f0187900acb70eabd3558fb4583348f6
+ return;
+ }
+
+ MinecraftServer server = MinecraftServer.getServer();
+ server.execute(() -> {
+ player.getBukkitEntity().taskScheduler.schedule((c) -> {
+ Level world = player.level();
+ boolean showDetails = payload.showDetails;
+ Entity entity = world.getEntity(payload.entityId);
Expand Down Expand Up @@ -368,7 +367,7 @@ index 0000000000000000000000000000000000000000..f0187900acb70eabd3558fb4583348f6
+ tag.putInt("EntityId", entity.getId());
+
+ ProtocolUtils.sendPayloadPacket(player, new ReceiveDataPayload(tag));
+ });
+ }, null, 1);
+ }
+
+ @ProtocolHandler.PayloadReceiver(payload = RequestBlockPayload.class, payloadId = "request_block")
Expand All @@ -377,8 +376,7 @@ index 0000000000000000000000000000000000000000..f0187900acb70eabd3558fb4583348f6
+ return;
+ }
+
+ MinecraftServer server = MinecraftServer.getServer();
+ server.execute(() -> {
+ player.getBukkitEntity().taskScheduler.schedule((c) -> {
+ Level world = player.level();
+ BlockState blockState = payload.blockState;
+ Block block = blockState.getBlock();
Expand Down Expand Up @@ -422,7 +420,7 @@ index 0000000000000000000000000000000000000000..f0187900acb70eabd3558fb4583348f6
+ tag.putString("BlockId", BuiltInRegistries.BLOCK.getKey(block).toString());
+
+ ProtocolUtils.sendPayloadPacket(player, new ReceiveDataPayload(tag));
+ });
+ }, null, 1);
+ }
+
+ @ProtocolHandler.ReloadServer
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0055-Leaves-BBOR-Protocol.patch
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ index b798dbb7d22ab06c8d47c64d2db47b3d9a8fe946..b1c86ba3010f67a3a0db34b92df459bc
public Level getLevel() {
diff --git a/src/main/java/org/leavesmc/leaves/protocol/BBORProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/BBORProtocol.java
new file mode 100644
index 0000000000000000000000000000000000000000..419bcd9f9ed314af56e122965867e439147e4663
index 0000000000000000000000000000000000000000..0806e2a9d2d221ab01ba603df67117e909133414
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/protocol/BBORProtocol.java
@@ -0,0 +1,227 @@
Expand Down Expand Up @@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..419bcd9f9ed314af56e122965867e439
+ private static final ResourceLocation STRUCTURE_LIST_SYNC = id("structure_list_sync_v1");
+ // call
+ private static final Map<Integer, ServerPlayer> players = new ConcurrentHashMap<>();
+ private static final Map<Integer, Set<BBoundingBox>> playerBoundingBoxesCache = new HashMap<>();
+ private static final Map<Integer, Set<BBoundingBox>> playerBoundingBoxesCache = new ConcurrentHashMap<>();
+ private static final Map<ResourceLocation, Map<BBoundingBox, Set<BBoundingBox>>> dimensionCache = new ConcurrentHashMap<>();
+
+ @Contract("_ -> new")
Expand Down