Record Class ToolComponent

java.lang.Object
java.lang.Record
net.minecraft.component.type.ToolComponent
Record Components:
rules -
defaultMiningSpeed -
damagePerBlock -

public record ToolComponent(List<ToolComponent.Rule> rules, float defaultMiningSpeed, int damagePerBlock) extends Record
Mappings:
Namespace Name
official cwc
intermediary net/minecraft/class_9424
named net/minecraft/component/type/ToolComponent
official c
intermediary comp_2498
named rules
official d
intermediary comp_2499
named defaultMiningSpeed
official e
intermediary comp_2500
named damagePerBlock
  • Field Details

    • rules

      private final List<ToolComponent.Rule> rules
      The field for the rules record component.
    • defaultMiningSpeed

      private final float defaultMiningSpeed
      The field for the defaultMiningSpeed record component.
    • damagePerBlock

      private final int damagePerBlock
      The field for the damagePerBlock record component.
    • CODEC

      public static final com.mojang.serialization.Codec<ToolComponent> CODEC
      Mappings:
      Namespace Name Mixin selector
      official a Lcwc;a:Lcom/mojang/serialization/Codec;
      intermediary field_50009 Lnet/minecraft/class_9424;field_50009:Lcom/mojang/serialization/Codec;
      named CODEC Lnet/minecraft/component/type/ToolComponent;CODEC:Lcom/mojang/serialization/Codec;
    • PACKET_CODEC

      public static final PacketCodec<RegistryByteBuf,ToolComponent> PACKET_CODEC
      Mappings:
      Namespace Name Mixin selector
      official b Lcwc;b:Lys;
      intermediary field_50010 Lnet/minecraft/class_9424;field_50010:Lnet/minecraft/class_9139;
      named PACKET_CODEC Lnet/minecraft/component/type/ToolComponent;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;
  • Constructor Details

  • Method Details

    • getSpeed

      public float getSpeed(BlockState state)
      Mappings:
      Namespace Name Mixin selector
      official a Lcwc;a(Ldqh;)F
      intermediary method_58425 Lnet/minecraft/class_9424;method_58425(Lnet/minecraft/class_2680;)F
      named getSpeed Lnet/minecraft/component/type/ToolComponent;getSpeed(Lnet/minecraft/block/BlockState;)F
    • isCorrectForDrops

      public boolean isCorrectForDrops(BlockState state)
      Mappings:
      Namespace Name Mixin selector
      official b Lcwc;b(Ldqh;)Z
      intermediary method_58426 Lnet/minecraft/class_9424;method_58426(Lnet/minecraft/class_2680;)Z
      named isCorrectForDrops Lnet/minecraft/component/type/ToolComponent;isCorrectForDrops(Lnet/minecraft/block/BlockState;)Z
    • 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 object)
      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:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • rules

      public List<ToolComponent.Rule> rules()
      Returns the value of the rules record component.
      Returns:
      the value of the rules record component
    • defaultMiningSpeed

      public float defaultMiningSpeed()
      Returns the value of the defaultMiningSpeed record component.
      Returns:
      the value of the defaultMiningSpeed record component
    • damagePerBlock

      public int damagePerBlock()
      Returns the value of the damagePerBlock record component.
      Returns:
      the value of the damagePerBlock record component