testserver/patches/server/0039-Per-Player-View-Distan...

113 lines
5.0 KiB
Diff
Raw Normal View History

2021-11-23 12:15:10 +00:00
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 d184c3f8f8f86b783f17d71886c9b43a74482f2a..e8cda0032a6c80e939d24be190507cba006a0280 100644
2021-11-23 12:15:10 +00:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2205,4 +2205,6 @@ public class ServerPlayer extends Player {
2022-03-01 05:43:03 +00:00
return (CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end
2021-11-23 12:15:10 +00:00
+
2022-03-01 05:43:03 +00:00
+ public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder
}
2021-11-23 12:15:10 +00:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 5476dc1e80093d7684bc238bae102cbb691cec4f..be8b7170f3746e53985286066138781099930934 100644
2021-11-23 12:15:10 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1833,6 +1833,37 @@ public class CraftWorld extends CraftRegionAccessor implements World {
2021-11-23 12:15:10 +00:00
return world.spigotConfig.simulationDistance;
}
2022-03-01 03:00:17 +00:00
// Spigot end
+ // Paper start - view distance api
2021-11-23 12:15:10 +00:00
+ @Override
+ public void setViewDistance(int viewDistance) {
+ throw new UnsupportedOperationException(); //TODO
+ }
+
+ @Override
2022-03-01 03:00:17 +00:00
+ public void setSimulationDistance(int simulationDistance) {
+ throw new UnsupportedOperationException(); //TODO
+ }
+
+ @Override
2021-11-23 12:15:10 +00:00
+ 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
+ }
2022-03-01 03:00:17 +00:00
+ // Paper end - view distance api
2021-11-23 12:15:10 +00:00
// Spigot start
2022-03-01 03:00:17 +00:00
private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot()
2021-11-23 12:15:10 +00:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b6abe5d82843a60498bdb1ffc91777134662ea65..ead311bfb744a673179484ed2ba6169d3b07ba15 100644
2021-11-23 12:15:10 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -399,6 +399,46 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2021-11-23 12:15:10 +00:00
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
2022-03-01 03:00:17 +00:00
+ public int getSimulationDistance() {
+ 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 setSimulationDistance(int simulationDistance) {
+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+ }
+
+ @Override
2021-11-23 12:15:10 +00:00
+ 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