mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-23 02:25:19 +01:00
Add RegistryType#getByKey
This commit is contained in:
parent
6622b7dcff
commit
823ac0e173
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user