Record Class ClimbingEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.ClimbingEffect
- Record Components:
speed- TheLevelBasedValuescaling the upward climbing velocity (relative to a 0.2 base speed).holdOnCrouch- Whether holding the crouch/sneak key suspends the entity in place mid-air against a valid wall.allowedBlocks- An optionalHolderSetrestricting climbing to specific blocks; if empty, any motion-blocking block is climbable.
public record ClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch, Optional<net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block>> allowedBlocks)
extends Record
Data-driven enchantment effect component that enables a
LivingEntity
to climb vertical block surfaces similar to a spider or ladder.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the optional set of climbable blocks.static final com.mojang.serialization.Codec<ClimbingEffect> Codec for serializing and deserializingClimbingEffectinstances from JSON.static final StringJSON field key for toggling crouch-to-hold behavior on walls.static final StringRegistry path identifier for this effect component.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the climbing speed multiplier. -
Constructor Summary
ConstructorsConstructorDescriptionClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch) Constructs aClimbingEffectthat permits climbing on any solid motion-blocking surface.ClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch, Optional<net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block>> allowedBlocks) Creates an instance of aClimbingEffectrecord class.ClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch, net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block> allowedBlocks) Constructs aClimbingEffectrestricted to a specific set of climbable blocks. -
Method Summary
Modifier and TypeMethodDescriptionOptional<net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block>> Returns the value of theallowedBlocksrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theholdOnCrouchrecord component.net.minecraft.world.item.enchantment.LevelBasedValuespeed()Returns the value of thespeedrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
SPEED
JSON field key for the climbing speed multiplier.- See Also:
-
HOLD_ON_CROUCH
JSON field key for toggling crouch-to-hold behavior on walls.- See Also:
-
ALLOWED_BLOCKS
JSON field key for the optional set of climbable blocks.- See Also:
-
KEY
Registry path identifier for this effect component.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingClimbingEffectinstances from JSON.
-
-
Constructor Details
-
ClimbingEffect
public ClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch, net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block> allowedBlocks) Constructs aClimbingEffectrestricted to a specific set of climbable blocks.- Parameters:
speed- The climbing speed multiplier.holdOnCrouch- Whether crouching holds position on the wall.allowedBlocks- The set of blocks eligible for climbing.
-
ClimbingEffect
public ClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch) Constructs aClimbingEffectthat permits climbing on any solid motion-blocking surface.- Parameters:
speed- The climbing speed multiplier.holdOnCrouch- Whether crouching holds position on the wall.
-
ClimbingEffect
public ClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch, Optional<net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block>> allowedBlocks) Creates an instance of aClimbingEffectrecord class.- Parameters:
speed- the value for thespeedrecord componentholdOnCrouch- the value for theholdOnCrouchrecord componentallowedBlocks- the value for theallowedBlocksrecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
speed
public net.minecraft.world.item.enchantment.LevelBasedValue speed()Returns the value of thespeedrecord component.- Returns:
- the value of the
speedrecord component
-
holdOnCrouch
public boolean holdOnCrouch()Returns the value of theholdOnCrouchrecord component.- Returns:
- the value of the
holdOnCrouchrecord component
-
allowedBlocks
public Optional<net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block>> allowedBlocks()Returns the value of theallowedBlocksrecord component.- Returns:
- the value of the
allowedBlocksrecord component
-