froobynooby / ViewDistanceTweaks

Paper plugin that allows for dynamic simulation and view distances.
https://ci.froobworld.com/job/ViewDistanceTweaks/
MIT License
89 stars 17 forks source link

Loading Error on 1.18 (PaperMC-1.18-42) #16

Closed Drikani closed 2 years ago

Drikani commented 2 years ago

I've used the Plugin a lot since it hase been released and love it, but on 1.18 it does not load anymore.
Is there an updated planned for the new update? The new worldgeneration would greatly benefit from a high viewing distance.

I am running the Server with the itzg\minecraft Docker container with Docker Version 20.10.7. Java is Version 17.

Thank you very much for your work on the Plugin and I hope this is only a small problem to fix. Keep up the great work.

Below you can find the exception:

[12:51:49] [Server thread/INFO]: Enabling ViewDistanceTweaks v1.3.4
[12:51:49] [Server thread/ERROR]: Error occurred while enabling ViewDistanceTweaks v1.3.4 (Is it up to date?)
com.froobworld.viewdistancetweaks.lib.joor.ReflectException: java.lang.NoSuchMethodException: No similar method getChunkProvider with params [] could be found on type class net.minecraft.server.level.WorldServer.
        at com.froobworld.viewdistancetweaks.lib.joor.Reflect.call(Reflect.java:585) ~[?:?]
        at com.froobworld.viewdistancetweaks.lib.joor.Reflect.call(Reflect.java:528) ~[?:?]
        at com.froobworld.viewdistancetweaks.util.ViewDistanceUtils.getProperViewDistance(ViewDistanceUtils.java:32) ~[?:?]
        at com.froobworld.viewdistancetweaks.util.ViewDistanceUtils.syncSpigotViewDistances(ViewDistanceUtils.java:21) ~[?:?]
        at com.froobworld.viewdistancetweaks.util.ViewDistanceUtils.syncSpigotViewDistances(ViewDistanceUtils.java:26) ~[?:?]
        at com.froobworld.viewdistancetweaks.ViewDistanceTweaks.onEnable(ViewDistanceTweaks.java:41) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[paper-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:563) ~[paper-1.18.jar:git-Paper-42]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:477) ~[paper-1.18.jar:git-Paper-42]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:727) ~[paper-1.18.jar:git-Paper-42]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:503) ~[paper-1.18.jar:git-Paper-42]
        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:313) ~[paper-1.18.jar:git-Paper-42]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1202) ~[paper-1.18.jar:git-Paper-42]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.jar:git-Paper-42]
        at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NoSuchMethodException: No similar method getChunkProvider with params [] could be found on type class net.minecraft.server.level.WorldServer.
        at com.froobworld.viewdistancetweaks.lib.joor.Reflect.similarMethod(Reflect.java:652) ~[?:?]
        at com.froobworld.viewdistancetweaks.lib.joor.Reflect.call(Reflect.java:582) ~[?:?]
        ... 16 more
[12:51:49] [Server thread/INFO]: Disabling ViewDistanceTweaks v1.3.4

Here is my configuration that worked so far without a problem:

# Configuration for View Distance Tweaks.
# Plugin page: https://www.spigotmc.org/resources/75164/
# Github: https://github.com/froobynooby/ViewDistanceTweaks

# Please don't change this!
version: 5

# Set this to true to enable the plugin. The plugin is initially disabled so that you can make changes to the config
# appropriate to your server.
enabled: true

# How should we determine whether the view distance needs adjusting? Accepts three values:
#  * proactive : Adjust the view distance so that the player-loaded chunk count is always below a set threshold.
#  * reactive  : Adjust the view distance in response to changes in the server's TPS.
#  * mixed     : Be both proactive and reactive; prioritising decreasing the view distance over increasing.
adjustment-mode: mixed

# These settings are for the proactive adjustment mode.
proactive-mode-settings:
  # Set this to the maximum chunk count your server can handle. The view distance of each world will be adjusted such
  # that the total number of player-loaded chunks is sitting as close to this value as possible.
  #  * If you know your server can handle up to p many players with a view distance of d, a reasonable choice is to set
  #    this to (2d + 1)^2 * p.
  #  * As an example, 5780 is the number of player-loaded chunks for 20 players with a view distance of 8.
  global-chunk-count-target: 5780

