63 lines
4.8 KiB
Diff
63 lines
4.8 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/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
|
index 51993191e01f55e16667c25b8b57d6a6ddaf493b..5168a40eb53565bb3028efe559601acf72bddae5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
|
@@ -625,9 +625,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 (net.minecraft.server.level.EntityPlayer player : (List<net.minecraft.server.level.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/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
|
|
index 145767e8b0fc4105a0afa47af17dcdbb75e952bc..174eb12722872182b2d9b54841e5bb57893695a1 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
|
|
@@ -258,9 +258,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 5cdefb8978cdd3d29cc120c35040189c4f86f7bf..c0d2abd31272e35c0a0a4f8c31cfd89e56552bea 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -2245,6 +2245,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
|