Add methods to get translation keys

Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
This commit is contained in:
Jake Potrebic
2020-08-11 19:17:46 +02:00
parent a3e3ba54a0
commit f610d0b477
18 changed files with 186 additions and 30 deletions

View File

@ -6,7 +6,7 @@ import java.util.Collections;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class MusicInstrument implements Keyed {
public abstract class MusicInstrument implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translation keys
public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn");
public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn");
@ -46,4 +46,14 @@ public abstract class MusicInstrument implements Keyed {
private static MusicInstrument getInstrument(@NotNull String key) {
return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key));
}
// Paper start - mark translation key as deprecated
/**
* @deprecated this method assumes that the instrument description
* always be a translatable component which is not guaranteed.
*/
@Override
@Deprecated(forRemoval = true)
public abstract @NotNull String translationKey();
// Paper end - mark translation key as deprecated
}