# These settings are for the reactive adjustment mode.
reactive-mode-settings:
  # Above what TPS should we consider increasing the view distance?
  increase-tps-threshold: 19.9

  # Below what TPS should we consider decreasing the view distance?
  decrease-tps-threshold: 18.0

  # These settings concern how we determine the TPS.
  #  * Only touch these settings if you know what you're doing.
  tps-tracker-settings:
    # Over how many ticks should we collect tick durations for calculating the TPS?
    #  * Setting this too high will make the TPS very slow to react to changes.
    #  * Setting this too low will make the TPS volatile.
    collection-period: 1200

    # By how much (in percent) should we allow the tick durations we use to calculate the TPS vary from the average
    # tick duration.
    #  * This is used for smoothing the TPS; making sure it's not heavily affected by sudden large lag spikes, such as
    #    those caused by garbage collections or world-saves.
    #  * Setting this to 0 will mean your TPS will never change - don't do that.
    trim-outliers-to-within: 100.0

  # We keep a history of TPS vs. player-loaded chunk count in order to better predict what the TPS will settle to after
  # increasing the view distance.
  tps-prediction:
    # Should we use TPS prediction when we are considering increasing the view distance?
    #  * For example, we may be at 20 TPS with a view distance of 6, meaning we would consider increasing the view
    #    distance to 7. However, if we saw that 10 minutes ago with a view distance of 7 we had 17 TPS, we would hold
    #    off on increasing.
    #  * Disabling this can lead to a back-and-forth game of increasing and decreasing the view distance every few
    #    minutes - not ideal.
    enabled: true

    # For how long (in minutes) should we keep a TPS / chunk count history?
    history-length: 30

# Every how many ticks should we check whether the view distance needs to be updated?
ticks-per-check: 600

# How long in ticks should we wait before starting the checking tasks following the plugin's start up?
#  * This is useful when using the 'mixed' or 'reactive' adjustment modes where it is desirable to ignore the server's
#    performance in the first few minutes following a restart.
start-up-delay: 2400

# How many checks in a row that say to increase the view distance should be required before the view distance is
# actually increased?
#  * This is useful as it guards against the following kind of case: A player leaves and the view distance is increased,
#    but the player returns three minutes later and the view distance is lowered to its previous value.
#  * Since increasing the view distance can cause lag-spikes for players with poorer connections, it is recommended to
#    keep this value relatively high.
passed-checks-for-increase: 10

# How many checks in a row that say to decrease the view distance should be required before the view distance is
# actually decreased?
passed-checks-for-decrease: 1

# Should we send a message to the console when we change the view distance?
log-view-distance-changes: false

# These settings can be specified per world. If a world is not specified or if a setting is missing, it will use the
# settings listed under the default section.
world-settings:
  default:
    # Should we not manage the view distance in this world?
    #  * Note: Even if excluded, the world's chunks will be counted for the purpose of adjusting the view distance of
    #    other worlds. If you do not want this, also be sure to set the chunk-weight to 0.
    exclude: false

    # What should the absolute minimum view distance be in this world?
    minimum-view-distance: 6

    # What should the absolute maximum view distance be in this world?
    maximum-view-distance: 20

    # Relative to the other worlds, how 'heavy' is a chunk on performance?
    #  * For example: In the End dimension, about half of the chunks you encounter are void and so have very little
    #    impact on performance. For this reason, you may want to set the chunk-weight of the End to 0.5.
    chunk-weight: 1

    # These settings concern how we count the number of chunks in this world.
    chunk-counter-settings:
      # When two players are near each other, their view distances can overlap. Should we not double count the chunks
      # that are overlapping?
      exclude-overlap: true

#  world_the_end:
#    minimum-view-distance: 8
#    maximum-view-distance: 10
#    chunk-weight: 0.5

