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
ConstructorsConstructorDescriptionSwapResultImpl(net.minecraft.world.item.ItemStack playerHandStack, net.minecraft.world.item.ItemStack immersiveStack, net.minecraft.world.item.ItemStack leftoverStack) Creates an instance of aSwapResultImplrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.voidgiveToPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) Give theSwapResult.playerHandStack()andSwapResult.leftoverStack()to the player specified as appropriate.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.ItemStackReturns the value of theimmersiveStackrecord component.net.minecraft.world.item.ItemStackReturns the value of theleftoverStackrecord component.net.minecraft.world.item.ItemStackReturns the value of theplayerHandStackrecord component.final StringtoString()Returns a string representation of this record class.
-
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 aSwapResultImplrecord class.- Parameters:
playerHandStack- the value for theplayerHandStackrecord componentimmersiveStack- the value for theimmersiveStackrecord componentleftoverStack- the value for theleftoverStackrecord component
-
-
Method Details
-
giveToPlayer
public void giveToPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) Description copied from interface:SwapResultGive theSwapResult.playerHandStack()andSwapResult.leftoverStack()to the player specified as appropriate. This function should only be called once per swap operation.
TheSwapResult.immersiveStack()needs to be handled separately.- Specified by:
giveToPlayerin interfaceSwapResult- Parameters:
player- The player to give items to.hand- The hand the player used to interact with the Immersive.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
playerHandStack
public net.minecraft.world.item.ItemStack playerHandStack()Returns the value of theplayerHandStackrecord component.- Specified by:
playerHandStackin interfaceSwapResult- Returns:
- the value of the
playerHandStackrecord component
-
immersiveStack
public net.minecraft.world.item.ItemStack immersiveStack()Returns the value of theimmersiveStackrecord component.- Specified by:
immersiveStackin interfaceSwapResult- Returns:
- the value of the
immersiveStackrecord component
-
leftoverStack
public net.minecraft.world.item.ItemStack leftoverStack()Returns the value of theleftoverStackrecord component.- Specified by:
leftoverStackin interfaceSwapResult- Returns:
- the value of the
leftoverStackrecord component
-