geforkt von Mirrors/Paper
3faaaab75d
Some pretty micro optimizations, but this is the hottest method in the server.... This will drastically reduce number of operations to perform getType the 2 previous patches was squashed into 1
49 Zeilen
3.1 KiB
Diff
49 Zeilen
3.1 KiB
Diff
From 623109be2ae9e2d0333a56d797a67e5616f6dc59 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 31 May 2016 22:53:50 -0400
|
|
Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
|
|
|
|
Also fix view distance lookup
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
|
index 5c5452d..166d893 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
|
@@ -560,8 +560,12 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
|
if (this.bH == 1) {
|
|
// CraftBukkit start - Use relative location for far away sounds
|
|
// this.world.a(1028, new BlockPosition(this), 0);
|
|
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
|
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
|
+ // Paper start
|
|
+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
|
+ for (EntityHuman human : world.players) {
|
|
+ EntityPlayer player = (EntityPlayer) human;
|
|
+ int viewDistance = player.getViewDistance();
|
|
+ // 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 c7031fc..1556a24 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityWither.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityWither.java
|
|
@@ -202,8 +202,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
|
|
|
// CraftBukkit start - Use relative location for far away sounds
|
|
// this.world.a(1023, new BlockPosition(this), 0);
|
|
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
|
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
|
+ // Paper start
|
|
+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
|
+ for (EntityHuman human : world.players) {
|
|
+ EntityPlayer player = (EntityPlayer) human;
|
|
+ int viewDistance = player.getViewDistance();
|
|
+ // Paper end
|
|
double deltaX = this.locX - player.locX;
|
|
double deltaZ = this.locZ - player.locZ;
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
|
--
|
|
2.9.0
|
|
|