RelativityMC / raise-sound-limit-simplified

A mod that raises Minecraft sound sources limit in a simple way
MIT License
8 stars 2 forks source link

Disconnect when trying to join a server sending sounds before the world is initialized #6

Closed Lenni0451 closed 11 months ago

Lenni0451 commented 11 months ago

Describe the bug I'm unable to connect to servers if a sound is sent before the world is initialized.

To Reproduce Steps to reproduce the behavior:

  1. Place a repeating command block playing sounds on a server
  2. Reconnect

Expected behavior It's expected to join the server normally.

Runtime info (please complete the following information):

Crash reports / logs

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.world.ClientWorld.playSound(net.minecraft.entity.player.PlayerEntity, double, double, double, net.minecraft.registry.entry.RegistryEntry, net.minecraft.sound.SoundCategory, float, float, long)" because "this.client.world" is null
    at net.minecraft.client.network.ClientPlayNetworkHandler.onPlaySound(ClientPlayNetworkHandler.java:1779) ~[minecraft-merged-834ae24623-1.20.2-net.fabricmc.yarn.1_20_2.1.20.2+build.4-v2.jar:?]
    at net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket.apply(PlaySoundS2CPacket.java:89) ~[minecraft-merged-834ae24623-1.20.2-net.fabricmc.yarn.1_20_2.1.20.2+build.4-v2.jar:?]
    at net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket.apply(PlaySoundS2CPacket.java:23) ~[minecraft-merged-834ae24623-1.20.2-net.fabricmc.yarn.1_20_2.1.20.2+build.4-v2.jar:?]
    at net.minecraft.network.ClientConnection.handlePacket(ClientConnection.java:211) ~[minecraft-merged-834ae24623-1.20.2-net.fabricmc.yarn.1_20_2.1.20.2+build.4-v2.jar:?]

Checklist