Record Class Holder.Direct<T>
java.lang.Object
java.lang.Record
net.minecraft.core.Holder.Direct<T>
- All Implemented Interfaces:
Holder<T>, IHolderExtension<T>, IWithData<T>
public static record Holder.Direct<T>(T value, DataComponentMap components)
extends Record
implements Holder<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface Holder
Holder.Direct<T>, Holder.Kind, Holder.Reference<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataComponentMapThe field for thecomponentsrecord component.private final TThe field for thevaluerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDirect(T value, DataComponentMap components) Creates an instance of aDirectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancanSerializeIn(HolderOwner<T> registry) Returns the value of thecomponentsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanis(Predicate<ResourceKey<T>> predicate) booleanbooleanis(Identifier key) booleanis(ResourceKey<T> key) booleanbooleanisBound()kind()tags()toString()Returns a string representation of this record class.com.mojang.datafixers.util.Either<ResourceKey<T>, T> unwrap()value()Returns the value of thevaluerecord component.Methods inherited from interface Holder
getRegisteredNameMethods inherited from interface IHolderExtension
getDelegate, getKey, unwrapLookup
-
Field Details
-
value
The field for thevaluerecord component. -
components
The field for thecomponentsrecord component.
-
-
Constructor Details
-
Direct
Creates an instance of aDirectrecord class.- Parameters:
value- the value for thevaluerecord componentcomponents- the value for thecomponentsrecord component
-
-
Method Details
-
isBound
-
areComponentsBound
public boolean areComponentsBound()- Specified by:
areComponentsBoundin interfaceHolder<T>
-
is
-
is
-
is
-
is
-
is
-
unwrap
-
unwrapKey
-
kind
-
toString
-
canSerializeIn
- Specified by:
canSerializeInin interfaceHolder<T>
-
tags
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
value
-
components
Returns the value of thecomponentsrecord component.- Specified by:
componentsin interfaceHolder<T>- Returns:
- the value of the
componentsrecord component
-