From d9e3bee3b5759f5c5e0dd9b6fe649863c0c22239 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 17 Jun 2024 17:41:09 -0700 Subject: [PATCH] Fix NPE for Jukebox#setRecord Fallback to the global registry if no level exists --- .../world/level/block/entity/JukeboxBlockEntity.java.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java.patch index 8dc3e0b7d3..fa8fa48ae9 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java.patch @@ -78,7 +78,7 @@ + public void setSongItemWithoutPlaying(ItemStack itemstack, long ticksSinceSongStarted) { // CraftBukkit - add argument + this.item = itemstack; + this.jukeboxSongPlayer.song = null; // CraftBukkit - reset -+ JukeboxSong.fromStack(this.level.registryAccess(), itemstack).ifPresent((holder) -> { ++ JukeboxSong.fromStack(this.level != null ? this.level.registryAccess() : org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry(), itemstack).ifPresent((holder) -> { // Paper - fallback to other RegistyrAccess if no level + this.jukeboxSongPlayer.setSongWithoutPlaying(holder, ticksSinceSongStarted); // CraftBukkit - add argument }); - this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());