Record Class ReplaceBlock
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.ReplaceBlock
- All Implemented Interfaces:
EnchantmentEntityEffect,EnchantmentLocationBasedEffect
public record ReplaceBlock(Vec3i offset, Optional<BlockPredicate> predicate, BlockStateProvider blockState, Optional<Holder<GameEvent>> triggerGameEvent)
extends Record
implements EnchantmentEntityEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockStateProviderThe field for theblockStaterecord component.static final com.mojang.serialization.MapCodec<ReplaceBlock> private final Vec3iThe field for theoffsetrecord component.private final Optional<BlockPredicate> The field for thepredicaterecord component.The field for thetriggerGameEventrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionReplaceBlock(Vec3i offset, Optional<BlockPredicate> predicate, BlockStateProvider blockState, Optional<Holder<GameEvent>> triggerGameEvent) Creates an instance of aReplaceBlockrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ServerLevel p_345756_, int p_346215_, EnchantedItemInUse p_345202_, Entity p_346293_, Vec3 p_345339_) Returns the value of theblockStaterecord component.com.mojang.serialization.MapCodec<ReplaceBlock> 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 thepredicaterecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetriggerGameEventrecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlockMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
offset
The field for theoffsetrecord component. -
predicate
The field for thepredicaterecord component. -
blockState
The field for theblockStaterecord component. -
triggerGameEvent
The field for thetriggerGameEventrecord component. -
CODEC
-
-
Constructor Details
-
ReplaceBlock
public ReplaceBlock(Vec3i offset, Optional<BlockPredicate> predicate, BlockStateProvider blockState, Optional<Holder<GameEvent>> triggerGameEvent) Creates an instance of aReplaceBlockrecord class.- Parameters:
offset- the value for theoffsetrecord componentpredicate- the value for thepredicaterecord componentblockState- the value for theblockStaterecord componenttriggerGameEvent- the value for thetriggerGameEventrecord component
-
-
Method Details
-
apply
public void apply(ServerLevel p_345756_, int p_346215_, EnchantedItemInUse p_345202_, Entity p_346293_, Vec3 p_345339_) - Specified by:
applyin interfaceEnchantmentEntityEffect
-
codec
- Specified by:
codecin interfaceEnchantmentEntityEffect- Specified by:
codecin interfaceEnchantmentLocationBasedEffect
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
offset
Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-
predicate
Returns the value of thepredicaterecord component.- Returns:
- the value of the
predicaterecord component
-
blockState
Returns the value of theblockStaterecord component.- Returns:
- the value of the
blockStaterecord component
-
triggerGameEvent
Returns the value of thetriggerGameEventrecord component.- Returns:
- the value of the
triggerGameEventrecord component
-