summaryrefslogtreecommitdiffstats
path: root/nms-patches/WorldManager.patch
blob: 4a9fa5b4e5bca36568bf9bb9bb6b18c5a372435a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--- a/net/minecraft/server/WorldManager.java
+++ b/net/minecraft/server/WorldManager.java
@@ -24,11 +24,13 @@
     }
 
     public void a(String s, double d0, double d1, double d2, float f, float f1) {
-        this.a.getPlayerList().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.worldProvider.getDimension(), new PacketPlayOutNamedSoundEffect(s, d0, d1, d2, f, f1));
+        // CraftBukkit - this.world.dimension
+        this.a.getPlayerList().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(s, d0, d1, d2, f, f1));
     }
 
     public void a(EntityHuman entityhuman, String s, double d0, double d1, double d2, float f, float f1) {
-        this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.worldProvider.getDimension(), new PacketPlayOutNamedSoundEffect(s, d0, d1, d2, f, f1));
+        // CraftBukkit - this.world.dimension
+        this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(s, d0, d1, d2, f, f1));
     }
 
     public void a(int i, int j, int k, int l, int i1, int j1) {}
@@ -42,7 +44,8 @@
     public void a(String s, BlockPosition blockposition) {}
 
     public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {
-        this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world.worldProvider.getDimension(), new PacketPlayOutWorldEvent(i, blockposition, j, false));
+        // CraftBukkit - this.world.dimension
+        this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world.dimension, new PacketPlayOutWorldEvent(i, blockposition, j, false));
     }
 
     public void a(int i, BlockPosition blockposition, int j) {
@@ -52,6 +55,12 @@
     public void b(int i, BlockPosition blockposition, int j) {
         Iterator iterator = this.a.getPlayerList().v().iterator();
 
+        // CraftBukkit start
+        EntityHuman entityhuman = null;
+        Entity entity = world.a(i); // PAIL Rename getEntity
+        if (entity instanceof EntityHuman) entityhuman = (EntityHuman) entity;
+        // CraftBukkit end
+
         while (iterator.hasNext()) {
             EntityPlayer entityplayer = (EntityPlayer) iterator.next();
 
@@ -60,6 +69,12 @@
                 double d1 = (double) blockposition.getY() - entityplayer.locY;
                 double d2 = (double) blockposition.getZ() - entityplayer.locZ;
 
+                // CraftBukkit start
+                if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
+                    continue;
+                }
+                // CraftBukkit end
+
                 if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
                     entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
                 }