Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
63 Zeilen
4.6 KiB
Diff
63 Zeilen
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 fdedd4de5a6538460a4c1124bfe45ceae6f2c809..687df7dd3ac33d8f331ae141782859b80b08a6ff 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -2046,6 +2046,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
|