From ee3449a8ed9682eb55003632bd8f604cdb0265cb Mon Sep 17 00:00:00 2001 From: windcolor-dev <79166388+windcolor-dev@users.noreply.github.com> Date: Sat, 16 Sep 2023 12:53:28 -0700 Subject: [PATCH] Fix citizens compatibility --- .../windspigot/async/entitytracker/AsyncEntityTracker.java | 4 +++- .../async/entitytracker/MultithreadedEntityTracker.java | 4 +++- .../src/main/java/net/minecraft/server/EntityTracker.java | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) 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