# These are additional settings that apply if you are using Paper as your server software.
paper-settings:
  # These settings concern the no-tick view distance available in Paper 1.15.2+.
  #  * Note: higher no-tick view distances are less heavy on the server as far as TPS goes. For this reason, there is no
  #    option to adjust no-tick view distance based on TPS.
  no-tick-view-distance:
    # Should we adjust the no-tick view distance?
    enabled: true

    # Set this to the maximum number of chunks you want to be loaded by the no-tick view distance.
    #  * Note: this only counts chunks that are outside of the standard view distance of a player, but within the
    #    no-tick view distance of a player.
    #  * If you know your server can handle up to p many players with a no-tick view distance of n and a standard view
    #    distance of d, a reasonable choice is to set this to ((2n + 1)^2 - (2d + 1)^2) * p.
    #  * As an example, 6720 is the number of chunks loaded by the no-tick view distance for 20 players with a no-tick
    #    view distance of 12, and a standard view distance of 8.
    global-chunk-count-target: 6720

  # These settings are an alternative option to the reactive-mode-settings, allowing view distance to be adjusted based
  # on MSPT rather than TPS.
  #  * MSPT stands for "milliseconds per tick", and tells you how long your server takes to tick on average. A server
  #    whose MSPT is above 50 will notice things slowing down, as the TPS drops.
  alternative-reactive-mode-settings:
    # Should we use these alternative settings for reactive mode?
    use-alternative-settings: false

    # Below what MSPT should we considering increasing the view distance?
    increase-mspt-threshold: 40.0

    # Above what MSPT should we consider decreasing the view distance?
    decrease-mspt-threshold: 47.0

    # These settings concern how we determine the server's MSPT.
    #  * Only touch these settings if you know what you're doing.
    mspt-tracker-settings:
      # Over how many ticks should we collect tick durations for calculating the MSPT?
      #  * Setting this too high will make the MSPT very slow to react to changes.
      #  * Setting this too low will make the MSPT volatile.
      collection-period: 1200

    # We keep a history of MSPT vs. player-loaded chunk count in order to better predict what the MSPT will settle to
    # after increasing the view distance.
    mspt-prediction:
      # Should we use MSPT prediction when we are considering increasing the view distance?
      #  * For example, we may be at 38 MSPT with a view distance of 6, meaning we would consider increasing the view
      #    distance to 7. However, if we saw that 10 minutes ago with a view distance of 7 we had 48 MSPT, we would hold
      #    off on increasing.
      #  * Disabling this can lead to a back-and-forth game of increasing and decreasing the view distance every few
      #    minutes - not ideal.
      enabled: true

      # For how long (in minutes) should we keep a MSPT / chunk count history?
      history-length: 30

  world-settings:
    default:
      # Should we not manage the no-tick view distance in this world?
      #  * Note: Even if excluded, the world's chunks will be counted for the purpose of adjusting the no-tick view
      #    distance of other worlds.
      exclude: false

      # What should the absolute minimum no-tick view distance be in this world?
      minimum-no-tick-view-distance: 8

      # What should the absolute maximum no-tick view distance be in this world?
      maximum-no-tick-view-distance: 32
HenrikoMagnifico commented 2 years ago

Same here!

froobynooby commented 2 years ago

There were a number of changes in 1.18 with regards to view distance, i.e. the introduction of 'simulation distance'. That's the cause of the incompatibility - I will be looking into updating the plugin soon

igumen1990 commented 2 years ago

join the waiting

froobynooby commented 2 years ago

