Record Class TrackedPosition<T>

java.lang.Object
java.lang.Record
net.frozenblock.lib.gametest.api.TrackedPosition<T>
Type Parameters:
T - The type of position being tracked
Record Components:
type - The PositionType linked to pos.
pos - The position
opposite - The position in the opposite position type

public record TrackedPosition<T>(PositionType type, T pos, T opposite) extends Record
Since:
1.3.8
  • Constructor Summary

    Constructors
    Constructor
    Description
    TrackedPosition(PositionType type, T pos, T opposite)
    Creates an instance of a TrackedPosition record class.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    assertBlockPresent(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block)
     
    static TrackedPosition<net.minecraft.core.BlockPos>
    createAbsolute(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.core.BlockPos pos)
    Creates a new TrackedPosition with the given position as its absolute value.
    static TrackedPosition<net.minecraft.core.BlockPos>
    createAbsolute(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block, net.minecraft.core.BlockPos pos)
    Creates a new TrackedPosition with the given position as its absolute value.
    static TrackedPosition<net.minecraft.world.phys.Vec3>
    createAbsolute(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block, net.minecraft.world.phys.Vec3 pos)
    Creates a new TrackedPosition with the given position as its absolute value.
    static TrackedPosition<net.minecraft.world.phys.Vec3>
    createAbsolute(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.phys.Vec3 pos)
    Creates a new TrackedPosition with the given position as its absolute value.
    static TrackedPosition<net.minecraft.core.BlockPos>
    createRelative(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.core.BlockPos pos)
    Creates a new TrackedPosition with the given position as its relative value.
    static TrackedPosition<net.minecraft.core.BlockPos>
    createRelative(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block, net.minecraft.core.BlockPos pos)
    Creates a new TrackedPosition with the given position as its relative value.
    static TrackedPosition<net.minecraft.world.phys.Vec3>
    createRelative(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block, net.minecraft.world.phys.Vec3 pos)
    Creates a new TrackedPosition with the given position as its relative value.
    static TrackedPosition<net.minecraft.world.phys.Vec3>
    createRelative(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.phys.Vec3 pos)
    Creates a new TrackedPosition with the given position as its relative value.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the opposite record component.
    pos()
    Returns the value of the pos record component.
     
    final String
    Returns a string representation of this record class.
    Returns the value of the type record component.

    Methods inherited from class java.lang.Object

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

    • TrackedPosition

      public TrackedPosition(PositionType type, T pos, T opposite)
      Creates an instance of a TrackedPosition record class.
      Parameters:
      type - the value for the type record component
      pos - the value for the pos record component
      opposite - the value for the opposite record component
  • Method Details

    • createRelative

      public static TrackedPosition<net.minecraft.core.BlockPos> createRelative(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.core.BlockPos pos)
      Creates a new TrackedPosition with the given position as its relative value.
    • createRelative

      public static TrackedPosition<net.minecraft.core.BlockPos> createRelative(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block, net.minecraft.core.BlockPos pos)
      Creates a new TrackedPosition with the given position as its relative value.

      Asserts the given block is at the position.

    • createAbsolute

      public static TrackedPosition<net.minecraft.core.BlockPos> createAbsolute(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.core.BlockPos pos)
      Creates a new TrackedPosition with the given position as its absolute value.
    • createAbsolute

      public static TrackedPosition<net.minecraft.core.BlockPos> createAbsolute(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block, net.minecraft.core.BlockPos pos)
      Creates a new TrackedPosition with the given position as its absolute value.

      Asserts the given block is at the relative position.

    • createRelative

      public static TrackedPosition<net.minecraft.world.phys.Vec3> createRelative(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.phys.Vec3 pos)
      Creates a new TrackedPosition with the given position as its relative value.
    • createRelative

      public static TrackedPosition<net.minecraft.world.phys.Vec3> createRelative(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block, net.minecraft.world.phys.Vec3 pos)
      Creates a new TrackedPosition with the given position as its relative value.

      Asserts the given block is at the position.

    • createAbsolute

      public static TrackedPosition<net.minecraft.world.phys.Vec3> createAbsolute(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.phys.Vec3 pos)
      Creates a new TrackedPosition with the given position as its absolute value.
    • createAbsolute

      public static TrackedPosition<net.minecraft.world.phys.Vec3> createAbsolute(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block, net.minecraft.world.phys.Vec3 pos)
      Creates a new TrackedPosition with the given position as its absolute value.

      Asserts the given block is at the relative position.

    • absolute

      public T absolute()
    • relative

      public T relative()
    • assertBlockPresent

      public TrackedPosition<T> assertBlockPresent(net.minecraft.gametest.framework.GameTestHelper helper, net.minecraft.world.level.block.Block block) throws IllegalStateException
      Throws:
      IllegalStateException
    • 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.
    • type

      public PositionType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • pos

      public T pos()
      Returns the value of the pos record component.
      Returns:
      the value of the pos record component
    • opposite

      public T opposite()
      Returns the value of the opposite record component.
      Returns:
      the value of the opposite record component