Record Class BlockReplacement

java.lang.Object
java.lang.Record
dev.wyck.renderer.packet.data.BlockReplacement

@NullMarked @AsOf("0.0.6") public record BlockReplacement(Material original, Material replacement) extends Record
A data class representing a block replacement rule.
Since:
0.0.6
  • Constructor Details

    • BlockReplacement

      public BlockReplacement(Material original, Material replacement)
      Creates an instance of a BlockReplacement record class.
      Parameters:
      original - the value for the original record component
      replacement - the value for the replacement record component
  • Method Details

    • originalBlock

      @AsOf("0.0.6") public Material originalBlock()
      Returns the original block material.
      Returns:
      the original block material
    • replacementBlock

      @AsOf("0.0.6") public Material replacementBlock()
      Returns the replacement block material.
      Returns:
      the replacement block material
    • of

      @AsOf("0.0.6") public static BlockReplacement of(Material originalBlock, Material replacementBlock)
      Creates a new BlockReplacement instance.
      Parameters:
      originalBlock - the original block material
      replacementBlock - the replacement block material
      Returns:
      a new BlockReplacement instance
    • of

      @AsOf("2.1.0") public static Collection<BlockReplacement> of(Map<Material,Material> replacements)
      Creates a collection of BlockReplacement instances from a map of original and replacement block materials.
      Parameters:
      replacements - the map of original and replacement block materials
      Returns:
      a collection of BlockReplacement instances
    • of

      @AsOf("2.1.0") public static Collection<BlockReplacement> of(Collection<Material> originals, Collection<Material> replacements)
      Creates a collection of BlockReplacement instances from a collection of original block materials and a collection of replacement block materials.
      Parameters:
      originals - the collection of original block materials
      replacements - the collection of replacement block materials
      Returns:
      a collection of BlockReplacement instances
    • of

      @AsOf("2.1.0") public static Collection<BlockReplacement> of(Material... replacements)
      Creates a collection of BlockReplacement instances from an array of materials.
      Parameters:
      replacements - the array of materials
      Returns:
      a collection of BlockReplacement instances
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • original

      public Material original()
      Returns the value of the original record component.
      Returns:
      the value of the original record component
    • replacement

      public Material replacement()
      Returns the value of the replacement record component.
      Returns:
      the value of the replacement record component