Record Class EnchantedItemInUse
java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.EnchantedItemInUse
public record EnchantedItemInUse(ItemStack itemStack, @Nullable EquipmentSlot inSlot, @Nullable LivingEntity owner, Consumer<Item> onBreak)
extends Record
-
Field Summary
Modifier and TypeFieldDescriptionprivate final EquipmentSlot
The field for theinSlot
record component.private final ItemStack
The field for theitemStack
record component.The field for theonBreak
record component.private final LivingEntity
The field for theowner
record component. -
Constructor Summary
ConstructorDescriptionEnchantedItemInUse
(ItemStack p_344800_, EquipmentSlot p_344722_, LivingEntity p_345536_) EnchantedItemInUse
(ItemStack itemStack, EquipmentSlot inSlot, LivingEntity owner, Consumer<Item> onBreak) Creates an instance of aEnchantedItemInUse
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.inSlot()
Returns the value of theinSlot
record component.Returns the value of theitemStack
record component.onBreak()
Returns the value of theonBreak
record component.owner()
Returns the value of theowner
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
itemStack
The field for theitemStack
record component. -
inSlot
The field for theinSlot
record component. -
owner
The field for theowner
record component. -
onBreak
The field for theonBreak
record component.
-
-
Constructor Details
-
EnchantedItemInUse
-
EnchantedItemInUse
public EnchantedItemInUse(ItemStack itemStack, @Nullable EquipmentSlot inSlot, @Nullable LivingEntity owner, Consumer<Item> onBreak) Creates an instance of aEnchantedItemInUse
record class.- Parameters:
itemStack
- the value for theitemStack
record componentinSlot
- the value for theinSlot
record componentowner
- the value for theowner
record componentonBreak
- the value for theonBreak
record component
-
-
Method Details
-
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)
. -
itemStack
Returns the value of theitemStack
record component.- Returns:
- the value of the
itemStack
record component
-
inSlot
Returns the value of theinSlot
record component.- Returns:
- the value of the
inSlot
record component
-
owner
Returns the value of theowner
record component.- Returns:
- the value of the
owner
record component
-
onBreak
Returns the value of theonBreak
record component.- Returns:
- the value of the
onBreak
record component
-