Record Class ClimbingEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.ClimbingEffect
Record Components:
speed - The LevelBasedValue scaling 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 optional HolderSet restricting 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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    JSON field key for the optional set of climbable blocks.
    static final com.mojang.serialization.Codec<ClimbingEffect>
    Codec for serializing and deserializing ClimbingEffect instances from JSON.
    static final String
    JSON field key for toggling crouch-to-hold behavior on walls.
    static final String
    Registry path identifier for this effect component.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for the climbing speed multiplier.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch)
    Constructs a ClimbingEffect that 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 a ClimbingEffect record class.
    ClimbingEffect(net.minecraft.world.item.enchantment.LevelBasedValue speed, boolean holdOnCrouch, net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block> allowedBlocks)
    Constructs a ClimbingEffect restricted to a specific set of climbable blocks.
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block>>
    Returns the value of the allowedBlocks record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the holdOnCrouch record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the speed record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • SPEED

      public static final String SPEED
      JSON field key for the climbing speed multiplier.
      See Also:
    • HOLD_ON_CROUCH

      public static final String HOLD_ON_CROUCH
      JSON field key for toggling crouch-to-hold behavior on walls.
      See Also:
    • ALLOWED_BLOCKS

      public static final String ALLOWED_BLOCKS
      JSON field key for the optional set of climbable blocks.
      See Also:
    • KEY

      public static final String KEY
      Registry path identifier for this effect component.
      See Also:
    • KEY_PROVIDER

      public static final LevelBasedKeyProvider KEY_PROVIDER
      Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    • CODEC

      public static final com.mojang.serialization.Codec<ClimbingEffect> CODEC
      Codec for serializing and deserializing ClimbingEffect instances 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 a ClimbingEffect restricted 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 a ClimbingEffect that 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 a ClimbingEffect record class.
      Parameters:
      speed - the value for the speed record component
      holdOnCrouch - the value for the holdOnCrouch record component
      allowedBlocks - the value for the allowedBlocks record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • speed

      public net.minecraft.world.item.enchantment.LevelBasedValue speed()
      Returns the value of the speed record component.
      Returns:
      the value of the speed record component
    • holdOnCrouch

      public boolean holdOnCrouch()
      Returns the value of the holdOnCrouch record component.
      Returns:
      the value of the holdOnCrouch record component
    • allowedBlocks

      public Optional<net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block>> allowedBlocks()
      Returns the value of the allowedBlocks record component.
      Returns:
      the value of the allowedBlocks record component