Record Class EntityDataSource
java.lang.Object
java.lang.Record
net.minecraft.network.chat.contents.data.EntityDataSource
- All Implemented Interfaces:
DataSource
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector)
extends Record
implements DataSource
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @Nullable EntitySelectorThe field for thecompiledSelectorrecord component.static final com.mojang.serialization.MapCodec<EntityDataSource> private final StringThe field for theselectorPatternrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionEntityDataSource(String selector) EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) Creates an instance of aEntityDataSourcerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<EntityDataSource> codec()@Nullable EntitySelectorReturns the value of thecompiledSelectorrecord component.private static @Nullable EntitySelectorcompileSelector(String selector) booleanIndicates whether some other object is "equal to" this one.getData(CommandSourceStack sender) inthashCode()Returns a hash code value for this object.Returns the value of theselectorPatternrecord component.toString()Returns a string representation of this record class.
-
Field Details
-
selectorPattern
The field for theselectorPatternrecord component. -
compiledSelector
The field for thecompiledSelectorrecord component. -
MAP_CODEC
-
-
Constructor Details
-
EntityDataSource
-
EntityDataSource
Creates an instance of aEntityDataSourcerecord class.- Parameters:
selectorPattern- the value for theselectorPatternrecord componentcompiledSelector- the value for thecompiledSelectorrecord component
-
-
Method Details
-
compileSelector
-
getData
public Stream<CompoundTag> getData(CommandSourceStack sender) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
getDatain interfaceDataSource- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
codec
- Specified by:
codecin interfaceDataSource
-
toString
-
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). -
hashCode
-
selectorPattern
Returns the value of theselectorPatternrecord component.- Returns:
- the value of the
selectorPatternrecord component
-
compiledSelector
Returns the value of thecompiledSelectorrecord component.- Returns:
- the value of the
compiledSelectorrecord component
-