Record Class Sprayed.SprayResult
java.lang.Object
java.lang.Record
dev.jaxydog.astral.content.item.custom.Sprayed.SprayResult
- Record Components:
charges- The charges that should be consumed.position- The position that the bottle was sprayed from.actions- The actions that should be executed.silent- Whether to skip playing the spray sound.
- Enclosing interface:
Sprayed
public static record Sprayed.SprayResult(int charges, net.minecraft.util.math.Vec3d position, List<Runnable> actions, boolean silent)
extends Record
The result of spraying an object.
If the result is valid, the accept(ItemStack, BiConsumer) method should be invoked.
- Since:
- 2.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionSprayResult(int charges, net.minecraft.util.math.Vec3d position, List<Runnable> actions, boolean silent) Creates an instance of aSprayResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(net.minecraft.item.ItemStack stack, BiConsumer<net.minecraft.item.ItemStack, Integer> consume) Executes the result's stored actions, consuming charges from the given stack.actions()Returns the value of theactionsrecord component.intcharges()Returns the value of thechargesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.util.math.Vec3dposition()Returns the value of thepositionrecord component.booleansilent()Returns the value of thesilentrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
accept
public void accept(net.minecraft.item.ItemStack stack, BiConsumer<net.minecraft.item.ItemStack, Integer> consume) Executes the result's stored actions, consuming charges from the given stack.- Parameters:
stack- The item stack.consume- The charge consumption method.
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
charges
public int charges()Returns the value of thechargesrecord component.- Returns:
- the value of the
chargesrecord component
-
position
public net.minecraft.util.math.Vec3d position()Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
actions
Returns the value of theactionsrecord component.- Returns:
- the value of the
actionsrecord component
-
silent
public boolean silent()Returns the value of thesilentrecord component.- Returns:
- the value of the
silentrecord component
-