diff --git a/leaf-archived-patches/removed/hardfork/server/0166-Save-world-async-properly.patch b/leaf-archived-patches/removed/hardfork/server/0166-Save-world-async-properly.patch index 59537340..c74c0fa4 100644 --- a/leaf-archived-patches/removed/hardfork/server/0166-Save-world-async-properly.patch +++ b/leaf-archived-patches/removed/hardfork/server/0166-Save-world-async-properly.patch @@ -16,7 +16,7 @@ index ba1dd51e7187a80e8438e46383257c22f5382130..6cb0c14cb7aa243bbee6ca9ba57da4cc if (doFull) { - this.saveLevelData(true); -+ this.saveLevelData(false); ++ this.saveLevelData(false); // Leaf - Save world async properly } // chunk autosave is already called by the ChunkSystem during unload processing (ChunkMap#processUnloads) // Copied from save() diff --git a/leaf-server/minecraft-patches/features/0085-Multithreaded-Tracker.patch b/leaf-server/minecraft-patches/features/0085-Multithreaded-Tracker.patch index a82a8d0e..de9c1a53 100644 --- a/leaf-server/minecraft-patches/features/0085-Multithreaded-Tracker.patch +++ b/leaf-server/minecraft-patches/features/0085-Multithreaded-Tracker.patch @@ -37,7 +37,7 @@ index dd2509996bfd08e8c3f9f2be042229eac6d7692d..a35e9fae8f8da0c42f0616c4f78dc396 private static final byte CHUNK_TICKET_STAGE_NONE = 0; private static final byte CHUNK_TICKET_STAGE_LOADING = 1; diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index 5d9d233e3a568aa6297ed9c703fa450f98158602..c9222a1a8ea9f88eadbb3c16925f96e92867b682 100644 +index 5d9d233e3a568aa6297ed9c703fa450f98158602..08873993b3b75db325fe1f2b4ab1de73b3d05be4 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java @@ -248,6 +248,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -70,7 +70,7 @@ index 5d9d233e3a568aa6297ed9c703fa450f98158602..c9222a1a8ea9f88eadbb3c16925f96e9 // Paper start - optimise entity tracker if (true) { this.newTrackerTick(); -@@ -1073,12 +1089,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1073,11 +1089,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; @@ -80,13 +80,11 @@ index 5d9d233e3a568aa6297ed9c703fa450f98158602..c9222a1a8ea9f88eadbb3c16925f96e9 // Paper start - optimise entity tracker private long lastChunkUpdate = -1L; private ca.spottedleaf.moonrise.common.misc.NearbyPlayers.TrackedChunk lastTrackedChunk; ++ public final Object sync = new Object(); // Leaf - Multithreaded tracker -+ public final Object sync = new Object(); // Leaf -+ @Override public final void moonrise$tick(final ca.spottedleaf.moonrise.common.misc.NearbyPlayers.TrackedChunk chunk) { - if (chunk == null) { -@@ -1100,8 +1118,41 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1100,8 +1117,41 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastTrackedChunk = chunk; final ServerPlayer[] playersRaw = players.getRawDataUnchecked(); @@ -129,7 +127,7 @@ index 5d9d233e3a568aa6297ed9c703fa450f98158602..c9222a1a8ea9f88eadbb3c16925f96e9 final ServerPlayer player = playersRaw[i]; this.updatePlayer(player); } -@@ -1115,6 +1166,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1115,6 +1165,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } } @@ -138,7 +136,7 @@ index 5d9d233e3a568aa6297ed9c703fa450f98158602..c9222a1a8ea9f88eadbb3c16925f96e9 } @Override -@@ -1176,7 +1229,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1176,7 +1228,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void broadcast(Packet packet) { @@ -147,7 +145,7 @@ index 5d9d233e3a568aa6297ed9c703fa450f98158602..c9222a1a8ea9f88eadbb3c16925f96e9 serverPlayerConnection.send(packet); } } -@@ -1189,21 +1242,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1189,21 +1241,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void broadcastRemoved() { @@ -187,7 +185,7 @@ index f106373ef3ac4a8685c2939c9e8361688a285913..51ae390c68e7a3aa193329cc3bc47ca6 public boolean visible = true; diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index d8298c7925e3bcea07ead4d438478cc51abcfa16..38314fcb660f6cbb36d60434d24df5b579425eb3 100644 +index d8298c7925e3bcea07ead4d438478cc51abcfa16..be3057119bcbce4a4f72284fa7ba8f60ba43f397 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java @@ -110,8 +110,16 @@ public class ServerEntity { @@ -209,11 +207,11 @@ index d8298c7925e3bcea07ead4d438478cc51abcfa16..38314fcb660f6cbb36d60434d24df5b5 } } ); -@@ -434,6 +442,21 @@ public class ServerEntity { +@@ -434,16 +442,33 @@ public class ServerEntity { if (this.entity instanceof LivingEntity) { Set attributesToSync = ((LivingEntity)this.entity).getAttributes().getAttributesToSync(); -+ // Leaf start ++ // Leaf start - Multithreaded tracker + if (org.dreeam.leaf.config.modules.async.MultithreadedTracker.enabled) { + synchronized (attributesToSync) { + if (!attributesToSync.isEmpty()) { @@ -231,17 +229,21 @@ index d8298c7925e3bcea07ead4d438478cc51abcfa16..38314fcb660f6cbb36d60434d24df5b5 if (!attributesToSync.isEmpty()) { // CraftBukkit start - Send scaled max health if (this.entity instanceof ServerPlayer serverPlayer) { -@@ -444,6 +467,8 @@ public class ServerEntity { +- serverPlayer.getBukkitEntity().injectScaledMaxHealth(attributesToSync, false); ++ serverPlayer.getBukkitEntity().injectScaledMaxHealth(attributesToSync, false); // Leaf - Multithreaded tracker - diff on change + } + // CraftBukkit end + this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), attributesToSync)); } attributesToSync.clear(); + } -+ // Leaf end ++ // Leaf end - Multithreaded tracker } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index d6ebc25dc5f04194edde5ad3a1166113e5542a1d..49cbdf014d0626b36eb4c451b6de09508822b7fd 100644 +index 275b640f4536366152f59acf071dd4eba15696c8..a669a59a42f814480879a52d2da5e04c636720de 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -2522,7 +2522,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java b/leaf-server/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java index e2d70fe1..c5541c9b 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java @@ -12,7 +12,12 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.structure.Structure; -import java.util.concurrent.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java b/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java index af0f16a8..12ae72fe 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/path/AsyncPathProcessor.java @@ -1,10 +1,8 @@ package org.dreeam.leaf.async.path; import com.google.common.util.concurrent.ThreadFactoryBuilder; - import net.minecraft.server.MinecraftServer; import net.minecraft.world.level.pathfinder.Path; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -12,7 +10,13 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.*; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.RejectedExecutionHandler; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.function.Consumer; /** @@ -97,4 +101,5 @@ public class AsyncPathProcessor { final int queueCapacity = org.dreeam.leaf.config.modules.async.AsyncPathfinding.asyncPathfindingQueueSize; return new LinkedBlockingQueue<>(queueCapacity); - }} + } +} diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorCache.java b/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorCache.java index c2397543..3d31badb 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorCache.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorCache.java @@ -2,7 +2,6 @@ package org.dreeam.leaf.async.path; import ca.spottedleaf.concurrentutil.collection.MultiThreadedQueue; import net.minecraft.world.level.pathfinder.NodeEvaluator; - import org.apache.commons.lang.Validate; import org.jetbrains.annotations.NotNull; diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorType.java b/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorType.java index c0527323..c94f4c8b 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorType.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/path/NodeEvaluatorType.java @@ -1,6 +1,9 @@ package org.dreeam.leaf.async.path; -import net.minecraft.world.level.pathfinder.*; +import net.minecraft.world.level.pathfinder.AmphibiousNodeEvaluator; +import net.minecraft.world.level.pathfinder.FlyNodeEvaluator; +import net.minecraft.world.level.pathfinder.NodeEvaluator; +import net.minecraft.world.level.pathfinder.SwimNodeEvaluator; public enum NodeEvaluatorType { WALK, diff --git a/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java b/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java index ba41ecdc..23e6171c 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java @@ -16,7 +16,13 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.*; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.RejectedExecutionHandler; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; public class MultithreadedTracker { diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java b/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java index 9bd93774..e40a1c50 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java @@ -4,10 +4,15 @@ import io.papermc.paper.configuration.GlobalConfiguration; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.minecraft.Util; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.dreeam.leaf.config.modules.misc.SentryDSN; -import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; import java.io.File; import java.io.IOException; @@ -31,13 +36,6 @@ import java.util.concurrent.CompletableFuture; import java.util.jar.JarEntry; import java.util.jar.JarFile; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; - /* * Yoinked from: https://github.com/xGinko/AnarchyExploitFixes/ & https://github.com/LuminolMC/Luminol * @author: @xGinko & @MrHua269 diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/annotations/Experimental.java b/leaf-server/src/main/java/org/dreeam/leaf/config/annotations/Experimental.java index 26a6967c..acc8aa7f 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/annotations/Experimental.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/annotations/Experimental.java @@ -1,6 +1,10 @@ package org.dreeam.leaf.config.annotations; -import java.lang.annotation.*; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; /** * Indicates that a feature is experimental and may be removed or changed in the future. diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPathfinding.java b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPathfinding.java index f24fc20f..003458e5 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPathfinding.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPathfinding.java @@ -21,15 +21,15 @@ public class AsyncPathfinding extends ConfigModules { @Override public void onLoaded() { config.addCommentRegionBased(getBasePath() + ".reject-policy", """ - The policy to use when the queue is full and a new task is submitted. - FLUSH_ALL: All pending tasks will be run on server thread. - CALLER_RUNS: Newly submitted task will be run on server thread. - DISCARD: Newly submitted task will be dropped directly.""", + The policy to use when the queue is full and a new task is submitted. + FLUSH_ALL: All pending tasks will be run on server thread. + CALLER_RUNS: Newly submitted task will be run on server thread. + DISCARD: Newly submitted task will be dropped directly.""", """ - 当队列满时, 新提交的任务将使用以下策略处理. - FLUSH_ALL: 所有等待中的任务都将在主线程上运行. - CALLER_RUNS: 新提交的任务将在主线程上运行. - DISCARD: 新提交的任务会被直接丢弃.""" + 当队列满时, 新提交的任务将使用以下策略处理. + FLUSH_ALL: 所有等待中的任务都将在主线程上运行. + CALLER_RUNS: 新提交的任务将在主线程上运行. + DISCARD: 新提交的任务会被直接丢弃.""" ); if (asyncPathfindingInitialized) { config.getConfigSection(getBasePath()); diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPlayerDataSave.java b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPlayerDataSave.java index 7b8fecfe..6d555ce0 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPlayerDataSave.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncPlayerDataSave.java @@ -2,7 +2,6 @@ package org.dreeam.leaf.config.modules.async; import org.dreeam.leaf.config.ConfigModules; import org.dreeam.leaf.config.EnumConfigCategory; -import org.dreeam.leaf.config.annotations.Experimental; public class AsyncPlayerDataSave extends ConfigModules { diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncTargetFinding.java b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncTargetFinding.java index a444f218..c2ebeb42 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncTargetFinding.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/async/AsyncTargetFinding.java @@ -3,7 +3,6 @@ package org.dreeam.leaf.config.modules.async; import org.dreeam.leaf.config.ConfigModules; import org.dreeam.leaf.config.EnumConfigCategory; -import org.dreeam.leaf.config.annotations.Experimental; public class AsyncTargetFinding extends ConfigModules { diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableInventoryOverflowEvent.java b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableInventoryOverflowEvent.java index 3338c643..ce78ab95 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableInventoryOverflowEvent.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/gameplay/ConfigurableInventoryOverflowEvent.java @@ -10,7 +10,7 @@ public class ConfigurableInventoryOverflowEvent extends ConfigModules { } public static boolean enabled = false; - public static String listenerClass = "com.example.package.PlayerInventoryOverflowEvent" ; + public static String listenerClass = "com.example.package.PlayerInventoryOverflowEvent"; @Override public void onLoaded() { diff --git a/leaf-server/src/main/java/org/dreeam/leaf/protocol/DoABarrelRollProtocol.java b/leaf-server/src/main/java/org/dreeam/leaf/protocol/DoABarrelRollProtocol.java index dca31a84..cdee8b2a 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/protocol/DoABarrelRollProtocol.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/protocol/DoABarrelRollProtocol.java @@ -1,7 +1,14 @@ package org.dreeam.leaf.protocol; import com.google.common.collect.ImmutableList; -import it.unimi.dsi.fastutil.objects.*; +import it.unimi.dsi.fastutil.objects.Reference2BooleanMap; +import it.unimi.dsi.fastutil.objects.Reference2BooleanMaps; +import it.unimi.dsi.fastutil.objects.Reference2BooleanOpenHashMap; +import it.unimi.dsi.fastutil.objects.Reference2FloatMap; +import it.unimi.dsi.fastutil.objects.Reference2FloatMaps; +import it.unimi.dsi.fastutil.objects.Reference2FloatOpenHashMap; +import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; +import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.server.MinecraftServer; @@ -10,9 +17,16 @@ import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.server.network.ServerPlayerConnection; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.bukkit.event.player.PlayerKickEvent; -import org.dreeam.leaf.protocol.DoABarrelRollPackets.*; +import org.dreeam.leaf.protocol.DoABarrelRollPackets.ConfigResponseC2SPacket; +import org.dreeam.leaf.protocol.DoABarrelRollPackets.ConfigSyncS2CPacket; +import org.dreeam.leaf.protocol.DoABarrelRollPackets.ConfigUpdateAckS2CPacket; +import org.dreeam.leaf.protocol.DoABarrelRollPackets.ConfigUpdateC2SPacket; +import org.dreeam.leaf.protocol.DoABarrelRollPackets.KineticDamage; +import org.dreeam.leaf.protocol.DoABarrelRollPackets.ModConfigServer; +import org.dreeam.leaf.protocol.DoABarrelRollPackets.RollSyncC2SPacket; +import org.dreeam.leaf.protocol.DoABarrelRollPackets.RollSyncS2CPacket; import org.jetbrains.annotations.NotNull; +import org.bukkit.event.player.PlayerKickEvent; import java.util.List; import java.util.OptionalInt; diff --git a/leaf-server/src/main/java/org/dreeam/leaf/protocol/Protocol.java b/leaf-server/src/main/java/org/dreeam/leaf/protocol/Protocol.java index ac069be5..fdedc410 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/protocol/Protocol.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/protocol/Protocol.java @@ -9,11 +9,18 @@ import java.util.List; interface Protocol { String namespace(); + List> c2s(); + List> s2c(); + void tickServer(MinecraftServer server); + void tickPlayer(ServerPlayer player); + void tickTracker(ServerPlayer player); + void disconnected(ServerPlayer conn); + void handle(ServerPlayer player, @NotNull LeafCustomPayload payload); } diff --git a/leaf-server/src/main/java/org/dreeam/leaf/protocol/Protocols.java b/leaf-server/src/main/java/org/dreeam/leaf/protocol/Protocols.java index 0af1e3d1..4a54b998 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/protocol/Protocols.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/protocol/Protocols.java @@ -23,7 +23,9 @@ public class Protocols { PROTOCOLS.remove(protocol); } - public record TypeAndCodec(LeafCustomPayload.Type type, StreamCodec codec) {} + public record TypeAndCodec(LeafCustomPayload.Type type, + StreamCodec codec) { + } public static void write(B byteBuf, LeafCustomPayload payload) { for (Protocol protocol : PROTOCOLS) { diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/cache/IterateOutwardsCache.java b/leaf-server/src/main/java/org/dreeam/leaf/util/cache/IterateOutwardsCache.java index 2de80d99..bdd59ee7 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/util/cache/IterateOutwardsCache.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/util/cache/IterateOutwardsCache.java @@ -2,13 +2,12 @@ package org.dreeam.leaf.util.cache; import it.unimi.dsi.fastutil.longs.LongArrayList; import it.unimi.dsi.fastutil.longs.LongList; +import net.minecraft.core.BlockPos; import java.util.Iterator; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; -import net.minecraft.core.BlockPos; - /** * @author 2No2Name, original implemenation by SuperCoder7979 and Gegy1000 */ diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/cache/LongList2BlockPosMutableIterable.java b/leaf-server/src/main/java/org/dreeam/leaf/util/cache/LongList2BlockPosMutableIterable.java index 53c70ead..5eedd4e7 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/util/cache/LongList2BlockPosMutableIterable.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/util/cache/LongList2BlockPosMutableIterable.java @@ -2,11 +2,10 @@ package org.dreeam.leaf.util.cache; import it.unimi.dsi.fastutil.longs.LongIterator; import it.unimi.dsi.fastutil.longs.LongList; +import net.minecraft.core.BlockPos; import java.util.Iterator; -import net.minecraft.core.BlockPos; - /** * @author 2No2Name */ diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/fastBitRadixSort.java b/leaf-server/src/main/java/org/dreeam/leaf/util/fastBitRadixSort.java index 21b36d46..ba9cf22c 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/util/fastBitRadixSort.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/util/fastBitRadixSort.java @@ -1,9 +1,9 @@ package org.dreeam.leaf.util; -import java.util.List; -import java.util.Arrays; import net.minecraft.world.entity.Entity; + import java.lang.reflect.Array; // Required for Array.newInstance +import java.util.List; public class fastBitRadixSort { diff --git a/leaf-server/src/main/java/org/dreeam/leaf/util/list/HashedReferenceList.java b/leaf-server/src/main/java/org/dreeam/leaf/util/list/HashedReferenceList.java index 6a66cf99..9887bd89 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/util/list/HashedReferenceList.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/util/list/HashedReferenceList.java @@ -3,12 +3,13 @@ package org.dreeam.leaf.util.list; import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.ReferenceArrayList; import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; +import org.jetbrains.annotations.NotNull; + import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.NoSuchElementException; -import org.jetbrains.annotations.NotNull; /** * A List implementation that maintains a hash-based counter for O(1) element lookup.