mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 20:07:41 +01:00
Fix NPE for Jukebox#setRecord
Fallback to the global registry if no level exists
This commit is contained in:
parent
164078cd2a
commit
d9e3bee3b5
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user