3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Add RegistryType#getByKey

Dieser Commit ist enthalten in:
KennyTV 2020-12-16 19:50:49 +01:00
Ursprung 6622b7dcff
Commit 823ac0e173
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -1,5 +1,10 @@
package us.myles.ViaVersion.api.rewriters; package us.myles.ViaVersion.api.rewriters;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
public enum RegistryType { public enum RegistryType {
BLOCK("block"), BLOCK("block"),
@ -8,11 +13,23 @@ public enum RegistryType {
ENTITY("entity_type"), ENTITY("entity_type"),
GAME_EVENT("game_event"); GAME_EVENT("game_event");
private static final Map<String, RegistryType> MAP = new HashMap<>();
private static final RegistryType[] VALUES = values();
static {
for (RegistryType type : getValues()) {
MAP.put(type.resourceLocation, type);
}
}
public static RegistryType[] getValues() { public static RegistryType[] getValues() {
return VALUES; return VALUES;
} }
private static final RegistryType[] VALUES = values(); @Nullable
public static RegistryType getByKey(String resourceKey) {
return MAP.get(resourceKey);
}
private final String resourceLocation; private final String resourceLocation;