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
FieldsModifier and TypeFieldDescriptionprivate final EquipmentSlotThe field for theinSlotrecord component.private final ItemStackThe field for theitemStackrecord component.The field for theonBreakrecord component.private final LivingEntityThe field for theownerrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionEnchantedItemInUse(ItemStack p_344800_, EquipmentSlot p_344722_, LivingEntity p_345536_) EnchantedItemInUse(ItemStack itemStack, EquipmentSlot inSlot, LivingEntity owner, Consumer<Item> onBreak) Creates an instance of aEnchantedItemInUserecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.inSlot()Returns the value of theinSlotrecord component.Returns the value of theitemStackrecord component.onBreak()Returns the value of theonBreakrecord component.owner()Returns the value of theownerrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
itemStack
The field for theitemStackrecord component. -
inSlot
The field for theinSlotrecord component. -
owner
The field for theownerrecord component. -
onBreak
The field for theonBreakrecord component.
-
-
Constructor Details
-
EnchantedItemInUse
-
EnchantedItemInUse
public EnchantedItemInUse(ItemStack itemStack, @Nullable EquipmentSlot inSlot, @Nullable LivingEntity owner, Consumer<Item> onBreak) Creates an instance of aEnchantedItemInUserecord class.- Parameters:
itemStack- the value for theitemStackrecord componentinSlot- the value for theinSlotrecord componentowner- the value for theownerrecord componentonBreak- the value for theonBreakrecord 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 theitemStackrecord component.- Returns:
- the value of the
itemStackrecord component
-
inSlot
Returns the value of theinSlotrecord component.- Returns:
- the value of the
inSlotrecord component
-
owner
Returns the value of theownerrecord component.- Returns:
- the value of the
ownerrecord component
-
onBreak
Returns the value of theonBreakrecord component.- Returns:
- the value of the
onBreakrecord component
-