Ensure no-tick view is not smaller than ticking VD

Fixes #3372.
This commit is contained in:
Mariell Hoversholm 2020-05-16 10:38:48 +02:00
parent 792993faca
commit ee99320810

View file

@ -621,6 +621,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ net.minecraft.server.PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap; + net.minecraft.server.PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
+ if (viewDistance != chunkMap.getEffectiveViewDistance()) { + if (viewDistance != chunkMap.getEffectiveViewDistance()) {
+ chunkMap.setViewDistance(viewDistance); + chunkMap.setViewDistance(viewDistance);
+ if (viewDistance > getNoTickViewDistance()) setNoTickViewDistance(viewDistance);
+ } + }
+ } + }
+ +
@ -634,6 +635,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if ((viewDistance < 2 || viewDistance > 32) && viewDistance != -1) { + if ((viewDistance < 2 || viewDistance > 32) && viewDistance != -1) {
+ throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]"); + 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; + net.minecraft.server.PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
+ if (viewDistance != chunkMap.getRawNoTickViewDistance()) { + if (viewDistance != chunkMap.getRawNoTickViewDistance()) {
+ chunkMap.setNoTickViewDistance(viewDistance); + chunkMap.setNoTickViewDistance(viewDistance);