Package net.minecraft.modding.api.game
Class Registry<V>
- java.lang.Object
-
- java.util.AbstractMap<ResourceLocation,V>
-
- net.minecraft.modding.api.game.Registry<V>
-
- All Implemented Interfaces:
java.util.Map<ResourceLocation,V>
public class Registry<V> extends java.util.AbstractMap<ResourceLocation,V>
-
-
Field Summary
Fields Modifier and Type Field Description static int
UNREGISTERED_ID
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areDelayedRegistered()
java.util.Optional<V>
byId(int id)
V
byIdOrThrow(int id)
java.util.Optional<V>
byLocation(ResourceLocation location)
V
byLocationOrThrow(ResourceLocation location)
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
@NotNull java.util.Set<java.util.Map.Entry<ResourceLocation,V>>
entrySet()
boolean
equals(java.lang.Object o)
void
freeze()
V
get(java.lang.Object key)
java.util.OptionalInt
getId(V value)
java.util.OptionalInt
getIdFromLocation(ResourceLocation location)
int
getIdFromLocationOrFallback(ResourceLocation location)
int
getIdFromLocationOrThrow(ResourceLocation location)
java.util.function.ToIntFunction<V>
getIdGenerator()
int
getIdOrFallback(V value)
int
getIdOrThrow(V value)
java.util.Optional<ResourceLocation>
getLocation(V value)
java.util.Optional<ResourceLocation>
getLocationFromId(int id)
ResourceLocation
getLocationFromIdOrThrow(int id)
ResourceLocation
getLocationOrThrow(V value)
int
hashCode()
boolean
isFrozen()
@NotNull java.util.Set<ResourceLocation>
keySet()
void
lateRegister()
<R extends V>
Rregister(java.lang.String location, R value)
<R extends V>
Rregister(ResourceLocation location, R value)
<R extends V>
java.util.function.Supplier<R>registerLater(java.lang.String location, java.util.function.Supplier<R> initializer)
<R extends V>
java.util.function.Supplier<R>registerLater(ResourceLocation location, java.util.function.Supplier<R> initializer)
V
remove(java.lang.Object key)
void
requireRegister(V value)
int
size()
java.lang.String
toString()
@NotNull java.util.Collection<V>
values()
-
-
-
Field Detail
-
UNREGISTERED_ID
public static final int UNREGISTERED_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Registry
public Registry(java.util.function.ToIntFunction<V> idGenerator)
-
Registry
public Registry()
-
-
Method Detail
-
register
public <R extends V> R register(ResourceLocation location, R value)
-
register
public <R extends V> R register(java.lang.String location, R value)
-
registerLater
public <R extends V> java.util.function.Supplier<R> registerLater(ResourceLocation location, java.util.function.Supplier<R> initializer)
-
registerLater
public <R extends V> java.util.function.Supplier<R> registerLater(java.lang.String location, java.util.function.Supplier<R> initializer)
-
requireRegister
public void requireRegister(V value)
-
freeze
public void freeze()
-
lateRegister
public void lateRegister()
-
isFrozen
public boolean isFrozen()
-
areDelayedRegistered
public boolean areDelayedRegistered()
-
byLocation
public java.util.Optional<V> byLocation(ResourceLocation location)
-
byLocationOrThrow
public V byLocationOrThrow(ResourceLocation location)
-
byId
public java.util.Optional<V> byId(int id)
-
byIdOrThrow
public V byIdOrThrow(int id)
-
getLocation
public java.util.Optional<ResourceLocation> getLocation(V value)
-
getLocationOrThrow
public ResourceLocation getLocationOrThrow(V value)
-
getId
public java.util.OptionalInt getId(V value)
-
getIdOrFallback
public int getIdOrFallback(V value)
-
getIdOrThrow
public int getIdOrThrow(V value)
-
getLocationFromId
public java.util.Optional<ResourceLocation> getLocationFromId(int id)
-
getLocationFromIdOrThrow
public ResourceLocation getLocationFromIdOrThrow(int id)
-
getIdFromLocation
public java.util.OptionalInt getIdFromLocation(ResourceLocation location)
-
getIdFromLocationOrFallback
public int getIdFromLocationOrFallback(ResourceLocation location)
-
getIdFromLocationOrThrow
public int getIdFromLocationOrThrow(ResourceLocation location)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractMap<ResourceLocation,V>
-
getIdGenerator
public java.util.function.ToIntFunction<V> getIdGenerator()
-
size
public int size()
- Specified by:
size
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
size
in classjava.util.AbstractMap<ResourceLocation,V>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
containsKey
in classjava.util.AbstractMap<ResourceLocation,V>
-
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValue
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
containsValue
in classjava.util.AbstractMap<ResourceLocation,V>
-
get
public V get(java.lang.Object key)
- Specified by:
get
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
get
in classjava.util.AbstractMap<ResourceLocation,V>
-
remove
public V remove(java.lang.Object key)
- Specified by:
remove
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
remove
in classjava.util.AbstractMap<ResourceLocation,V>
-
keySet
@NotNull public @NotNull java.util.Set<ResourceLocation> keySet()
- Specified by:
keySet
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
keySet
in classjava.util.AbstractMap<ResourceLocation,V>
-
values
@NotNull public @NotNull java.util.Collection<V> values()
- Specified by:
values
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
values
in classjava.util.AbstractMap<ResourceLocation,V>
-
entrySet
@NotNull public @NotNull java.util.Set<java.util.Map.Entry<ResourceLocation,V>> entrySet()
- Specified by:
entrySet
in interfacejava.util.Map<ResourceLocation,V>
- Specified by:
entrySet
in classjava.util.AbstractMap<ResourceLocation,V>
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
equals
in classjava.util.AbstractMap<ResourceLocation,V>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Map<ResourceLocation,V>
- Overrides:
hashCode
in classjava.util.AbstractMap<ResourceLocation,V>
-
-