PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.37k stars 2.19k forks source link

NullPointerException when using setRecord in 1.21 ("this.level" is null) #10899

Closed Intelli closed 2 weeks ago

Intelli commented 2 weeks ago

Expected behavior

jukebox.setRecord(null); should function normally

Observed/Actual behavior

jukebox.setRecord(null); triggers the following error:

[16:41:01 WARN]: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.Level.registryAccess()" because "this.level" is null [16:41:01 WARN]: at net.minecraft.world.level.block.entity.JukeboxBlockEntity.setSongItemWithoutPlaying(JukeboxBlockEntity.java:203) [16:41:01 WARN]: at org.bukkit.craftbukkit.block.CraftJukebox.setRecord(CraftJukebox.java:86)

Steps/models to reproduce

Use Paper 1.21, and run the following code on a Jukebox:

jukebox.setRecord(null);

Plugin and Datapack List

CoreProtect

Paper version

This server is running Paper version 1.21-1-master@21c9a7c (2024-06-17T19:43:38Z) (Implementing API version 1.21-R0.1-SNAPSHOT) You are running the latest version Previous version: git-Paper-35 (MC: 1.20.6)

Other

No response