I've done most of the work for updating to 1.18 now. It'd be nice to have some people test it before I release it to Spigot - download is here (you'll just need to extract it from the zip archive): ViewDistanceTweaks-1.3.4-SNAPSHOT.zip.

I've updated all of the wording in the plugin to now use "simulation distance" and "view distance" as appropriate, including in the config.

A slightly annoying feature with 1.18 is that every time the client receives a new view distance packet from the server it refreshes all of the client's chunks, which is quite jarring to players. Because of this I've had to try to trick the client into thinking the view distance is always at maximum configured value (world-settings.{world}.view-distance.maximum-view-distance in the config). As a consequence, players may notice that client side fog doesn't always line up with the edge of the part of the world they're in, but this is the better alternative unfortunately. If you're just using the plugin to adjust simulation distance this isn't a worry.

WalnutWhip commented 2 years ago

I've done most of the work for updating to 1.18 now. It'd be nice to have some people test it before I release it to Spigot - download is here (you'll just need to extract it from the zip archive): ViewDistanceTweaks-1.3.4-SNAPSHOT.zip.

I've updated all of the wording in the plugin to now use "simulation distance" and "view distance" as appropriate, including in the config.

A slightly annoying feature with 1.18 is that every time the client receives a new view distance packet from the server it refreshes all of the client's chunks, which is quite jarring to players. Because of this I've had to try to trick the client into thinking the view distance is always at maximum configured value (world-settings.{world}.view-distance.maximum-view-distance in the config). As a consequence, players may notice that client side fog doesn't always line up with the edge of the part of the world they're in, but this is the better alternative unfortunately. If you're just using the plugin to adjust simulation distance this isn't a worry.

ok seems to be working on paper 1.18.1. no errors in console and logs successfully changing distance image

Vellemans commented 2 years ago

I've done most of the work for updating to 1.18 now. It'd be nice to have some people test it before I release it to Spigot - download is here (you'll just need to extract it from the zip archive): ViewDistanceTweaks-1.3.4-SNAPSHOT.zip.

I've updated all of the wording in the plugin to now use "simulation distance" and "view distance" as appropriate, including in the config.

A slightly annoying feature with 1.18 is that every time the client receives a new view distance packet from the server it refreshes all of the client's chunks, which is quite jarring to players. Because of this I've had to try to trick the client into thinking the view distance is always at maximum configured value (world-settings.{world}.view-distance.maximum-view-distance in the config). As a consequence, players may notice that client side fog doesn't always line up with the edge of the part of the world they're in, but this is the better alternative unfortunately. If you're just using the plugin to adjust simulation distance this isn't a worry.

Seems to do its thing ;-) (1.18.1 Paper) Only missing is the distance-changes within the logs\latest.log

froobynooby commented 2 years ago

Do you have log-changes set to true in the config? It is disabled by default

lukeeexd commented 2 years ago

I've done most of the work for updating to 1.18 now. It'd be nice to have some people test it before I release it to Spigot - download is here (you'll just need to extract it from the zip archive): ViewDistanceTweaks-1.3.4-SNAPSHOT.zip.

I've updated all of the wording in the plugin to now use "simulation distance" and "view distance" as appropriate, including in the config.

A slightly annoying feature with 1.18 is that every time the client receives a new view distance packet from the server it refreshes all of the client's chunks, which is quite jarring to players. Because of this I've had to try to trick the client into thinking the view distance is always at maximum configured value (world-settings.{world}.view-distance.maximum-view-distance in the config). As a consequence, players may notice that client side fog doesn't always line up with the edge of the part of the world they're in, but this is the better alternative unfortunately. If you're just using the plugin to adjust simulation distance this isn't a worry.

I think the placeholders are being used the wrong way? My no_tick placeholder is showing the viewdistance instead of sim distance and vice versa

froobynooby commented 2 years ago

I'll change the placeholder names to reflect the new naming to avoid future confusion. Mojang have gone against Paper's convention of naming, so what is now called 'view distance' is the equivalent of what we call 'no-tick view distance' and what is now called 'simulation distance' is what we used to call 'view distance'

Vellemans commented 2 years ago

Do you have log-changes set to true in the config? It is disabled by default

My bad ;) Didn't look that far, was too enthousiastic to see vdt was back available :D All good.

Tnx man! & Kudos to the great work!

lukeeexd commented 2 years ago

I'll change the placeholder names to reflect the new naming to avoid future confusion. Mojang have gone against Paper's convention of naming, so what is now called 'view distance' is the equivalent of what we call 'no-tick view distance' and what is now called 'simulation distance' is what we used to call 'view distance'

Jesus that's confusing lol. So simulation distance is the old no-tick?

froobynooby commented 2 years ago

Other way around - simulation distance is the ticking distance, view distance is the non-ticking distance. There's a guide here: https://eternity.community/wp-content/uploads/2021/12/ViewDistance-2.png