mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 04:17:44 +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
|
+ public void setSongItemWithoutPlaying(ItemStack itemstack, long ticksSinceSongStarted) { // CraftBukkit - add argument
|
||||||
+ this.item = itemstack;
|
+ this.item = itemstack;
|
||||||
+ this.jukeboxSongPlayer.song = null; // CraftBukkit - reset
|
+ 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.jukeboxSongPlayer.setSongWithoutPlaying(holder, ticksSinceSongStarted); // CraftBukkit - add argument
|
||||||
});
|
});
|
||||||
- this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
|
- this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
|
||||||
|
Loading…
Reference in New Issue
Block a user