Files
CatServer/patches/net/minecraft/world/ServerWorldEventHandler.java.patch
2019-02-24 22:29:41 +08:00

42 lines
2.6 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/ServerWorldEventHandler.java
+++ ../src-work/minecraft/net/minecraft/world/ServerWorldEventHandler.java
@@ -55,7 +55,7 @@
public void playSoundToAllNearExcept(@Nullable EntityPlayer player, SoundEvent soundIn, SoundCategory category, double x, double y, double z, float volume, float pitch)
{
- this.mcServer.getPlayerList().sendToAllNearExcept(player, x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.world.provider.getDimensionType().getId(), new SPacketSoundEffect(soundIn, category, x, y, z, volume, pitch));
+ this.mcServer.getPlayerList().sendToAllNearExcept(player, x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.world.dimension, new SPacketSoundEffect(soundIn, category, x, y, z, volume, pitch));
}
public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2)
@@ -77,7 +77,7 @@
public void playEvent(EntityPlayer player, int type, BlockPos blockPosIn, int data)
{
- this.mcServer.getPlayerList().sendToAllNearExcept(player, (double)blockPosIn.getX(), (double)blockPosIn.getY(), (double)blockPosIn.getZ(), 64.0D, this.world.provider.getDimensionType().getId(), new SPacketEffect(type, blockPosIn, data, false));
+ this.mcServer.getPlayerList().sendToAllNearExcept(player, (double)blockPosIn.getX(), (double)blockPosIn.getY(), (double)blockPosIn.getZ(), 64.0D, this.world.dimension, new SPacketEffect(type, blockPosIn, data, false));
}
public void broadcastSound(int soundID, BlockPos pos, int data)
@@ -87,6 +87,9 @@
public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress)
{
+ EntityPlayer entityhuman = null;
+ Entity entity = world.getEntityByID(breakerId);
+ if (entity instanceof EntityPlayer) entityhuman = (EntityPlayer) entity;
for (EntityPlayerMP entityplayermp : this.mcServer.getPlayerList().getPlayers())
{
if (entityplayermp != null && entityplayermp.world == this.world && entityplayermp.getEntityId() != breakerId)
@@ -95,6 +98,10 @@
double d1 = (double)pos.getY() - entityplayermp.posY;
double d2 = (double)pos.getZ() - entityplayermp.posZ;
+ if (entityhuman != null && entityhuman instanceof EntityPlayerMP && !entityplayermp.getBukkitEntity().canSee(((EntityPlayerMP) entityhuman).getBukkitEntity())) {
+ continue;
+ }
+
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D)
{
entityplayermp.connection.sendPacket(new SPacketBlockBreakAnim(breakerId, pos, progress));