Interface Holder<T>
- All Known Implementing Classes:
Holder.CustomHolder,Holder.IdHolder
public interface Holder<T>
Represents an object that could either be a network ID, or a custom-defined one.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordstatic final record -
Method Summary
Modifier and TypeMethodDescriptioncustom()getOrCompute(IntFunction<T> supplier) Returns the holder as an object, or else looks up the item in the registry.intid()ifId(IntConsumer action) booleanisCustom()booleanisId()static <T> Holder<T>ofCustom(T object) static <T> Holder<T>ofId(int id)
-
Method Details
-
ofId
-
ofCustom
-
isId
boolean isId() -
id
int id() -
isCustom
boolean isCustom() -
custom
T custom() -
ifId
-
ifCustom
-
getOrCompute
Returns the holder as an object, or else looks up the item in the registry.
-