use of net.minecraft.network.protocol.game.ClientboundSetChunkCacheRadiusPacket in project SpongeCommon by SpongePowered.
the class PrimaryLevelDataMixin method bridge$setViewDistance.
@Override
public void bridge$setViewDistance(@Nullable final Integer viewDistance) {
this.impl$viewDistance = viewDistance;
final ServerLevel world = this.bridge$world();
if (world != null) {
final int actual = viewDistance == null ? BootstrapProperties.viewDistance : viewDistance;
world.getChunkSource().setViewDistance(actual);
final ClientboundSetChunkCacheRadiusPacket packet = new ClientboundSetChunkCacheRadiusPacket(actual);
world.players().forEach(p -> p.connection.send(packet));
}
}
Aggregations