mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
99 lines
4.4 KiB
Diff
99 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach@zachbr.io>
|
|
Date: Mon, 6 May 2019 01:29:25 -0400
|
|
Subject: [PATCH] Per-Player View Distance API placeholders
|
|
|
|
I hope to look at this more in-depth soon. It appears doable.
|
|
However this should not block the update.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 352bfe795aea26307de9c998d67a43af3e4845f0..4689d52cd314a607d17be3657099157e95f34d47 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -167,6 +167,8 @@ import org.bukkit.inventory.MainHand;
|
|
|
|
public class ServerPlayer extends Player {
|
|
|
|
+ public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder
|
|
+
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
|
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32;
|
|
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index 8df699de4ddde3089324f347a82d913f2208f5be..4a91e8ee26ec34f605828afa75eea8dd30a1f1ef 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -1753,6 +1753,31 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
public int getSimulationDistance() {
|
|
return world.spigotConfig.simulationDistance;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public void setViewDistance(int viewDistance) {
|
|
+ throw new UnsupportedOperationException(); //TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getNoTickViewDistance() {
|
|
+ throw new UnsupportedOperationException(); //TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setNoTickViewDistance(int viewDistance) {
|
|
+ throw new UnsupportedOperationException(); //TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getSendViewDistance() {
|
|
+ throw new UnsupportedOperationException(); //TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setSendViewDistance(int viewDistance) {
|
|
+ throw new UnsupportedOperationException(); //TODO
|
|
+ }
|
|
// Spigot end
|
|
|
|
// Spigot start
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index a3de0658c00175dedfbd1844e2c18082641b7072..bcb19b6885ab90046b1361e2a9e5f9e65c9be1d0 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -379,6 +379,36 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message);
|
|
}
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public int getViewDistance() {
|
|
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setViewDistance(int viewDistance) {
|
|
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getNoTickViewDistance() {
|
|
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setNoTickViewDistance(int viewDistance) {
|
|
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getSendViewDistance() {
|
|
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setSendViewDistance(int viewDistance) {
|
|
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
|
|
+ }
|
|
// Paper end
|
|
|
|
@Override
|