Fix Registry#getKey implementation

This commit is contained in:
Jake Potrebic
2024-12-21 14:56:01 -08:00
parent 54debf494f
commit 46c6f497c7
13 changed files with 164 additions and 277 deletions

View File

@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit;
import com.google.common.base.Preconditions;
import io.papermc.paper.util.Holderable;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.Instrument;
@@ -75,8 +76,7 @@ public class CraftMusicInstrument extends MusicInstrument implements io.papermc.
@NotNull
@Override
public NamespacedKey getKey() {
if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.INSTRUMENT.getKey(this), () -> this + " doesn't have a key"); // Paper
return this.key;
return Holderable.super.getKey();
}
// Paper start - add translationKey methods