Record Class SummonEntityEffect
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.SummonEntityEffect
- All Implemented Interfaces:
EnchantmentEntityEffect, EnchantmentLocationBasedEffect
public record SummonEntityEffect(HolderSet<EntityType<?>> entityTypes, boolean joinTeam)
extends Record
implements EnchantmentEntityEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SummonEntityEffect> private final HolderSet<EntityType<?>> The field for theentityTypesrecord component.private final booleanThe field for thejoinTeamrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionSummonEntityEffect(HolderSet<EntityType<?>> entityTypes, boolean joinTeam) Creates an instance of aSummonEntityEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) com.mojang.serialization.MapCodec<SummonEntityEffect> codec()HolderSet<EntityType<?>> Returns the value of theentityTypesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanjoinTeam()Returns the value of thejoinTeamrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface EnchantmentEntityEffect
onChangedBlockMethods inherited from interface EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
entityTypes
The field for theentityTypesrecord component. -
joinTeam
private final boolean joinTeamThe field for thejoinTeamrecord component. -
CODEC
-
-
Constructor Details
-
SummonEntityEffect
Creates an instance of aSummonEntityEffectrecord class.- Parameters:
entityTypes- the value for theentityTypesrecord componentjoinTeam- the value for thejoinTeamrecord component
-
-
Method Details
-
apply
public void apply(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) - Specified by:
applyin interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codecin interfaceEnchantmentEntityEffect- Specified by:
codecin interfaceEnchantmentLocationBasedEffect
-
toString
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
entityTypes
Returns the value of theentityTypesrecord component.- Returns:
- the value of the
entityTypesrecord component
-
joinTeam
public boolean joinTeam()Returns the value of thejoinTeamrecord component.- Returns:
- the value of the
joinTeamrecord component
-