geforkt von Mirrors/Paper
99 Zeilen
4.4 KiB
Diff
99 Zeilen
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 277b946bec2cfd8cfb4054504133f6ab9059ba8c..a465ef627169e62132287cded07efb5b05e1ed36 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -1750,6 +1750,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 60807ed83e4240cdf1e05654d24c55313aba813f..4fc2310287c2f0d366ac9ad23607125541a3c8bb 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -377,6 +377,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
|