Paper/Spigot-Server-Patches/0351-Per-Player-View-Distance-API-placeholders.patch
Daniel Ennis c97ce029e9
1.16.2 Release (#4123)
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues.

Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong.

This is now resolved.

Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me.

Please as always, backup your worlds and test before updating to 1.16.2!

If you update to 1.16.2, there is no going back to an older build than this.

---------------------------------

Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com>
Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com>
Co-authored-by: stonar96 <minecraft.stonar96@gmail.com>
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
Co-authored-by: Jason <jasonpenilla2@me.com>
Co-authored-by: kashike <kashike@vq.lc>
Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com>
Co-authored-by: KennyTV <kennytv@t-online.de>
Co-authored-by: commandblockguy <commandblockguy1@gmail.com>
Co-authored-by: DigitalRegent <misterwener@gmail.com>
Co-authored-by: ishland <ishlandmc@yeah.net>
2020-08-24 22:40:19 -04: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 8da02467dff4b9da644aa12e453d127b7a01e259..0e7c5dd9224d06fecf75c00c0c56d610a8fa8f4c 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 dd4d12f4e3ab5385b85504bde962adce2981dfb5..1511212cbfbece279d9f66473bd6b5bc46b9e8e0 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 d43ada6dccb45060ea37acf7a2a8ea6a4d74ab18..747dd3c06d24b395d9d940413fe47a63b66e65d0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2024,6 +2024,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