Fix crafting completion sound broadcasting to all nearby players (#1239)

Co-authored-by: UltraProdigy <[email protected]>
This commit is contained in:
Eldrinn-ElanteyandUltraProdigy authored and GitHub committed 2026-04-26 04:00:01 +00:00
1 parent ecb65102ab
commit 98c156c3e0
2 files changed
+12 -2

No files matched your search

@@ -7,6 +7,7 @@ import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.play.server.S29PacketSoundEffect;
import appeng.core.AELog;
import appeng.core.sync.network.NetworkHandler;
@@ -36,7 +37,8 @@ public class CraftingNotificationManager {
player.addChatMessage(notification.createMessage());
}
player.worldObj.playSoundAtEntity(player, "random.levelup", 1f, 1f);
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(
new S29PacketSoundEffect("random.levelup", player.posX, player.posY, player.posZ, 1f, 1f));
}
}
}
@@ -46,6 +46,7 @@ import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.network.play.server.S29PacketSoundEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
@@ -199,7 +200,14 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
}
player.addChatMessage(notification.createMessage());
player.worldObj.playSoundAtEntity(player, "random.levelup", 1f, 1f);
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(
new S29PacketSoundEffect(
"random.levelup",
player.posX,
player.posY,
player.posZ,
1f,
1f));
} else {
this.unreadNotifications.computeIfAbsent(playerName, name -> new ArrayList<>())
.add(notification);