diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/entitytracker/AsyncEntityTracker.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/entitytracker/AsyncEntityTracker.java index e987be48..b84c5987 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/entitytracker/AsyncEntityTracker.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/entitytracker/AsyncEntityTracker.java @@ -6,7 +6,9 @@ import ga.windpvp.windspigot.async.AsyncUtil; import ga.windpvp.windspigot.config.WindSpigotConfig; +import me.rastrian.dev.utils.IndexedLinkedHashSet; import net.minecraft.server.EntityTracker; +import net.minecraft.server.EntityTrackerEntry; import net.minecraft.server.WorldServer; public class AsyncEntityTracker extends EntityTracker { @@ -28,7 +30,7 @@ public void updatePlayers() { AsyncUtil.run(() -> { for (int index = finalOffset; index < c.size(); index += WindSpigotConfig.trackingThreads) { - c.get(index).update(); + ((IndexedLinkedHashSet) c).get(index).update(); } worldServer.ticker.getLatch().decrement(); diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/entitytracker/MultithreadedEntityTracker.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/entitytracker/MultithreadedEntityTracker.java index eb86cf23..5a57c9e2 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/entitytracker/MultithreadedEntityTracker.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/entitytracker/MultithreadedEntityTracker.java @@ -6,7 +6,9 @@ import ga.windpvp.windspigot.async.AsyncUtil; import ga.windpvp.windspigot.config.WindSpigotConfig; +import me.rastrian.dev.utils.IndexedLinkedHashSet; import net.minecraft.server.EntityTracker; +import net.minecraft.server.EntityTrackerEntry; import net.minecraft.server.WorldServer; public class MultithreadedEntityTracker extends EntityTracker { @@ -28,7 +30,7 @@ public void updatePlayers() { AsyncUtil.run(() -> { for (int index = finalOffset; index < c.size(); index += WindSpigotConfig.trackingThreads) { - c.get(index).update(); + ((IndexedLinkedHashSet) c).get(index).update(); } worldServer.ticker.getLatch().decrement(); diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityTracker.java b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityTracker.java index facf4ab4..d7ce8a09 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityTracker.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityTracker.java @@ -1,14 +1,17 @@ package net.minecraft.server; import java.util.List; +import java.util.Set; + import com.google.common.collect.Lists; import ga.windpvp.windspigot.commons.ConcurrentIntHashMap; import ga.windpvp.windspigot.config.WindSpigotConfig; +import me.rastrian.dev.utils.IndexedLinkedHashSet; public class EntityTracker { - public List c = Lists.newCopyOnWriteArrayList(); + public Set c = new IndexedLinkedHashSet<>(); public IntHashMap trackedEntities = new ConcurrentIntHashMap<>(); // WindSpigot