Paper/patches/server/0040-Per-Player-View-Distance-API-placeholders.patch

113 Zeilen
5.0 KiB
Diff

2021-11-23 13:15:10 +01: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 48ffa3fce91ad98d9e4c099aacf6c0a84b2093e4..28d8ba2f421245ab6707ea982e76d543916a1e51 100644
2021-11-23 13:15:10 +01:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2237,4 +2237,6 @@ public class ServerPlayer extends Player {
2022-03-01 06:43:03 +01:00
return (CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end
2021-11-23 13:15:10 +01:00
+
2022-03-01 06:43:03 +01:00
+ public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder
}
2021-11-23 13:15:10 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index cf7762e76a2d35acdfc12627e9750fbec766d555..40d6b00fb40db167c6c80b6a3f79eb82d08cdfb9 100644
2021-11-23 13:15:10 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1913,6 +1913,37 @@ public class CraftWorld extends CraftRegionAccessor implements World {
2021-11-23 13:15:10 +01:00
return world.spigotConfig.simulationDistance;
}
2022-03-01 04:00:17 +01:00
// Spigot end
+ // Paper start - view distance api
2021-11-23 13:15:10 +01:00
+ @Override
+ public void setViewDistance(int viewDistance) {
+ throw new UnsupportedOperationException(); //TODO
+ }
+
+ @Override
2022-03-01 04:00:17 +01:00
+ public void setSimulationDistance(int simulationDistance) {
+ throw new UnsupportedOperationException(); //TODO
+ }
+
+ @Override
2021-11-23 13:15:10 +01: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 04:00:17 +01:00
+ // Paper end - view distance api
2021-11-23 13:15:10 +01:00
// Spigot start
2022-03-01 04:00:17 +01:00
private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot()
2021-11-23 13:15:10 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9bcffda912e3cc7322043e705dddfe052f4b1273..62a4ae1ee2a0784787b6f45bff6393630e1d4219 100644
2021-11-23 13:15:10 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -402,6 +402,46 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2021-11-23 13:15:10 +01:00
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message);
}
}
+
+ @Override
+ public int getViewDistance() {
2022-06-07 23:01:12 +02:00
+ throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
2021-11-23 13:15:10 +01:00
+ }
+
+ @Override
+ public void setViewDistance(int viewDistance) {
2022-06-07 23:01:12 +02:00
+ throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
2021-11-23 13:15:10 +01:00
+ }
+
+ @Override
2022-03-01 04:00:17 +01:00
+ public int getSimulationDistance() {
2022-06-07 23:01:12 +02:00
+ throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
2022-03-01 04:00:17 +01:00
+ }
+
+ @Override
+ public void setSimulationDistance(int simulationDistance) {
2022-06-07 23:01:12 +02:00
+ throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
2022-03-01 04:00:17 +01:00
+ }
+
+ @Override
2021-11-23 13:15:10 +01:00
+ public int getNoTickViewDistance() {
2022-06-07 23:01:12 +02:00
+ throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
2021-11-23 13:15:10 +01:00
+ }
+
+ @Override
+ public void setNoTickViewDistance(int viewDistance) {
2022-06-07 23:01:12 +02:00
+ throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
2021-11-23 13:15:10 +01:00
+ }
+
+ @Override
+ public int getSendViewDistance() {
2022-06-07 23:01:12 +02:00
+ throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
2021-11-23 13:15:10 +01:00
+ }
+
+ @Override
+ public void setSendViewDistance(int viewDistance) {
2022-06-07 23:01:12 +02:00
+ throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
2021-11-23 13:15:10 +01:00
+ }
// Paper end
@Override