diff --git a/1todos/server/minecraft-patches/features/0009-Leaves-Base-Protocol-Core.patch b/lophine-server/minecraft-patches/features/0017-Leaves-Leaves-Base-Protocol-Core.patch similarity index 55% rename from 1todos/server/minecraft-patches/features/0009-Leaves-Base-Protocol-Core.patch rename to lophine-server/minecraft-patches/features/0017-Leaves-Leaves-Base-Protocol-Core.patch index 8d6b19f..367eb3b 100644 --- a/1todos/server/minecraft-patches/features/0009-Leaves-Base-Protocol-Core.patch +++ b/lophine-server/minecraft-patches/features/0017-Leaves-Leaves-Base-Protocol-Core.patch @@ -1,66 +1,66 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Helvetica Volubi Date: Sun, 3 Aug 2025 15:24:01 +0800 -Subject: [PATCH] Leaves: Base Protocol Core +Subject: [PATCH] Leaves: Leaves Base Protocol Core Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com> -As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/ea91106ae57fc4cc14e2e0225009cf9919072f7f/leaves-server/minecraft-patches/features/0004-Leaves-Protocol-Core.patch) +As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/9d2bd3f7b0a48f00df7bc8c74292338ed9c3a458/leaves-server/minecraft-patches/features/0122-Leaves-Protocol-Core.patch) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) -diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java -index 80b5d151e0dd6fa44794187875b4b80519839d81..8d32d906f87a1cb866a7497ee0de3045e9adce2c 100644 ---- a/io/papermc/paper/threadedregions/RegionizedServer.java -+++ b/io/papermc/paper/threadedregions/RegionizedServer.java -@@ -369,6 +369,8 @@ public final class RegionizedServer { - } - // Luminol end - Add a config to enable tick command - -+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol -+ - // tick connections - this.tickConnections(); - diff --git a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java -index 1da034752064312962a4144f91be5265a9a08997..081ca42b6a6644eb8c2b5ac9105fecf8ad39d501 100644 +index e9f86409bf9351e85ed31e747d9350dbf0cc441f..1f8f4d979d8766d6ba385f74cf8fcf8eea6c56c7 100644 --- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java +++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java @@ -40,13 +40,22 @@ public interface CustomPacketPayload { @Override - public void encode(B buffer, CustomPacketPayload value) { + public void encode(final B output, final CustomPacketPayload value) { + // Leaves start - protocol core + if (value instanceof org.leavesmc.leaves.protocol.core.LeavesCustomPayload payload) { -+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.encode(buffer, payload); ++ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.encode(output, payload); + return; + } + // Leaves end - protocol core - this.writeCap(buffer, value.type(), value); + this.writeCap(output, value.type(), value); } @Override - public CustomPacketPayload decode(B buffer) { - Identifier identifier = buffer.readIdentifier(); -- return (CustomPacketPayload)this.findCodec(identifier).decode(buffer); + public CustomPacketPayload decode(final B input) { + Identifier identifier = input.readIdentifier(); +- return (CustomPacketPayload)this.findCodec(identifier).decode(input); + // Leaves start - protocol core -+ var payload = org.leavesmc.leaves.protocol.core.LeavesProtocolManager.decode(identifier, buffer); -+ return java.util.Objects.requireNonNullElseGet(payload, () -> this.findCodec(identifier).decode(buffer)); ++ var payload = org.leavesmc.leaves.protocol.core.LeavesProtocolManager.decode(identifier, input); ++ return java.util.Objects.requireNonNullElseGet(payload, () -> (CustomPacketPayload) this.findCodec(identifier).decode(input)); + // Leaves end - protocol core } }; } +diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java +index 8dcd684189d953aabddc4f62a3ecc5807c949ce6..0bedaa20bc2cae75a48357e69740ada2380a03dd 100644 +--- a/net/minecraft/server/MinecraftServer.java ++++ b/net/minecraft/server/MinecraftServer.java +@@ -2037,6 +2037,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginMessagerChannels; // Paper end - retain certain values + public final GameProfile profile; // Leaves - protocol core - public ServerCommonPacketListenerImpl(MinecraftServer server, Connection connection, CommonListenerCookie cookie) { + public ServerCommonPacketListenerImpl(final MinecraftServer server, final Connection connection, final CommonListenerCookie cookie) { this.server = server; -@@ -71,6 +72,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -70,6 +71,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack this.pluginMessagerChannels = cookie.channels(); this.keepAlive = cookie.keepAlive(); // Paper end @@ -68,10 +68,10 @@ index 0bf2173c5445de021090c2d0264afc440b005bdc..076bfe7a7b57f8d3b29ef0aaad117707 } // Paper start - configuration phase API -@@ -161,6 +163,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -143,6 +145,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @Override - public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { + public void handleCustomPayload(final ServerboundCustomPayloadPacket packet) { + // Leaves start - protocol + if (packet.payload() instanceof org.leavesmc.leaves.protocol.core.LeavesCustomPayload leavesPayload) { + org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePayload(org.leavesmc.leaves.protocol.core.ProtocolUtils.createSelector(this), leavesPayload); @@ -87,7 +87,7 @@ index 0bf2173c5445de021090c2d0264afc440b005bdc..076bfe7a7b57f8d3b29ef0aaad117707 // Paper start if (!(packet.payload() instanceof final net.minecraft.network.protocol.common.custom.DiscardedPayload discardedPayload)) { return; -@@ -220,10 +234,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -202,6 +216,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack final String channel = new String(data, from, length, java.nio.charset.StandardCharsets.US_ASCII); if (register) { bridge.addChannel(channel); @@ -95,63 +95,30 @@ index 0bf2173c5445de021090c2d0264afc440b005bdc..076bfe7a7b57f8d3b29ef0aaad117707 } else { bridge.removeChannel(channel); } -- // Paper end -+ // Paper end - } - - @Override -@@ -386,9 +401,9 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - net.minecraft.server.level.ServerPlayer player = serverGamePacketListener.player; - org.bukkit.event.player.PlayerKickEvent.Cause cause = disconnectionDetails.disconnectionReason().orElseThrow().game().orElse(org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); - org.bukkit.event.player.PlayerKickEvent event = new org.bukkit.event.player.PlayerKickEvent( -- player.getBukkitEntity(), -- io.papermc.paper.adventure.PaperAdventure.asAdventure(disconnectionDetails.reason()), -- rawLeaveMessage, cause -+ player.getBukkitEntity(), -+ io.papermc.paper.adventure.PaperAdventure.asAdventure(disconnectionDetails.reason()), -+ rawLeaveMessage, cause - - ); - -@@ -421,10 +436,10 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - - private void disconnect0(DisconnectionDetails disconnectionDetails) { - this.connection -- .send( -- new ClientboundDisconnectPacket(disconnectionDetails.reason()), -- PacketSendListener.thenRun(() -> this.connection.disconnect(disconnectionDetails)) -- ); -+ .send( -+ new ClientboundDisconnectPacket(disconnectionDetails.reason()), -+ PacketSendListener.thenRun(() -> this.connection.disconnect(disconnectionDetails)) -+ ); - this.onDisconnect(disconnectionDetails); - this.connection.setReadOnly(); - // CraftBukkit - Don't wait diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index d2b2bf35b3f5704f3bca94d0fe3b70206c2fbf96..c8be04b8a50bac52150a1fdd238634e630e1765e 100644 +index 527c495bb4f6007aee760b99cc0e9aa589931f4b..e6987eaf6e4d36d43cee4ece3ce22d31052a2a2a 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -315,6 +315,8 @@ public abstract class PlayerList { +@@ -317,6 +317,8 @@ public abstract class PlayerList { //return; // Folia - region threading - must still allow the player to connect, as we must add to chunk map before handling disconnect } -+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); ++ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol + final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage(); if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure -@@ -511,6 +513,7 @@ public abstract class PlayerList { +@@ -517,6 +519,7 @@ public abstract class PlayerList { return this.remove(player, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? player.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(player.getDisplayName()))); } - public net.kyori.adventure.text.@Nullable Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) { + public net.kyori.adventure.text.@Nullable Component remove(final ServerPlayer player, final net.kyori.adventure.text.Component leaveMessage) { + org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerLeave(player); // Leaves - protocol // Paper end - Fix kick event leave message not being sent - ServerLevel serverLevel = player.level(); + ServerLevel level = player.level(); player.awardStat(Stats.LEAVE_GAME); -@@ -1401,6 +1404,7 @@ public abstract class PlayerList { - serverPlayer.connection.send(clientboundUpdateRecipesPacket); - serverPlayer.getRecipeBook().sendInitialRecipeBook(serverPlayer); +@@ -1411,6 +1414,7 @@ public abstract class PlayerList { + player.connection.send(recipes); + player.getRecipeBook().sendInitialRecipeBook(player); } + org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleDataPackReload(); // Leaves - protocol core } diff --git a/1todos/server/minecraft-patches/features/0010-Leaves-Configurable-trading-with-the-void.patch b/lophine-server/minecraft-patches/features/0018-Leaves-Configurable-trading-with-the-void.patch similarity index 72% rename from 1todos/server/minecraft-patches/features/0010-Leaves-Configurable-trading-with-the-void.patch rename to lophine-server/minecraft-patches/features/0018-Leaves-Configurable-trading-with-the-void.patch index c474940..8bb6a46 100644 --- a/1todos/server/minecraft-patches/features/0010-Leaves-Configurable-trading-with-the-void.patch +++ b/lophine-server/minecraft-patches/features/0018-Leaves-Configurable-trading-with-the-void.patch @@ -4,14 +4,14 @@ Date: Wed, 29 Oct 2025 00:09:09 +0800 Subject: [PATCH] Leaves: Configurable trading with the void Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com> -As a part of : Leaves (https://github.com/LeavesMC/Leaves) +As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/9d2bd3f7b0a48f00df7bc8c74292338ed9c3a458/leaves-server/minecraft-patches/features/0088-Configurable-trading-with-the-void.patch) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index b0546cb4af7291013399e67d98bced98a5fffc0f..bf340425dc2a1545b9069badcf054d4c2f6a405f 100644 +index c380ab9f059da6219691e8bccd4f82b9ec5483b3..b2ea90b0ab461d202d492411471d2412a9c5d303 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -3058,7 +3058,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -3158,7 +3158,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet // Spigot start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message // Paper start - Fix merchant inventory not closing on entity removal @@ -21,26 +21,26 @@ index b0546cb4af7291013399e67d98bced98a5fffc0f..bf340425dc2a1545b9069badcf054d4c } // Paper end - Fix merchant inventory not closing on entity removal diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index c8be04b8a50bac52150a1fdd238634e630e1765e..2eb551390aa66d89988df9ca23cf0dd7ccfd6577 100644 +index e6987eaf6e4d36d43cee4ece3ce22d31052a2a2a..168702a5ae51a2bc42c5761e13cb14008a8162c4 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -555,7 +555,7 @@ public abstract class PlayerList { +@@ -560,7 +560,7 @@ public abstract class PlayerList { player.stopRiding(); - rootVehicle.getPassengersAndSelf().forEach(entity -> { + vehicle.getPassengersAndSelf().forEach(e -> { // Paper start - Fix villager boat exploit -- if (entity instanceof net.minecraft.world.entity.npc.villager.AbstractVillager villager) { -+ if (!fun.bm.lophine.config.modules.function.OldFeatureConfig.villagerVoidTrade && entity instanceof net.minecraft.world.entity.npc.villager.AbstractVillager villager) { // Leaves - Configurable trading with the void +- if (e instanceof net.minecraft.world.entity.npc.villager.AbstractVillager villager) { ++ if (!fun.bm.lophine.config.modules.function.OldFeatureConfig.villagerVoidTrade && e instanceof net.minecraft.world.entity.npc.villager.AbstractVillager villager) { // Leaves - Configurable trading with the void final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer(); if (human != null) { villager.setTradingPlayer(null); diff --git a/net/minecraft/world/inventory/MerchantMenu.java b/net/minecraft/world/inventory/MerchantMenu.java -index 6dfee62a46a5882df7f405e59d762647289d7866..1192a6ab33a9481397b84c9cf0a24fbbcb0ed065 100644 +index 1dd82dfa739957f00d51c8b987289a002815f622..85a329565119d376139a7449e538c0d83dfb079f 100644 --- a/net/minecraft/world/inventory/MerchantMenu.java +++ b/net/minecraft/world/inventory/MerchantMenu.java @@ -74,6 +74,7 @@ public class MerchantMenu extends AbstractContainerMenu { @Override - public boolean stillValid(Player player) { + public boolean stillValid(final Player player) { + if (fun.bm.lophine.config.modules.function.OldFeatureConfig.villagerVoidTrade) return this.trader.getTradingPlayer() == player; // Leaves - Configurable trading with the void if (!checkReachable) return true; // Paper - checkReachable return this.trader.stillValid(player); diff --git a/1todos/server/minecraft-patches/features/0015-Leaves-Servux-Protocol.patch b/lophine-server/minecraft-patches/features/0019-Leaves-Servux-Protocol.patch similarity index 80% rename from 1todos/server/minecraft-patches/features/0015-Leaves-Servux-Protocol.patch rename to lophine-server/minecraft-patches/features/0019-Leaves-Servux-Protocol.patch index f6fb5c6..86c4355 100644 --- a/1todos/server/minecraft-patches/features/0015-Leaves-Servux-Protocol.patch +++ b/lophine-server/minecraft-patches/features/0019-Leaves-Servux-Protocol.patch @@ -8,10 +8,10 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/ea91106ae57fc4cc1 Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/server/ServerTickRateManager.java b/net/minecraft/server/ServerTickRateManager.java -index 95f6b1cbd5e33151c326689bc72292ff38a48803..e1974bbebbd10b75ea02955d9ced198d54c8a6f1 100644 +index afcab27006558f5d379df723968a612c1cadba60..ddab99a4cc70a1aa365208cb52d8d9b880cdeff6 100644 --- a/net/minecraft/server/ServerTickRateManager.java +++ b/net/minecraft/server/ServerTickRateManager.java -@@ -135,4 +135,10 @@ public class ServerTickRateManager extends TickRateManager { +@@ -139,4 +139,10 @@ public class ServerTickRateManager extends TickRateManager { player.connection.send(ClientboundTickingStatePacket.from(this)); player.connection.send(ClientboundTickingStepPacket.from(this)); } @@ -23,10 +23,10 @@ index 95f6b1cbd5e33151c326689bc72292ff38a48803..e1974bbebbd10b75ea02955d9ced198d + // Leaves end - servux } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index bf340425dc2a1545b9069badcf054d4c2f6a405f..eb5722848d1c77044807510cd6a46a46c5763509 100644 +index b2ea90b0ab461d202d492411471d2412a9c5d303..049339ae33569d627d2a00ef6cab9cad02c4c014 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -2491,6 +2491,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2584,6 +2584,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet this.server.updateEffectiveRespawnData(); } // Paper end diff --git a/1todos/server/minecraft-patches/features/0016-LeavesHooks.patch b/lophine-server/minecraft-patches/features/0020-LeavesHooks.patch similarity index 89% rename from 1todos/server/minecraft-patches/features/0016-LeavesHooks.patch rename to lophine-server/minecraft-patches/features/0020-LeavesHooks.patch index 75786c8..0d1ac85 100644 --- a/1todos/server/minecraft-patches/features/0016-LeavesHooks.patch +++ b/lophine-server/minecraft-patches/features/0020-LeavesHooks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] LeavesHooks diff --git a/ca/spottedleaf/moonrise/paper/PaperHooks.java b/ca/spottedleaf/moonrise/paper/PaperHooks.java -index faf62f8c9453f8e7a21b1e141577f1f4539cd2f9..4e5985a3e4969f466980558190324350019ba8af 100644 +index d097b889499a8e410839e8f69d99dc9adfa2488b..b97d65b81ec4b86e00b7c06341b40dc5c02b9044 100644 --- a/ca/spottedleaf/moonrise/paper/PaperHooks.java +++ b/ca/spottedleaf/moonrise/paper/PaperHooks.java @@ -29,7 +29,7 @@ import net.minecraft.world.phys.AABB; diff --git a/1todos/server/minecraft-patches/features/0012-Leaves-Old-Explosion-Damage-Calculator.patch b/lophine-server/minecraft-patches/features/0021-Leaves-Old-Explosion-Damage-Calculator.patch similarity index 55% rename from 1todos/server/minecraft-patches/features/0012-Leaves-Old-Explosion-Damage-Calculator.patch rename to lophine-server/minecraft-patches/features/0021-Leaves-Old-Explosion-Damage-Calculator.patch index f10540c..f20645a 100644 --- a/1todos/server/minecraft-patches/features/0012-Leaves-Old-Explosion-Damage-Calculator.patch +++ b/lophine-server/minecraft-patches/features/0021-Leaves-Old-Explosion-Damage-Calculator.patch @@ -8,14 +8,14 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/3e96b237749a960f2 Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 08a1be57e1057a9e961eeb8f59cd12e98ed52bab..33ee967d8a7d4ce2c455db9ffaac740cd589e6f3 100644 +index 769dc39e11881d5f81a2405850cbcbd0842c5995..9fc97e8b01f66ada6af1fe76f4e27c9bb1a5dcfc 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -717,6 +717,7 @@ public class ServerExplosion implements Explosion { +@@ -708,6 +708,7 @@ public class ServerExplosion implements Explosion { public boolean shouldAffectBlocklikeEntities() { - boolean flag = this.level.getGameRules().get(GameRules.MOB_GRIEFING); - boolean flag1 = this.source == null || this.source.getType() != EntityType.BREEZE_WIND_CHARGE && this.source.getType() != EntityType.WIND_CHARGE; -+ if (fun.bm.lophine.config.modules.function.OldFeatureConfig.oldExplosionDamageCalculator) flag1 = flag1 && (this.source == null || !this.source.isInWater()); // Leaves - Old MC TNT wet explosion no item damage - return flag ? flag1 : this.blockInteraction.shouldAffectBlocklikeEntities() && flag1; + boolean mobGriefingEnabled = this.level.getGameRules().get(GameRules.MOB_GRIEFING); + boolean isNotWindCharge = this.source == null || !this.source.is(EntityType.BREEZE_WIND_CHARGE) && !this.source.is(EntityType.WIND_CHARGE); ++ if (fun.bm.lophine.config.modules.function.OldFeatureConfig.oldExplosionDamageCalculator) isNotWindCharge = isNotWindCharge && (this.source == null || !this.source.isInWater()); // Leaves - Old MC TNT wet explosion no item damage + return mobGriefingEnabled ? isNotWindCharge : this.blockInteraction.shouldAffectBlocklikeEntities() && isNotWindCharge; } diff --git a/1todos/server/minecraft-patches/features/0014-Leaves-Redstone-Shears-Wrench.patch b/lophine-server/minecraft-patches/features/0022-Leaves-Redstone-Shears-Wrench.patch similarity index 88% rename from 1todos/server/minecraft-patches/features/0014-Leaves-Redstone-Shears-Wrench.patch rename to lophine-server/minecraft-patches/features/0022-Leaves-Redstone-Shears-Wrench.patch index f2e9257..f1dd369 100644 --- a/1todos/server/minecraft-patches/features/0014-Leaves-Redstone-Shears-Wrench.patch +++ b/lophine-server/minecraft-patches/features/0022-Leaves-Redstone-Shears-Wrench.patch @@ -8,7 +8,7 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/79d9ef74c2684eb49 Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/item/ShearsItem.java b/net/minecraft/world/item/ShearsItem.java -index 5e25ddf78f72ada318ef28d29199de9b93fe667e..6f48162a25e20d2439935e8995cede9497626322 100644 +index 837f8c56bf5d68dd8bfbeca8ae1b66be8316ddea..1098695e646c20f47bc4739034fcb69b96909667 100644 --- a/net/minecraft/world/item/ShearsItem.java +++ b/net/minecraft/world/item/ShearsItem.java @@ -80,7 +80,10 @@ public class ShearsItem extends Item { @@ -17,7 +17,7 @@ index 5e25ddf78f72ada318ef28d29199de9b93fe667e..6f48162a25e20d2439935e8995cede94 } else { - return super.useOn(context); + // Leaves start - shears wrench -+ InteractionResult result = org.leavesmc.leaves.util.ShearsWrenchUtil.tryApplyRotate(context, blockState); ++ InteractionResult result = org.leavesmc.leaves.util.ShearsWrenchUtil.tryApplyRotate(context, state); + return result == null ? super.useOn(context) : result; + // Leaves end - shears wrench } diff --git a/1todos/server/paper-patches/features/0003-Leaves-Leaves-Protocol-Core.patch b/lophine-server/paper-patches/features/0004-Leaves-Leaves-Base-Protocol-Core.patch similarity index 80% rename from 1todos/server/paper-patches/features/0003-Leaves-Leaves-Protocol-Core.patch rename to lophine-server/paper-patches/features/0004-Leaves-Leaves-Base-Protocol-Core.patch index 256f84a..a62be7e 100644 --- a/1todos/server/paper-patches/features/0003-Leaves-Leaves-Protocol-Core.patch +++ b/lophine-server/paper-patches/features/0004-Leaves-Leaves-Base-Protocol-Core.patch @@ -1,17 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Helvetica Volubi Date: Sun, 3 Aug 2025 15:57:08 +0800 -Subject: [PATCH] Leaves: Leaves Protocol Core +Subject: [PATCH] Leaves: Leaves Base Protocol Core Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com> -As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/ea91106ae57fc4cc14e2e0225009cf9919072f7f/leaves-server/paper-patches/features/0004-Leaves-Protocol-Core.patch) +As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/3e7f4a313ff0d2469dd7feae36304f0c8994cba1/leaves-server/paper-patches/features/0004-Leaves-Protocol-Core.patch) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 507204301b5e3cd545e66c510842c0a6391f0241..dfcfc83474443638e30f87d54472e5a38947dfad 100644 +index 20bebf72768968d90f27f812456796cf81f46626..479bbc4a63c237c055f6b4d659c598e9fadd512a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -485,6 +485,7 @@ public final class CraftServer implements Server { +@@ -483,6 +483,7 @@ public final class CraftServer implements Server { this.potionBrewer = new io.papermc.paper.potion.PaperPotionBrewer(console); // Paper - custom potion mixes datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper if (false) this.spark = new io.papermc.paper.SparksFly(this); // Paper - spark // Luminol - Force disable builtin spark @@ -19,7 +19,7 @@ index 507204301b5e3cd545e66c510842c0a6391f0241..dfcfc83474443638e30f87d54472e5a3 } public boolean getCommandBlockOverride(String command) { -@@ -1059,6 +1060,7 @@ public final class CraftServer implements Server { +@@ -1057,6 +1058,7 @@ public final class CraftServer implements Server { if (false) this.spark.registerCommandBeforePlugins(this); // Paper - spark // Luminol - Force disable builtin spark this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); diff --git a/1todos/server/paper-patches/features/0004-LeavesHooks.patch b/lophine-server/paper-patches/features/0005-LeavesHooks.patch similarity index 100% rename from 1todos/server/paper-patches/features/0004-LeavesHooks.patch rename to lophine-server/paper-patches/features/0005-LeavesHooks.patch diff --git a/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/OldFeatureConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/OldFeatureConfig.java index 3d23782..30f6ba3 100644 --- a/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/OldFeatureConfig.java +++ b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/OldFeatureConfig.java @@ -13,14 +13,14 @@ public class OldFeatureConfig implements IConfigModule { @ConfigInfo(name = "old_zombie_reinforcement") public static boolean oldZombieReinforcement = false; -// @ConfigInfo(name = "old_explosion_damage_calculator") -// public static boolean oldExplosionDamageCalculator = false; + @ConfigInfo(name = "old_explosion_damage_calculator") + public static boolean oldExplosionDamageCalculator = false; @ConfigInfo(name = "old_raid_behavior") public static boolean oldRaidBehavior = false; -// @ConfigInfo(name = "villager-void-trade", comments = -// """ -// Allow villager void trade.""") -// public static boolean villagerVoidTrade = false; + @ConfigInfo(name = "villager-void-trade", comments = + """ + Allow villager void trade.""") + public static boolean villagerVoidTrade = false; } \ No newline at end of file diff --git a/1todos/server/config-files/function/RedStoneConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/RedStoneConfig.java similarity index 79% rename from 1todos/server/config-files/function/RedStoneConfig.java rename to lophine-server/src/main/java/fun/bm/lophine/config/modules/function/RedStoneConfig.java index e3185be..bcf12a9 100644 --- a/1todos/server/config-files/function/RedStoneConfig.java +++ b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/RedStoneConfig.java @@ -8,8 +8,6 @@ import me.earthme.luminol.enums.EnumConfigCategory; @ConfigClassInfo(category = EnumConfigCategory.FUNCTION, name = "redstone") public class RedStoneConfig implements IConfigModule { - @TransformedConfig(name = "shears_rotate", directory = {"misc", "redstone"}) - @TransformedConfig(name = "allow_skip_cooldown", directory = {"misc", "redstone"}) @ConfigInfo(name = "shears_rotate", comments = """ Allows you to use the Shears to right-click to rotate the block.""") diff --git a/1todos/server/config-files/function/protocol/ServuxProtocolConfig.java b/lophine-server/src/main/java/fun/bm/lophine/config/modules/function/protocol/ServuxProtocolConfig.java similarity index 100% rename from 1todos/server/config-files/function/protocol/ServuxProtocolConfig.java rename to lophine-server/src/main/java/fun/bm/lophine/config/modules/function/protocol/ServuxProtocolConfig.java diff --git a/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/AbstractConcurrentTable.java b/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/AbstractConcurrentTable.java new file mode 100644 index 0000000..ee3c40f --- /dev/null +++ b/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/AbstractConcurrentTable.java @@ -0,0 +1,36 @@ +package fun.bm.lophine.utils.concurrent; + +import java.util.List; +import java.util.Map; + +public abstract class AbstractConcurrentTable { + public abstract void put(X x, Y y, Z z); + + public abstract void remove(X x, Y y, Z z); + + public abstract List getZ(X x, Y y); + + public abstract List getY(X x, Z z); + + public abstract List getX(Y y, Z z); + + public abstract Map getXY(Z z); + + public abstract Map getYZ(X x); + + public abstract Map getXZ(Y y); + + public abstract List getAllX(); + + public abstract List getAllY(); + + public abstract List getAllZ(); + + public abstract void clearXY(Z z); + + public abstract void clearYZ(X x); + + public abstract void clearXZ(Y y); + + public abstract void clearAll(); +} diff --git a/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/ConcurrentTable.java b/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/ConcurrentTable.java new file mode 100644 index 0000000..0b350e1 --- /dev/null +++ b/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/ConcurrentTable.java @@ -0,0 +1,182 @@ +package fun.bm.lophine.utils.concurrent; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentLinkedDeque; +import java.util.function.Predicate; + +public class ConcurrentTable extends AbstractConcurrentTable { + protected final ConcurrentLinkedDeque> data = new ConcurrentLinkedDeque<>(); + protected final boolean flagX; + protected final boolean flagY; + protected final boolean flagZ; + + public ConcurrentTable() { + this(false, false, false); + } + + public ConcurrentTable(boolean flagX, boolean flagY, boolean flagZ) { + this.flagX = flagX; + this.flagY = flagY; + this.flagZ = flagZ; + } + + @Override + public void put(X x, Y y, Z z) { + put(x, y, z, false); + } + + public void put(X x, Y y, Z z, boolean flag) { + if (!flag) { + if (flagX) { + List datas = getX(y, z); + for (X x1 : datas) { + if (!x1.equals(x)) { + remove(x1, y, z); + } + } + } + if (flagY) { + List datas = getY(x, z); + for (Y y1 : datas) { + if (!y1.equals(y)) { + remove(x, y1, z); + } + } + } + if (flagZ) { + List datas = getZ(x, y); + for (Z z1 : datas) { + if (!z1.equals(z)) { + remove(x, y, z1); + } + } + } + } + data.add(new TableEntry<>(x, y, z)); + } + + @Override + public void remove(X x, Y y, Z z) { + data.removeIf(entry -> entry.getX().equals(x) && entry.getY().equals(y) && entry.getZ().equals(z)); + } + + @Override + public List getZ(X x, Y y) { + return filterAndCollect( + entry -> entry.getX().equals(x) && entry.getY().equals(y), + TableEntry::getZ + ); + } + + @Override + public List getY(X x, Z z) { + return filterAndCollect( + entry -> entry.getX().equals(x) && entry.getZ().equals(z), + TableEntry::getY + ); + } + + @Override + public List getX(Y y, Z z) { + return filterAndCollect( + entry -> entry.getY().equals(y) && entry.getZ().equals(z), + TableEntry::getX + ); + } + + @Override + public Map getXY(Z z) { + return filterAndMap( + entry -> entry.getZ().equals(z), + TableEntry::getX, + TableEntry::getY + ); + } + + @Override + public Map getYZ(X x) { + return filterAndMap( + entry -> entry.getX().equals(x), + TableEntry::getY, + TableEntry::getZ + ); + } + + @Override + public Map getXZ(Y y) { + return filterAndMap( + entry -> entry.getY().equals(y), + TableEntry::getX, + TableEntry::getZ + ); + } + + @Override + public List getAllX() { + return collectAll(TableEntry::getX); + } + + @Override + public List getAllY() { + return collectAll(TableEntry::getY); + } + + @Override + public List getAllZ() { + return collectAll(TableEntry::getZ); + } + + @Override + public void clearXY(Z z) { + data.removeIf(entry -> entry.getZ().equals(z)); + } + + @Override + public void clearYZ(X x) { + data.removeIf(entry -> entry.getX().equals(x)); + } + + @Override + public void clearXZ(Y y) { + data.removeIf(entry -> entry.getY().equals(y)); + } + + @Override + public void clearAll() { + data.clear(); + } + + private List filterAndCollect(Predicate> filter, + java.util.function.Function, T> mapper) { + List result = new ArrayList<>(); + for (TableEntry entry : data) { + if (filter.test(entry)) { + result.add(mapper.apply(entry)); + } + } + return result; + } + + private Map filterAndMap(Predicate> filter, + java.util.function.Function, K> keyMapper, + java.util.function.Function, V> valueMapper) { + Map map = new HashMap<>(); + for (TableEntry entry : data) { + if (filter.test(entry)) { + map.put(keyMapper.apply(entry), valueMapper.apply(entry)); + } + } + return map; + } + + private List collectAll(java.util.function.Function, T> mapper) { + List result = new ArrayList<>(); + for (TableEntry entry : data) { + result.add(mapper.apply(entry)); + } + return result; + } +} diff --git a/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/OptimizedConcurrentTable.java b/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/OptimizedConcurrentTable.java new file mode 100644 index 0000000..2b701fa --- /dev/null +++ b/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/OptimizedConcurrentTable.java @@ -0,0 +1,207 @@ +package fun.bm.lophine.utils.concurrent; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.function.Predicate; + +public class OptimizedConcurrentTable extends ConcurrentTable { + private final ConcurrentHashMap>> xyIndex = new ConcurrentHashMap<>(); + private final ConcurrentHashMap>> yzIndex = new ConcurrentHashMap<>(); + private final ConcurrentHashMap>> zxIndex = new ConcurrentHashMap<>(); + + public OptimizedConcurrentTable() { + super(); + } + + public OptimizedConcurrentTable(boolean flagX, boolean flagY, boolean flagZ) { + super(flagX, flagY, flagZ); + } + + @Override + public void put(X x, Y y, Z z) { + if (flagX) { + List datas = getX(y, z); + for (X x1 : datas) { + if (!x1.equals(x)) { + remove(x1, y, z); + } + } + } + if (flagY) { + List datas = getY(x, z); + for (Y y1 : datas) { + if (!y1.equals(y)) { + remove(x, y1, z); + } + } + } + if (flagZ) { + List datas = getZ(x, y); + for (Z z1 : datas) { + if (!z1.equals(z)) { + remove(x, y, z1); + } + } + } + super.put(x, y, z, true); + xyIndex.computeIfAbsent(x, k -> new ConcurrentHashMap<>()) + .computeIfAbsent(y, k -> ConcurrentHashMap.newKeySet()).add(z); + yzIndex.computeIfAbsent(y, k -> new ConcurrentHashMap<>()) + .computeIfAbsent(z, k -> ConcurrentHashMap.newKeySet()).add(x); + zxIndex.computeIfAbsent(z, k -> new ConcurrentHashMap<>()) + .computeIfAbsent(x, k -> ConcurrentHashMap.newKeySet()).add(y); + } + + @Override + public void remove(X x, Y y, Z z) { + super.remove(x, y, z); + removeFromIndex(xyIndex, x, y, z); + removeFromIndex(yzIndex, y, z, x); + removeFromIndex(zxIndex, z, x, y); + } + + private void removeFromIndex(ConcurrentHashMap>> index, + K key1, V key2, T value) { + index.computeIfPresent(key1, (k, map) -> { + map.computeIfPresent(key2, (k2, set) -> { + set.remove(value); + return set.isEmpty() ? null : set; + }); + return map.isEmpty() ? null : map; + }); + } + + public void removeAll(Predicate> predicate) { + data.removeIf(entry -> { + boolean shouldRemove = predicate.test(entry); + if (shouldRemove) { + removeFromIndex(xyIndex, entry.getX(), entry.getY(), entry.getZ()); + removeFromIndex(yzIndex, entry.getY(), entry.getZ(), entry.getX()); + removeFromIndex(zxIndex, entry.getZ(), entry.getX(), entry.getY()); + } + return shouldRemove; + }); + } + + public boolean putIfAbsent(X x, Y y, Z z) { + if (data.stream().anyMatch(entry -> + Objects.equals(entry.getX(), x) && + Objects.equals(entry.getY(), y) && + Objects.equals(entry.getZ(), z))) { + return false; + } + put(x, y, z); + return true; + } + + @Override + public List getZ(X x, Y y) { + Set result = xyIndex.getOrDefault(x, new ConcurrentHashMap<>()).get(y); + return result != null ? new ArrayList<>(result) : new ArrayList<>(); + } + + @Override + public List getY(X x, Z z) { + Set result = zxIndex.getOrDefault(z, new ConcurrentHashMap<>()).get(x); + return result != null ? new ArrayList<>(result) : new ArrayList<>(); + } + + public List getX(Y y, Z z) { + Set result = yzIndex.getOrDefault(y, new ConcurrentHashMap<>()).get(z); + return result != null ? new ArrayList<>(result) : new ArrayList<>(); + } + + @Override + public Map getXY(Z z) { + return buildMapFromIndex(zxIndex.get(z), Function.identity(), Function.identity()); + } + + @Override + public Map getYZ(X x) { + return buildMapFromIndex(xyIndex.get(x), Function.identity(), Function.identity()); + } + + @Override + public Map getXZ(Y y) { + return reverseMapFromIndex(yzIndex.get(y)); + } + + @Override + public List getAllX() { + Set resultSet = new HashSet<>(xyIndex.keySet()); + return new ArrayList<>(resultSet); + } + + @Override + public List getAllY() { + Set resultSet = new HashSet<>(yzIndex.keySet()); + return new ArrayList<>(resultSet); + } + + @Override + public List getAllZ() { + Set resultSet = new HashSet<>(zxIndex.keySet()); + return new ArrayList<>(resultSet); + } + + + @Override + public void clearXY(Z z) { + super.clearXY(z); + zxIndex.remove(z); + } + + @Override + public void clearYZ(X x) { + super.clearYZ(x); + xyIndex.remove(x); + } + + @Override + public void clearXZ(Y y) { + super.clearXZ(y); + yzIndex.remove(y); + } + + @Override + public void clearAll() { + super.clearAll(); + xyIndex.clear(); + yzIndex.clear(); + zxIndex.clear(); + } + + + private Map buildMapFromIndex(ConcurrentHashMap> indexMap, java.util.function.Function keyMapper, java.util.function.Function valueMapper) { + Map result = new HashMap<>(); + if (indexMap != null) { + for (Map.Entry> entry : indexMap.entrySet()) { + K key = entry.getKey(); + Set valueSet = entry.getValue(); + if (valueSet != null && !valueSet.isEmpty()) { + for (V value : valueSet) { + result.put(keyMapper.apply(key), valueMapper.apply(value)); + } + } + } + } + return result; + } + + private Map reverseMapFromIndex(ConcurrentHashMap> indexMap) { + Map result = new HashMap<>(); + if (indexMap != null) { + for (Map.Entry> entry : indexMap.entrySet()) { + K key = entry.getKey(); + Set valueSet = entry.getValue(); + if (valueSet != null && !valueSet.isEmpty()) { + for (V value : valueSet) { + result.put(value, key); + } + } + } + } + return result; + } +} diff --git a/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/TableEntry.java b/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/TableEntry.java new file mode 100644 index 0000000..391ee37 --- /dev/null +++ b/lophine-server/src/main/java/fun/bm/lophine/utils/concurrent/TableEntry.java @@ -0,0 +1,25 @@ +package fun.bm.lophine.utils.concurrent; + +public class TableEntry { + private final X x; + private final Y y; + private final Z z; + + public TableEntry(X x, Y y, Z z) { + this.x = x; + this.y = y; + this.z = z; + } + + public X getX() { + return x; + } + + public Y getY() { + return y; + } + + public Z getZ() { + return z; + } +} diff --git a/1todos/server/src/leaves/protocol/core/Context.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/Context.java similarity index 87% rename from 1todos/server/src/leaves/protocol/core/Context.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/Context.java index 43e8433..a9a426c 100644 --- a/1todos/server/src/leaves/protocol/core/Context.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/Context.java @@ -19,8 +19,6 @@ package org.leavesmc.leaves.protocol.core; import com.mojang.authlib.GameProfile; import net.minecraft.network.Connection; -import org.jetbrains.annotations.NotNull; - -public record Context(@NotNull GameProfile profile, Connection connection) { +public record Context(GameProfile profile, Connection connection) { } diff --git a/1todos/server/src/leaves/protocol/core/IdentifierSelector.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/IdentifierSelector.java similarity index 100% rename from 1todos/server/src/leaves/protocol/core/IdentifierSelector.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/IdentifierSelector.java diff --git a/1todos/server/src/leaves/protocol/core/LeavesCustomPayload.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java similarity index 99% rename from 1todos/server/src/leaves/protocol/core/LeavesCustomPayload.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java index be5e1b6..79d8081 100644 --- a/1todos/server/src/leaves/protocol/core/LeavesCustomPayload.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java @@ -15,7 +15,6 @@ * along with Leaves. If not, see . */ - package org.leavesmc.leaves.protocol.core; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; diff --git a/1todos/server/src/leaves/protocol/core/LeavesProtocol.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocol.java similarity index 99% rename from 1todos/server/src/leaves/protocol/core/LeavesProtocol.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocol.java index 1f32095..bc8d69d 100644 --- a/1todos/server/src/leaves/protocol/core/LeavesProtocol.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocol.java @@ -15,7 +15,6 @@ * along with Leaves. If not, see . */ - package org.leavesmc.leaves.protocol.core; import java.lang.annotation.ElementType; diff --git a/1todos/server/src/leaves/protocol/core/LeavesProtocolManager.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java similarity index 99% rename from 1todos/server/src/leaves/protocol/core/LeavesProtocolManager.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java index 43cf4f7..e8dbb61 100644 --- a/1todos/server/src/leaves/protocol/core/LeavesProtocolManager.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java @@ -15,7 +15,6 @@ * along with Leaves. If not, see . */ - package org.leavesmc.leaves.protocol.core; import com.mojang.logging.LogUtils; @@ -24,6 +23,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.Identifier; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import org.leavesmc.leaves.protocol.core.invoker.*; import org.slf4j.Logger; @@ -43,6 +43,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; public class LeavesProtocolManager { + private static final Logger LOGGER = LogUtils.getClassLogger(); private static final Map, PayloadReceiverInvokerHolder> PAYLOAD_RECEIVERS = new HashMap<>(); @@ -264,7 +265,7 @@ public class LeavesProtocolManager { } public static void handleTick() { - long currentTime = System.currentTimeMillis() / 50; + long currentTime = System.currentTimeMillis() / MinecraftServer.getServer().tickRateManager().nanosecondsPerTick(); if (currentTime == lastAcceptTime) return; lastAcceptTime = currentTime; for (var tickerInfo : TICKERS) { diff --git a/1todos/server/src/leaves/protocol/core/ProtocolHandler.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java similarity index 99% rename from 1todos/server/src/leaves/protocol/core/ProtocolHandler.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java index ff972f6..e6b8448 100644 --- a/1todos/server/src/leaves/protocol/core/ProtocolHandler.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java @@ -15,7 +15,6 @@ * along with Leaves. If not, see . */ - package org.leavesmc.leaves.protocol.core; import net.minecraft.server.level.ServerPlayer; diff --git a/1todos/server/src/leaves/protocol/core/ProtocolUtils.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java similarity index 97% rename from 1todos/server/src/leaves/protocol/core/ProtocolUtils.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java index 18b1918..561dbc5 100644 --- a/1todos/server/src/leaves/protocol/core/ProtocolUtils.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java @@ -15,7 +15,6 @@ * along with Leaves. If not, see . */ - package org.leavesmc.leaves.protocol.core; import com.google.common.cache.Cache; @@ -47,7 +46,7 @@ public class ProtocolUtils { private static final byte[] EMPTY = new byte[0]; public static String buildProtocolVersion(String protocol) { - return protocol + "-lophine-" + ServerBuildInfo.buildInfo().asString(ServerBuildInfo.StringRepresentation.VERSION_SIMPLE); + return protocol + "-leaves-" + ServerBuildInfo.buildInfo().asString(ServerBuildInfo.StringRepresentation.VERSION_SIMPLE); } public static void sendEmptyPacket(ServerPlayer player, Identifier id) { diff --git a/1todos/server/src/leaves/protocol/core/invoker/AbstractInvokerHolder.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/AbstractInvokerHolder.java similarity index 100% rename from 1todos/server/src/leaves/protocol/core/invoker/AbstractInvokerHolder.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/AbstractInvokerHolder.java diff --git a/1todos/server/src/leaves/protocol/core/invoker/BytebufReceiverInvokerHolder.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/BytebufReceiverInvokerHolder.java similarity index 100% rename from 1todos/server/src/leaves/protocol/core/invoker/BytebufReceiverInvokerHolder.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/BytebufReceiverInvokerHolder.java diff --git a/1todos/server/src/leaves/protocol/core/invoker/EmptyInvokerHolder.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/EmptyInvokerHolder.java similarity index 100% rename from 1todos/server/src/leaves/protocol/core/invoker/EmptyInvokerHolder.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/EmptyInvokerHolder.java diff --git a/1todos/server/src/leaves/protocol/core/invoker/InitInvokerHolder.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/InitInvokerHolder.java similarity index 100% rename from 1todos/server/src/leaves/protocol/core/invoker/InitInvokerHolder.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/InitInvokerHolder.java diff --git a/1todos/server/src/leaves/protocol/core/invoker/MinecraftRegisterInvokerHolder.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/MinecraftRegisterInvokerHolder.java similarity index 100% rename from 1todos/server/src/leaves/protocol/core/invoker/MinecraftRegisterInvokerHolder.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/MinecraftRegisterInvokerHolder.java diff --git a/1todos/server/src/leaves/protocol/core/invoker/PayloadReceiverInvokerHolder.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/PayloadReceiverInvokerHolder.java similarity index 100% rename from 1todos/server/src/leaves/protocol/core/invoker/PayloadReceiverInvokerHolder.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/PayloadReceiverInvokerHolder.java diff --git a/1todos/server/src/leaves/protocol/core/invoker/PlayerInvokerHolder.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/PlayerInvokerHolder.java similarity index 100% rename from 1todos/server/src/leaves/protocol/core/invoker/PlayerInvokerHolder.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/PlayerInvokerHolder.java diff --git a/1todos/server/src/leaves/protocol/servux/PacketSplitter.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/PacketSplitter.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/PacketSplitter.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/PacketSplitter.java diff --git a/1todos/server/src/leaves/protocol/servux/ServuxEntityDataProtocol.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxEntityDataProtocol.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/ServuxEntityDataProtocol.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxEntityDataProtocol.java diff --git a/1todos/server/src/leaves/protocol/servux/ServuxHudDataProtocol.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxHudDataProtocol.java similarity index 91% rename from 1todos/server/src/leaves/protocol/servux/ServuxHudDataProtocol.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxHudDataProtocol.java index f876469..2b94900 100644 --- a/1todos/server/src/leaves/protocol/servux/ServuxHudDataProtocol.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxHudDataProtocol.java @@ -17,10 +17,10 @@ package org.leavesmc.leaves.protocol.servux; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; import com.mojang.serialization.DataResult; import fun.bm.lophine.config.modules.function.protocol.ServuxProtocolConfig; +import fun.bm.lophine.utils.concurrent.AbstractConcurrentTable; +import fun.bm.lophine.utils.concurrent.OptimizedConcurrentTable; import io.netty.buffer.Unpooled; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -37,6 +37,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; import net.minecraft.world.level.gamerules.GameRules; +import net.minecraft.world.level.saveddata.WeatherData; import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.protocol.core.LeavesCustomPayload; import org.leavesmc.leaves.protocol.core.LeavesProtocol; @@ -53,12 +54,12 @@ public class ServuxHudDataProtocol implements LeavesProtocol { public static final int PROTOCOL_VERSION = 2; - private static final List players = new ArrayList<>(); + private static final Set players = ConcurrentHashMap.newKeySet(); private static final int updateInterval = 80; private static final Map> loggerPlayers = new ConcurrentHashMap<>(); private static final Map> LOGGERS = new ConcurrentHashMap<>(); - private static final Table DATA = HashBasedTable.create(); + private static final AbstractConcurrentTable DATA = new OptimizedConcurrentTable<>(false, false, true); public static boolean refreshSpawnMetadata = false; @@ -84,7 +85,7 @@ public class ServuxHudDataProtocol implements LeavesProtocol { private static void onPlayerLeave(ServerPlayer player) { players.remove(player); loggerPlayers.remove(player); - DATA.rowMap().values().forEach(row -> row.remove(player)); + DATA.clearXZ(player); } @ProtocolHandler.PayloadReceiver(payload = HudDataPayload.class) @@ -150,7 +151,7 @@ public class ServuxHudDataProtocol implements LeavesProtocol { public static void refreshWeatherData(ServerPlayer player) { ServerLevel level = MinecraftServer.getServer().overworld(); - if (!level.getGameRules().get(GameRules.ADVANCE_WEATHER)) { + if (!level.getGameRules().get(GameRules.ADVANCE_WEATHER)) { // Leaves - Paper 26.1: RULE_WEATHER_CYCLE -> ADVANCE_WEATHER, getBoolean -> get return; } @@ -158,22 +159,24 @@ public class ServuxHudDataProtocol implements LeavesProtocol { nbt.putString("id", HudDataPayload.CHANNEL.toString()); nbt.putString("servux", ServuxProtocol.SERVUX_STRING); - if (level.serverLevelData.isRaining() && level.serverLevelData.getRainTime() > -1) { - nbt.putInt("SetRaining", level.serverLevelData.getRainTime()); + // Leaves - Paper 26.1: weather state moved from PaperLevelOverrides to saveddata.WeatherData + final WeatherData weatherData = level.getWeatherData(); + if (weatherData.isRaining() && weatherData.getRainTime() > -1) { + nbt.putInt("SetRaining", weatherData.getRainTime()); nbt.putBoolean("isRaining", true); } else { nbt.putBoolean("isRaining", false); } - if (level.serverLevelData.isThundering() && level.serverLevelData.getThunderTime() > -1) { - nbt.putInt("SetThundering", level.serverLevelData.getThunderTime()); + if (weatherData.isThundering() && weatherData.getThunderTime() > -1) { + nbt.putInt("SetThundering", weatherData.getThunderTime()); nbt.putBoolean("isThundering", true); } else { nbt.putBoolean("isThundering", false); } - if (level.serverLevelData.getClearWeatherTime() > -1) { - nbt.putInt("SetClear", level.serverLevelData.getClearWeatherTime()); + if (weatherData.getClearWeatherTime() > -1) { + nbt.putInt("SetClear", weatherData.getClearWeatherTime()); } sendPacket(player, new HudDataPayload(HudDataPayloadType.PACKET_S2C_WEATHER_TICK, nbt)); @@ -259,10 +262,12 @@ public class ServuxHudDataProtocol implements LeavesProtocol { loggerPlayers.forEach((player, list) -> { CompoundTag nbt = new CompoundTag(); for (DataLogger.Type type : list) { - Tag data = DATA.get(type, player); + List data0 = DATA.getZ(type, player); + if (data0.isEmpty()) continue; + Tag data = data0.getFirst(); if (data != null) { nbt.put(type.getSerializedName(), data); - DATA.remove(type, player); + DATA.remove(type, player, data); } } if (!nbt.isEmpty()) { @@ -373,4 +378,4 @@ public class ServuxHudDataProtocol implements LeavesProtocol { this(type, new CompoundTag(), buffer); } } -} \ No newline at end of file +} diff --git a/1todos/server/src/leaves/protocol/servux/ServuxProtocol.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxProtocol.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/ServuxProtocol.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxProtocol.java diff --git a/1todos/server/src/leaves/protocol/servux/ServuxStructuresProtocol.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxStructuresProtocol.java similarity index 92% rename from 1todos/server/src/leaves/protocol/servux/ServuxStructuresProtocol.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxStructuresProtocol.java index 3dbae19..9365891 100644 --- a/1todos/server/src/leaves/protocol/servux/ServuxStructuresProtocol.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/ServuxStructuresProtocol.java @@ -49,6 +49,7 @@ import org.slf4j.Logger; import java.util.*; import java.util.concurrent.ConcurrentHashMap; + // Powered by Servux(https://github.com/sakura-ryoko/servux) @LeavesProtocol.Register(namespace = "servux") @@ -93,8 +94,7 @@ public class ServuxStructuresProtocol implements LeavesProtocol { } public static void onStartedWatchingChunk(ServerPlayer player, LevelChunk chunk) { - MinecraftServer server = MinecraftServer.getServer(); - if (players.containsKey(player.getId()) && server != null) { + if (players.containsKey(player.getId())) { addChunkTimeoutIfHasReferences(player.getUUID(), chunk, System.currentTimeMillis() / 50); } } @@ -102,7 +102,7 @@ public class ServuxStructuresProtocol implements LeavesProtocol { private static void addChunkTimeoutIfHasReferences(final UUID uuid, LevelChunk chunk, final long tickCounter) { final ChunkPos pos = chunk.getPos(); - if (chunkHasStructureReferences(pos.x, pos.z, chunk.getLevel())) { + if (chunkHasStructureReferences(pos.x(), pos.z(), chunk.getLevel())) { // Leaves - Paper 26.1: ChunkPos record accessors final Map map = timeouts.computeIfAbsent(uuid, (u) -> new ConcurrentHashMap<>()); map.computeIfAbsent(pos, (p) -> new Timeout(tickCounter - ServuxProtocolConfig.maxDelay)); } @@ -162,8 +162,8 @@ public class ServuxStructuresProtocol implements LeavesProtocol { public static Map getStructureReferences(ServerLevel world, ChunkPos center, int chunkRadius) { Map references = new HashMap<>(); - for (int cx = center.x - chunkRadius; cx <= center.x + chunkRadius; ++cx) { - for (int cz = center.z - chunkRadius; cz <= center.z + chunkRadius; ++cz) { + for (int cx = center.x() - chunkRadius; cx <= center.x() + chunkRadius; ++cx) { // Leaves - Paper 26.1: ChunkPos record accessors + for (int cz = center.z() - chunkRadius; cz <= center.z() + chunkRadius; ++cz) { // Leaves - Paper 26.1: ChunkPos record accessors getReferencesFromChunk(cx, cz, world, references); } } @@ -233,13 +233,13 @@ public class ServuxStructuresProtocol implements LeavesProtocol { LongIterator iter = startChunks.iterator(); while (iter.hasNext()) { - ChunkPos pos = new ChunkPos(iter.nextLong()); + ChunkPos pos = ChunkPos.unpack(iter.nextLong()); // Leaves - Paper 26.1: ChunkPos constructor replaced with unpack - if (!world.hasChunk(pos.x, pos.z)) { + if (!world.hasChunk(pos.x(), pos.z())) { // Leaves - Paper 26.1: ChunkPos record accessors continue; } - ChunkAccess chunk = world.getChunk(pos.x, pos.z, ChunkStatus.STRUCTURE_STARTS, false); + ChunkAccess chunk = world.getChunk(pos.x(), pos.z(), ChunkStatus.STRUCTURE_STARTS, false); // Leaves - Paper 26.1: ChunkPos record accessors StructureStart start = null; if (chunk != null) { start = chunk.getStartForStructure(structure); @@ -283,7 +283,7 @@ public class ServuxStructuresProtocol implements LeavesProtocol { if (isOutOfRange(pos, center)) { map.remove(pos); } else { - getReferencesFromChunk(pos.x, pos.z, world, references); + getReferencesFromChunk(pos.x(), pos.z(), world, references); // Leaves - Paper 26.1: ChunkPos record accessors Timeout timeout = map.get(pos); @@ -300,7 +300,7 @@ public class ServuxStructuresProtocol implements LeavesProtocol { } protected static boolean isOutOfRange(ChunkPos pos, ChunkPos center) { - return Math.abs(pos.x - center.x) > retainDistance || Math.abs(pos.z - center.z) > retainDistance; + return Math.abs(pos.x() - center.x()) > retainDistance || Math.abs(pos.z() - center.z()) > retainDistance; // Leaves - Paper 26.1: ChunkPos record accessors } public static void addOrRefreshTimeouts(final UUID uuid, final Map references, final long tickCounter) { @@ -308,7 +308,7 @@ public class ServuxStructuresProtocol implements LeavesProtocol { for (LongSet chunks : references.values()) { for (Long chunkPosLong : chunks) { - final ChunkPos pos = new ChunkPos(chunkPosLong); + final ChunkPos pos = ChunkPos.unpack(chunkPosLong); // Leaves - Paper 26.1: ChunkPos constructor replaced with unpack map.computeIfAbsent(pos, (p) -> new Timeout(tickCounter)).setLastSync(tickCounter); } } diff --git a/1todos/server/src/leaves/protocol/servux/litematics/LitematicaSchematic.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/LitematicaSchematic.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/LitematicaSchematic.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/LitematicaSchematic.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/SchematicMetadata.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/SchematicMetadata.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/SchematicMetadata.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/SchematicMetadata.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java similarity index 98% rename from 1todos/server/src/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java index e33f314..9f49ddd 100644 --- a/1todos/server/src/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/ServuxLitematicsProtocol.java @@ -198,7 +198,7 @@ public class ServuxLitematicsProtocol implements LeavesProtocol { } ServerLevel world = player.level(); - ChunkAccess chunk = world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.FULL, false); + ChunkAccess chunk = world.getChunk(chunkPos.x(), chunkPos.z(), ChunkStatus.FULL, false); if (chunk == null) { return; @@ -243,8 +243,8 @@ public class ServuxLitematicsProtocol implements LeavesProtocol { output.putString("Task", "BulkEntityReply"); output.put("TileEntities", tileList); output.put("Entities", entityList); - output.putInt("chunkX", chunkPos.x); - output.putInt("chunkZ", chunkPos.z); + output.putInt("chunkX", chunkPos.x()); + output.putInt("chunkZ", chunkPos.z()); ServuxProtocol.LOGGER.debug("process bulk entity used: {}ms", System.currentTimeMillis() - timeStart); ServuxLitematicaPayload send = new ServuxLitematicaPayload(ServuxLitematicaPayloadType.PACKET_S2C_NBT_RESPONSE_START); diff --git a/1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBitArray.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBitArray.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBitArray.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBitArray.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBlockStateContainer.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBlockStateContainer.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBlockStateContainer.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBlockStateContainer.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBlockStatePalette.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBlockStatePalette.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBlockStatePalette.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBlockStatePalette.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBlockStatePaletteHashMap.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBlockStatePaletteHashMap.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBlockStatePaletteHashMap.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBlockStatePaletteHashMap.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBlockStatePaletteLinear.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBlockStatePaletteLinear.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/container/LitematicaBlockStatePaletteLinear.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/container/LitematicaBlockStatePaletteLinear.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/placement/SchematicPlacement.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/placement/SchematicPlacement.java similarity index 99% rename from 1todos/server/src/leaves/protocol/servux/litematics/placement/SchematicPlacement.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/placement/SchematicPlacement.java index c5f70e3..dca2a51 100644 --- a/1todos/server/src/leaves/protocol/servux/litematics/placement/SchematicPlacement.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/placement/SchematicPlacement.java @@ -305,8 +305,8 @@ public class SchematicPlacement { streamChunkPos(Objects.requireNonNull(enclosingBox.toVanilla())).forEach(chunkPos -> { RegionizedServer.getInstance().taskQueue.queueTickTaskQueue( serverWorld, - chunkPos.x, - chunkPos.z, + chunkPos.x(), + chunkPos.z(), () -> { SchematicPlacingUtils.placeToWorldWithinChunk(serverWorld, chunkPos, this, replaceBehavior, false); count.getAndIncrement(); diff --git a/1todos/server/src/leaves/protocol/servux/litematics/placement/SubRegionPlacement.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/placement/SubRegionPlacement.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/placement/SubRegionPlacement.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/placement/SubRegionPlacement.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/selection/Box.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/selection/Box.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/selection/Box.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/selection/Box.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/EntityUtils.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/EntityUtils.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/EntityUtils.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/EntityUtils.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/FileType.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/FileType.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/FileType.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/FileType.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/Int2ObjectBiMap.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/Int2ObjectBiMap.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/Int2ObjectBiMap.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/Int2ObjectBiMap.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/IntBoundingBox.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/IntBoundingBox.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/IntBoundingBox.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/IntBoundingBox.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/NbtUtils.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/NbtUtils.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/NbtUtils.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/NbtUtils.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/PositionUtils.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/PositionUtils.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/PositionUtils.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/PositionUtils.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/ReplaceBehavior.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/ReplaceBehavior.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/ReplaceBehavior.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/ReplaceBehavior.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/Schema.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/Schema.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/Schema.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/Schema.java diff --git a/1todos/server/src/leaves/protocol/servux/litematics/utils/SchematicPlacingUtils.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/SchematicPlacingUtils.java similarity index 98% rename from 1todos/server/src/leaves/protocol/servux/litematics/utils/SchematicPlacingUtils.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/SchematicPlacingUtils.java index 43982c9..94f6b86 100644 --- a/1todos/server/src/leaves/protocol/servux/litematics/utils/SchematicPlacingUtils.java +++ b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/litematics/utils/SchematicPlacingUtils.java @@ -62,7 +62,7 @@ public class SchematicPlacingUtils { boolean notifyNeighbors ) { LitematicaSchematic schematic = schematicPlacement.getSchematic(); - Set regionsTouchingChunk = schematicPlacement.getRegionsTouchingChunk(chunkPos.x, chunkPos.z); + Set regionsTouchingChunk = schematicPlacement.getRegionsTouchingChunk(chunkPos.x(), chunkPos.z()); BlockPos origin = schematicPlacement.getOrigin(); for (String regionName : regionsTouchingChunk) { @@ -110,7 +110,7 @@ public class SchematicPlacingUtils { @Nullable Map> scheduledFluidTicks, ReplaceBehavior replace, boolean notifyNeighbors ) { - IntBoundingBox bounds = schematicPlacement.getBoxWithinChunkForRegion(regionName, chunkPos.x, chunkPos.z); + IntBoundingBox bounds = schematicPlacement.getBoxWithinChunkForRegion(regionName, chunkPos.x(), chunkPos.z()); Vec3i regionSize = schematicPlacement.getSchematic().getSubRegion(regionName).size(); if (bounds == null || container == null || blockEntityMap == null || regionSize == null) { @@ -320,10 +320,10 @@ public class SchematicPlacingUtils { final int offX = regionPosRelTransformed.getX() + origin.getX(); final int offY = regionPosRelTransformed.getY() + origin.getY(); final int offZ = regionPosRelTransformed.getZ() + origin.getZ(); - final double minX = (chunkPos.x << 4); - final double minZ = (chunkPos.z << 4); - final double maxX = (chunkPos.x << 4) + 16; - final double maxZ = (chunkPos.z << 4) + 16; + final double minX = (chunkPos.x() << 4); + final double minZ = (chunkPos.z() << 4); + final double maxX = (chunkPos.x() << 4) + 16; + final double maxZ = (chunkPos.z() << 4) + 16; final Rotation rotationCombined = schematicPlacement.getRotation().getRotated(placement.rotation()); final Mirror mirrorMain = schematicPlacement.getMirror(); diff --git a/1todos/server/src/leaves/protocol/servux/logger/DataLogger.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/logger/DataLogger.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/logger/DataLogger.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/logger/DataLogger.java diff --git a/1todos/server/src/leaves/protocol/servux/logger/data/MobCapData.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/logger/data/MobCapData.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/logger/data/MobCapData.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/logger/data/MobCapData.java diff --git a/1todos/server/src/leaves/protocol/servux/logger/data/TickData.java b/lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/logger/data/TickData.java similarity index 100% rename from 1todos/server/src/leaves/protocol/servux/logger/data/TickData.java rename to lophine-server/src/main/java/org/leavesmc/leaves/protocol/servux/logger/data/TickData.java diff --git a/1todos/server/src/leaves/region/LeavesHooks.java b/lophine-server/src/main/java/org/leavesmc/leaves/region/LeavesHooks.java similarity index 100% rename from 1todos/server/src/leaves/region/LeavesHooks.java rename to lophine-server/src/main/java/org/leavesmc/leaves/region/LeavesHooks.java diff --git a/1todos/server/src/leaves/util/ShearsWrenchUtil.java b/lophine-server/src/main/java/org/leavesmc/leaves/util/ShearsWrenchUtil.java similarity index 100% rename from 1todos/server/src/leaves/util/ShearsWrenchUtil.java rename to lophine-server/src/main/java/org/leavesmc/leaves/util/ShearsWrenchUtil.java diff --git a/1todos/server/src/leaves/util/TagFactory.java b/lophine-server/src/main/java/org/leavesmc/leaves/util/TagFactory.java similarity index 100% rename from 1todos/server/src/leaves/util/TagFactory.java rename to lophine-server/src/main/java/org/leavesmc/leaves/util/TagFactory.java diff --git a/1todos/server/src/leaves/util/TagUtil.java b/lophine-server/src/main/java/org/leavesmc/leaves/util/TagUtil.java similarity index 100% rename from 1todos/server/src/leaves/util/TagUtil.java rename to lophine-server/src/main/java/org/leavesmc/leaves/util/TagUtil.java