diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/pathsearch/AsyncNavigation.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/pathsearch/AsyncNavigation.java index 921dcafb..40f0ff3e 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/pathsearch/AsyncNavigation.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/pathsearch/AsyncNavigation.java @@ -47,28 +47,8 @@ public AsyncNavigation(EntityInsentient var1, World var2) { super(var1, var2); } - static { - offloadedEntities.add(EntityType.BAT); - offloadedEntities.add(EntityType.BLAZE); - offloadedEntities.add(EntityType.CHICKEN); - offloadedEntities.add(EntityType.COW); - offloadedEntities.add(EntityType.CREEPER); - offloadedEntities.add(EntityType.ENDERMAN); - offloadedEntities.add(EntityType.HORSE); - offloadedEntities.add(EntityType.IRON_GOLEM); - offloadedEntities.add(EntityType.MAGMA_CUBE); - offloadedEntities.add(EntityType.MUSHROOM_COW); - offloadedEntities.add(EntityType.PIG); - offloadedEntities.add(EntityType.PIG_ZOMBIE); - offloadedEntities.add(EntityType.RABBIT); - offloadedEntities.add(EntityType.SHEEP); - offloadedEntities.add(EntityType.SKELETON); - offloadedEntities.add(EntityType.SILVERFISH); - offloadedEntities.add(EntityType.SLIME); - offloadedEntities.add(EntityType.SNOWMAN); - offloadedEntities.add(EntityType.SQUID); - offloadedEntities.add(EntityType.WITCH); - offloadedEntities.add(EntityType.ZOMBIE); + public static void addOffloadedEntities(List entities) { + offloadedEntities.addAll(entities); } private void issueSearch(Entity targetEntity) { diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/config/WindSpigotConfig.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/config/WindSpigotConfig.java index cf2f4e99..d561d5ce 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/config/WindSpigotConfig.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/config/WindSpigotConfig.java @@ -323,11 +323,24 @@ private static void modernKeepalive() { public static int pathSearchThreads; public static boolean ensurePathSearchAccuracy; + @SuppressWarnings("unchecked") private static void asyncPathSearches() { asyncPathSearches = getBoolean("settings.async.path-searches.enabled", true); if (asyncPathSearches) { - + List asyncSearchEntities = getList("settings.async.path-searches.entities", + Lists.newArrayList("BAT", "BLAZE", "CHICKEN", "COW", "CREEPER", "ENDERMAN", "HORSE", "IRON_GOLEM", + "MAGMA_CUBE", "MUSHROOM_COW", "PIG", "PIG_ZOMBIE", "RABBIT", "SHEEP", "SKELETON", "SILVERFISH", + "SLIME", "SNOWMAN", "SQUID", "WITCH", "ZOMBIE")); + + List finalEntities = Lists.newArrayList(); + + for (String entityName : asyncSearchEntities) { + finalEntities.add(EntityType.fromName(entityName)); + } + + AsyncNavigation.addOffloadedEntities(finalEntities); + distanceToAsync = getInt("settings.async.path-searches.distance-to-async", 0); AsyncNavigation.setMinimumDistanceForOffloading(distanceToAsync); @@ -336,6 +349,7 @@ private static void asyncPathSearches() { } c.addComment("settings.async.path-searches.enabled", "Enables async path searching for entities."); + c.addComment("settings.async.path-searches.entities", "A list of entities that utilize async path searches. Removing entities from this list will ensure 100% vanilla behavior, but worse performance."); c.addComment("settings.async.path-searches.distance-to-async", "The mininum distance an entity is targeting to handle it async. Tune this based on how many entities your server will has."); c.addComment("settings.async.path-searches.threads", "The threads used for path searches. Tune this based on how many entities your server will has."); c.addComment("settings.async.path-searches.ensure-accuracy", "Ensures accuracy of async path searches, disabling this will result in possibly inaccurate targeting, but higher performance.");