#804: Added methods to get translation keys for materials, itemstacks and more

By: mfnalex <mfnalex@gmail.com>
This commit is contained in:
Bukkit/Spigot
2023-02-10 20:51:15 +11:00
parent cd28159b45
commit e17edb7785
6 changed files with 92 additions and 4 deletions

View File

@@ -3,9 +3,11 @@ package org.bukkit.entity;
import com.google.common.base.Preconditions;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Keyed;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.Translatable;
import org.bukkit.World;
import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.entity.minecart.ExplosiveMinecart;
@@ -20,7 +22,7 @@ import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public enum EntityType implements Keyed {
public enum EntityType implements Keyed, Translatable {
// These strings MUST match the strings in nms.EntityTypes and are case sensitive.
/**
@@ -425,4 +427,10 @@ public enum EntityType implements Keyed {
public boolean isAlive() {
return living;
}
@Override
@NotNull
public String getTranslationKey() {
return Bukkit.getUnsafe().getTranslationKey(this);
}
}