Add methods to get translation keys
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* There may be additional biomes present in the server, for example from a {@link DataPack}
|
||||
* which can be accessed via {@link Registry#BIOME}.
|
||||
*/
|
||||
public interface Biome extends OldEnum<Biome>, Keyed {
|
||||
public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||
|
||||
Biome OCEAN = getBiome("ocean");
|
||||
Biome PLAINS = getBiome("plains");
|
||||
@@ -127,4 +127,11 @@ public interface Biome extends OldEnum<Biome>, Keyed {
|
||||
static Biome[] values() {
|
||||
return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]);
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
default @NotNull String translationKey() {
|
||||
return "biome.minecraft." + this.getKey().getKey();
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* (i.e. lighting and power) may not be able to be safely accessed during world
|
||||
* generation when used in cases like BlockPhysicsEvent!!!!
|
||||
*/
|
||||
public interface Block extends Metadatable, Translatable {
|
||||
public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable
|
||||
|
||||
/**
|
||||
* Gets the metadata for this block
|
||||
@@ -682,5 +682,12 @@ public interface Block extends Metadatable, Translatable {
|
||||
* @return the sound group for this block
|
||||
*/
|
||||
@NotNull org.bukkit.SoundGroup getBlockSoundGroup();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #translationKey()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(forRemoval = true)
|
||||
String getTranslationKey();
|
||||
// Paper end
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* changes may occur. Do not use this API in plugins.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public interface BlockType extends Keyed, Translatable {
|
||||
public interface BlockType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add translatable
|
||||
|
||||
/**
|
||||
* Typed represents a subtype of {@link BlockType}s that have a known block
|
||||
@@ -3616,4 +3616,13 @@ public interface BlockType extends Keyed, Translatable {
|
||||
@Nullable
|
||||
@Deprecated(since = "1.20.6")
|
||||
Material asMaterial();
|
||||
|
||||
// Paper start - add Translatable
|
||||
/**
|
||||
* @deprecated use {@link #translationKey()} and {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
@Override
|
||||
@NotNull String getTranslationKey();
|
||||
// Paper end - add Translatable
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user