From ee9932081001a5e7580db2f4c668ffdac79b7bde Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Sat, 16 May 2020 10:38:48 +0200 Subject: [PATCH] Ensure no-tick view is not smaller than ticking VD Fixes #3372. --- .../No-Tick-view-distance-implementation.patch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch index ad6c12c449..aea2e08855 100644 --- a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch @@ -621,6 +621,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + net.minecraft.server.PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap; + if (viewDistance != chunkMap.getEffectiveViewDistance()) { + chunkMap.setViewDistance(viewDistance); ++ if (viewDistance > getNoTickViewDistance()) setNoTickViewDistance(viewDistance); + } + } + @@ -634,6 +635,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if ((viewDistance < 2 || viewDistance > 32) && viewDistance != -1) { + throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]"); + } ++ if (viewDistance < getViewDistance() && viewDistance != -1) { ++ throw new IllegalArgumentException("View distance " + viewDistance + " is smaller than current ticking view distance (" + getViewDistance() + ")"); ++ } + net.minecraft.server.PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap; + if (viewDistance != chunkMap.getRawNoTickViewDistance()) { + chunkMap.setNoTickViewDistance(viewDistance);