Paper/Spigot-Server-Patches/0346-Per-Player-View-Distance-API-placeholders.patch
Josh Roy 4c9bdf53ac
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5299)
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:
9d0ad318 Fix javadoc errors in previous commits
9501daa2 #578: Add methods to modify the rate of regeneration and starvation
197d8f3d #577: Add EntityExhaustionEvent

CraftBukkit Changes:
a021e334 #795: Add methods to modify the rate of regeneration and starvation
509e523c #792: Add EntityExhaustionEvent

Spigot Changes:
db99f821 Rebuild patches
2021-03-03 14:43:45 -08:00

63 lines
4.6 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/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 6bd55433fafcfd8079b8e7b1ce6b65daa13b83c1..144ad80520487749a212c0b2c030386af53af14e 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -576,9 +576,10 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
if (this.deathAnimationTicks == 1 && !this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds
// this.world.b(1028, this.getChunkCoordinates(), 0);
- //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
for (EntityPlayer player : (List<EntityPlayer>) ((WorldServer)world).getPlayers()) {
- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
+ // final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
+ // Paper end
double deltaX = this.locX() - player.locX();
double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index ad5a7cbe83fb61b79203369895e82edca2ffcb72..06cf8ca80c314b7c236984c7f6236533ae7bb4a2 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -208,9 +208,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (!this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds
// this.world.b(1023, new BlockPosition(this), 0);
- //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
for (EntityPlayer player : (List<EntityPlayer>)this.world.getPlayers()) {
- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
+ // final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
double deltaX = this.locX() - player.locX();
double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 719e2ce08e780e9d6e2bbfe0e5b1b9d5be5c3e53..cdfc22f7a5c5e18178c7eeb0c3a799ce3981c4f4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2234,6 +2234,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
super.remove();
}
}
+
+ @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
+ }
// Paper end
// Spigot start