mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
39 lines
3.4 KiB
Diff
39 lines
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 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/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
index 3a2a20c407374e5e62aa8ef2967a5b189d4e9658..9d6d8bf5f38ec11f26665ae676c46e4ef089670b 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
@@ -640,8 +640,9 @@ public class EnderDragon extends Mob implements Enemy {
|
|
if (this.dragonDeathTime == 1 && !this.isSilent()) {
|
|
// CraftBukkit start - Use relative location for far away sounds
|
|
// this.world.b(1028, this.getChunkCoordinates(), 0);
|
|
- int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16;
|
|
- for (net.minecraft.server.level.ServerPlayer player : this.level.getServer().getPlayerList().players) {
|
|
+ //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.ServerPlayer player : (List<net.minecraft.server.level.ServerPlayer>) ((ServerLevel)level).players()) {
|
|
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
|
double deltaX = this.getX() - player.getX();
|
|
double deltaZ = this.getZ() - player.getZ();
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
index e231bb4d0bbb19b219ec78e4c1084103c0070733..03263689479d0f163fceb834bda07e7be13b798d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
@@ -260,8 +260,9 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
|
if (!this.isSilent()) {
|
|
// CraftBukkit start - Use relative location for far away sounds
|
|
// this.world.b(1023, new BlockPosition(this), 0);
|
|
- int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16;
|
|
- for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
|
+ //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 (ServerPlayer player : (List<ServerPlayer>)this.level.players()) {
|
|
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
|
double deltaX = this.getX() - player.getX();
|
|
double deltaZ = this.getZ() - player.getZ();
|
|
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|