Paper/patches/server/0040-Per-Player-View-Distance-API-placeholders.patch
Nassim Jahnke c50fc3a026
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#7480)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
8d818032 PR-723: Add Furnace#getRecipesUsed
d7b5a313 PR-726: Add Particle dataTypes to javadocs
72fe8b71 PR-724: Add PDC to World

CraftBukkit Changes:
c0326c28 PR-1009: Add Furnace#getRecipesUsed
cc5ddd79 PR-1010: Add PDC to World
6a54e5d3 PR-1012: Always save as skull owner and not as internal data

Spigot Changes:
699290cd Rebuild patches
2022-02-15 11:30:58 +01:00

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 1d0c745673bfb14966c6d644825604260f2bc69f..deeb4afbbe6d4b6f44dfe20265a1a2d7d7e66e2e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1828,6 +1828,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 9357440824bf8b125d08c6c785e71c9b1ac95ae4..fe27669d525c84d9f8d828dfcde1c35e3ecb7a49 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -389,6 +389,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