Record Class SwapResultImpl

java.lang.Object
java.lang.Record
com.hammy275.immersivemc.server.api_impl.SwapResultImpl
All Implemented Interfaces:
SwapResult

public record SwapResultImpl(net.minecraft.world.item.ItemStack playerHandStack, net.minecraft.world.item.ItemStack immersiveStack, net.minecraft.world.item.ItemStack leftoverStack) extends Record implements SwapResult
  • Constructor Summary

    Constructors
    Constructor
    Description
    SwapResultImpl(net.minecraft.world.item.ItemStack playerHandStack, net.minecraft.world.item.ItemStack immersiveStack, net.minecraft.world.item.ItemStack leftoverStack)
    Creates an instance of a SwapResultImpl record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    void
    giveToPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
    Give the SwapResult.playerHandStack() and SwapResult.leftoverStack() to the player specified as appropriate.
    final int
    Returns a hash code value for this object.
    net.minecraft.world.item.ItemStack
    Returns the value of the immersiveStack record component.
    net.minecraft.world.item.ItemStack
    Returns the value of the leftoverStack record component.
    net.minecraft.world.item.ItemStack
    Returns the value of the playerHandStack 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
  • Constructor Details

    • SwapResultImpl

      public SwapResultImpl(net.minecraft.world.item.ItemStack playerHandStack, net.minecraft.world.item.ItemStack immersiveStack, net.minecraft.world.item.ItemStack leftoverStack)
      Creates an instance of a SwapResultImpl record class.
      Parameters:
      playerHandStack - the value for the playerHandStack record component
      immersiveStack - the value for the immersiveStack record component
      leftoverStack - the value for the leftoverStack record component
  • Method Details

    • giveToPlayer

      public void giveToPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
      Description copied from interface: SwapResult
      Give the SwapResult.playerHandStack() and SwapResult.leftoverStack() to the player specified as appropriate. This function should only be called once per swap operation.
      The SwapResult.immersiveStack() needs to be handled separately.
      Specified by:
      giveToPlayer in interface SwapResult
      Parameters:
      player - The player to give items to.
      hand - The hand the player used to interact with the Immersive.
    • 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.
    • playerHandStack

      public net.minecraft.world.item.ItemStack playerHandStack()
      Returns the value of the playerHandStack record component.
      Specified by:
      playerHandStack in interface SwapResult
      Returns:
      the value of the playerHandStack record component
    • immersiveStack

      public net.minecraft.world.item.ItemStack immersiveStack()
      Returns the value of the immersiveStack record component.
      Specified by:
      immersiveStack in interface SwapResult
      Returns:
      the value of the immersiveStack record component
    • leftoverStack

      public net.minecraft.world.item.ItemStack leftoverStack()
      Returns the value of the leftoverStack record component.
      Specified by:
      leftoverStack in interface SwapResult
      Returns:
      the value of the leftoverStack record component