63 lines
4.6 KiB
Diff
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 279807dc5045e765fe7496315494b2cb231d08f9..ac12d782539a5f502e8996eb39eb2ddbab46f756 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 9331f96f68f121b41ce74904d624520291b7c72e..1074995e8c8a83f6cdb94019123fbffa309d5e08 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 addce5ab16b975b3c6690ae09aef88dfbfb454b8..4bef2d3c8318da57e5721d728953f8d5ac6b0ff6 100644
|
||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||
|
@@ -1998,6 +1998,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
|