Package net.minecraft.world
Record Class InteractionResult.Success
java.lang.Object
java.lang.Record
net.minecraft.world.InteractionResult.Success
- All Implemented Interfaces:
InteractionResult
- Enclosing interface:
InteractionResult
public static record InteractionResult.Success(InteractionResult.SwingSource swingSource, InteractionResult.ItemContext itemContext)
extends Record
implements InteractionResult
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.world.InteractionResult
InteractionResult.Fail, InteractionResult.ItemContext, InteractionResult.Pass, InteractionResult.Success, InteractionResult.SwingSource, InteractionResult.TryEmptyHandInteraction
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InteractionResult.ItemContext
The field for theitemContext
record component.private final InteractionResult.SwingSource
The field for theswingSource
record component.Fields inherited from interface net.minecraft.world.InteractionResult
CONSUME, FAIL, PASS, SUCCESS, SUCCESS_SERVER, TRY_WITH_EMPTY_HAND
-
Constructor Summary
ConstructorsConstructorDescriptionSuccess
(InteractionResult.SwingSource swingSource, InteractionResult.ItemContext itemContext) Creates an instance of aSuccess
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.heldItemTransformedTo
(ItemStack p_364687_) Returns the value of theitemContext
record component.Returns the value of theswingSource
record component.final String
toString()
Returns a string representation of this record class.boolean
-
Field Details
-
swingSource
The field for theswingSource
record component. -
itemContext
The field for theitemContext
record component.
-
-
Constructor Details
-
Success
public Success(InteractionResult.SwingSource swingSource, InteractionResult.ItemContext itemContext) Creates an instance of aSuccess
record class.- Parameters:
swingSource
- the value for theswingSource
record componentitemContext
- the value for theitemContext
record component
-
-
Method Details
-
consumesAction
public boolean consumesAction()- Specified by:
consumesAction
in interfaceInteractionResult
-
heldItemTransformedTo
-
withoutItem
-
wasItemInteraction
public boolean wasItemInteraction() -
heldItemTransformedTo
-
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)
. -
swingSource
Returns the value of theswingSource
record component.- Returns:
- the value of the
swingSource
record component
-
itemContext
Returns the value of theitemContext
record component.- Returns:
- the value of the
itemContext
record component
-