Record Class SetBlockProperties
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.SetBlockProperties
- All Implemented Interfaces:
EnchantmentEntityEffect, EnchantmentLocationBasedEffect
public record SetBlockProperties(BlockItemStateProperties properties, Vec3i offset, Optional<Holder<GameEvent>> triggerGameEvent)
extends Record
implements EnchantmentEntityEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<SetBlockProperties> private final Vec3iThe field for theoffsetrecord component.private final BlockItemStatePropertiesThe field for thepropertiesrecord component.The field for thetriggerGameEventrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionSetBlockProperties(BlockItemStateProperties properties) SetBlockProperties(BlockItemStateProperties properties, Vec3i offset, Optional<Holder<GameEvent>> triggerGameEvent) Creates an instance of aSetBlockPropertiesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position) com.mojang.serialization.MapCodec<SetBlockProperties> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.offset()Returns the value of theoffsetrecord component.Returns the value of thepropertiesrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetriggerGameEventrecord component.Methods inherited from interface EnchantmentEntityEffect
onChangedBlockMethods inherited from interface EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
properties
The field for thepropertiesrecord component. -
offset
The field for theoffsetrecord component. -
triggerGameEvent
-
CODEC
-
-
Constructor Details
-
SetBlockProperties
-
SetBlockProperties
public SetBlockProperties(BlockItemStateProperties properties, Vec3i offset, Optional<Holder<GameEvent>> triggerGameEvent) Creates an instance of aSetBlockPropertiesrecord class.- Parameters:
properties- the value for thepropertiesrecord componentoffset- the value for theoffsetrecord componenttriggerGameEvent- the value for thetriggerGameEventrecord 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. All components in this record class are compared withObjects::equals(Object,Object). -
properties
Returns the value of thepropertiesrecord component.- Returns:
- the value of the
propertiesrecord component
-
offset
Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-
triggerGameEvent
-