Class AbstractRegisterEntry<T>
java.lang.Object
com.hexagram2021.chromosomelib.registry.AbstractRegisterEntry<T>
- Type Parameters:
T- the type of the entry
- All Implemented Interfaces:
Supplier<T>,net.minecraft.core.Holder<T>
public abstract class AbstractRegisterEntry<T>
extends Object
implements net.minecraft.core.Holder<T>, Supplier<T>
Abstract register entry.
-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractRegisterEntry(net.minecraft.resources.ResourceKey<T> key) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract net.minecraft.core.Holder<T>asHolder()Get the vanilla holder of the entry.abstract booleancanSerializeIn(net.minecraft.core.HolderOwner<T> owner) static <T> intcompare(net.minecraft.core.Holder<T> a, net.minecraft.core.Holder<T> b) Compare two holders.booleanstatic booleanequals(net.minecraft.core.Holder<?> a, net.minecraft.core.Holder<?> b) Compare two holders.get()inthashCode()static inthashCode(net.minecraft.core.Holder<?> holder) Get the hash code of the holder.net.minecraft.resources.ResourceLocationid()Get the id of the entry.booleanbooleanbooleanis(net.minecraft.resources.ResourceLocation id) abstract booleanabstract booleanisBound()net.minecraft.resources.ResourceKey<T>key()Get the key of the entry.net.minecraft.core.Holder.Kindkind()static <T> it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.core.Holder<T>>Create a tree map with the comparator.static <T,V> Map<net.minecraft.core.Holder<T>, V> Create a tree map with the comparator.static <T> Set<net.minecraft.core.Holder<T>>Create a tree set with the comparator.tags()toString()unwrap()abstract Tvalue()
-
Field Details
-
key
resource key of the entry
-
-
Constructor Details
-
AbstractRegisterEntry
Constructor.- Parameters:
key- resource key of the entry
-
-
Method Details
-
is
public boolean is(net.minecraft.resources.ResourceLocation id) - Specified by:
isin interfacenet.minecraft.core.Holder<T>- Parameters:
id- id to check- Returns:
- true if the entry matches the id.
-
is
- Specified by:
isin interfacenet.minecraft.core.Holder<T>- Parameters:
key- key to check- Returns:
- true if the entry matches the key.
-
is
- Specified by:
isin interfacenet.minecraft.core.Holder<T>- Parameters:
filter- filter to check- Returns:
- true if the entry matches the filter.
-
is
- Specified by:
isin interfacenet.minecraft.core.Holder<T>- Parameters:
tag- tag to check- Returns:
- true if the entry is in the tag.
-
tags
- Specified by:
tagsin interfacenet.minecraft.core.Holder<T>- Returns:
- tags of the entry.
-
isBound
public abstract boolean isBound()- Specified by:
isBoundin interfacenet.minecraft.core.Holder<T>- Returns:
- true if the entry is bound.
-
unwrap
- Specified by:
unwrapin interfacenet.minecraft.core.Holder<T>- Returns:
- resource key of the entry.
- See Also:
-
Holder.Reference.unwrap()
-
unwrapKey
- Specified by:
unwrapKeyin interfacenet.minecraft.core.Holder<T>- Returns:
- resource key of the entry.
- See Also:
-
Holder.Reference.unwrapKey()
-
kind
public net.minecraft.core.Holder.Kind kind()- Specified by:
kindin interfacenet.minecraft.core.Holder<T>- Returns:
- kind of the entry.
- See Also:
-
Holder.Reference.kind()
-
canSerializeIn
- Specified by:
canSerializeInin interfacenet.minecraft.core.Holder<T>- Parameters:
owner- owner of the entry- Returns:
- true if the entry can be serialized in the owner.
- See Also:
-
Holder.Reference.canSerializeIn(net.minecraft.core.HolderOwner<T>)
-
value
- Specified by:
valuein interfacenet.minecraft.core.Holder<T>- Returns:
- value of the entry.
- See Also:
-
Holder.value()
-
get
-
equals
-
hashCode
public int hashCode() -
toString
-
asHolder
Get the vanilla holder of the entry.- Returns:
- vanilla holder of the entry.
-
asOptional
- Returns:
- optional of the entry. null if the entry is not bound.
-
id
public net.minecraft.resources.ResourceLocation id()Get the id of the entry.- Returns:
- id of the entry.
-
key
Get the key of the entry.- Returns:
- key of the entry.
-
equals
public static boolean equals(net.minecraft.core.Holder<?> a, net.minecraft.core.Holder<?> b) Compare two holders.- Parameters:
a- first holderb- second holder- Returns:
- true if the holders are equal. false otherwise.
-
hashCode
public static int hashCode(net.minecraft.core.Holder<?> holder) Get the hash code of the holder.- Parameters:
holder- to get the hash code- Returns:
- hash code of the holder.
-
compare
public static <T> int compare(net.minecraft.core.Holder<T> a, net.minecraft.core.Holder<T> b) Compare two holders.- Type Parameters:
T- the type of the entry- Parameters:
a- first holderb- second holder- Returns:
- the result of the comparison.
-
newHolderTreeMap
Create a tree map with the comparator. Users should use this instead ofMaps.newIdentityHashMap().- Type Parameters:
T- the type of the entryV- the type of the value- Returns:
- a tree map with the comparator.
-
newHolderTreeSet
Create a tree set with the comparator. Users should use this instead ofSets.newIdentityHashSet().- Type Parameters:
T- the type of the entry- Returns:
- a tree set with the comparator.
-
newHolderObject2IntTreeMap
public static <T> it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.core.Holder<T>> newHolderObject2IntTreeMap()Create a tree map with the comparator. Users should use this instead ofMaps.newIdentityHashMap().- Type Parameters:
T- the type of the entry- Returns:
- a tree map with the comparator.
-