Upstream Paper
This commit is contained in:
@@ -1315,6 +1315,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
|
||||
this.lastYaw -= 360.0F;
|
||||
}
|
||||
|
||||
world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // Paper - ensure chunk is always loaded
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.setYawPitch(f, f1);
|
||||
}
|
||||
|
||||
@@ -1252,8 +1252,25 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet<?> packet) {
|
||||
for (int j = 0; j < this.players.size(); ++j) {
|
||||
EntityPlayer entityplayer = this.players.get(j);
|
||||
// Paper start - Use world list instead of server list where preferable
|
||||
sendPacketNearby(entityhuman, d0, d1, d2, d3, i, null, packet); // Retained for compatibility
|
||||
}
|
||||
|
||||
public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, WorldServer world, Packet<?> packet) {
|
||||
sendPacketNearby(entityhuman, d0, d1, d2, d3, world.dimension, world, packet);
|
||||
}
|
||||
|
||||
public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, @Nullable WorldServer world, Packet<?> packet) {
|
||||
if (world == null && entityhuman != null && entityhuman.world instanceof WorldServer) {
|
||||
world = (WorldServer) entityhuman.world;
|
||||
}
|
||||
|
||||
List<? extends EntityHuman> players1 = world == null ? players : world.players;
|
||||
for (int j = 0; j < players1.size(); ++j) {
|
||||
EntityHuman entity = players1.get(j);
|
||||
if (!(entity instanceof EntityPlayer)) continue;
|
||||
EntityPlayer entityplayer = (EntityPlayer) players1.get(j);
|
||||
// Paper end
|
||||
|
||||
// CraftBukkit start - Test if player receiving packet can see the source of the packet
|
||||
if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
|
||||
@@ -1261,7 +1278,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (entityplayer != entityhuman && entityplayer.dimension == i) {
|
||||
if (entityplayer != entityhuman && (world != null || entityplayer.dimension == i)) { // Paper
|
||||
double d4 = d0 - entityplayer.locX;
|
||||
double d5 = d1 - entityplayer.locY;
|
||||
double d6 = d2 - entityplayer.locZ;
|
||||
|
||||
@@ -1291,7 +1291,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (super.strikeLightning(entity)) {
|
||||
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, dimension, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension
|
||||
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entity.locX, entity.locY, entity.locZ, 512.0D, this, new PacketPlayOutSpawnEntityWeather(entity)); // CraftBukkit - Use dimension, // Paper - use world instead of dimension
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -1369,8 +1369,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
BlockActionData blockactiondata = (BlockActionData) iterator.next();
|
||||
|
||||
if (this.a(blockactiondata)) {
|
||||
// CraftBukkit - this.worldProvider.dimension -> this.dimension
|
||||
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, blockactiondata.a().getX(), blockactiondata.a().getY(), blockactiondata.a().getZ(), 64.0D, dimension, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c()));
|
||||
// CraftBukkit - this.worldProvider.dimension -> this.dimension, // Paper - dimension -> world
|
||||
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user