PaperMC/nms-patches/WorldManager.patch

49 lines
2.8 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/WorldManager.java
+++ b/net/minecraft/server/WorldManager.java
2016-11-17 02:41:03 +01:00
@@ -35,7 +35,8 @@
}
2016-05-10 13:47:39 +02:00
public void a(@Nullable EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) {
2016-02-29 22:32:46 +01:00
- this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.worldProvider.getDimensionManager().getDimensionID(), new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
+ // CraftBukkit - this.world.dimension
2016-02-29 22:32:46 +01:00
+ this.a.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(soundeffect, soundcategory, d0, d1, d2, f, f1));
}
public void a(int i, int j, int k, int l, int i1, int j1) {}
2016-11-17 02:41:03 +01:00
@@ -49,7 +50,8 @@
2016-02-29 22:32:46 +01:00
public void a(SoundEffect soundeffect, BlockPosition blockposition) {}
public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {
2016-02-29 22:32:46 +01:00
- this.a.getPlayerList().sendPacketNearby(entityhuman, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 64.0D, this.world.worldProvider.getDimensionManager().getDimensionID(), 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) {
2016-11-17 02:41:03 +01:00
@@ -59,6 +61,12 @@
public void b(int i, BlockPosition blockposition, int j) {
Iterator iterator = this.a.getPlayerList().v().iterator();
+ // CraftBukkit start
+ EntityHuman entityhuman = null;
2016-02-29 22:32:46 +01:00
+ Entity entity = world.getEntity(i);
+ if (entity instanceof EntityHuman) entityhuman = (EntityHuman) entity;
+ // CraftBukkit end
+
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
2016-11-17 02:41:03 +01:00
@@ -67,6 +75,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));
}