Record Class StorageMenu.Source
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcore.api.menu.StorageMenu.Source
- Enclosing class:
StorageMenu
public static record StorageMenu.Source(@Nullable net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, int inventorySlot, @Nullable net.minecraft.world.item.ItemStack stack)
extends Record
What a menu is open on: a block entity (by position), or the stack in one of the player's inventory slots.
On the client, the block entity or stack is the client's own copy.
-
Constructor Summary
ConstructorsConstructorDescriptionSource(@Nullable net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, int inventorySlot, @Nullable net.minecraft.world.item.ItemStack stack) Creates an instance of aSourcerecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.world.level.block.entity.BlockEntityReturns the value of theblockEntityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theinventorySlotrecord component.booleanisItem()@Nullable net.minecraft.core.BlockPospos()Returns the value of theposrecord component.@Nullable net.minecraft.world.item.ItemStackstack()Returns the value of thestackrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Source
public Source(@Nullable @Nullable net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, int inventorySlot, @Nullable @Nullable net.minecraft.world.item.ItemStack stack) Creates an instance of aSourcerecord class.- Parameters:
pos- the value for theposrecord componentblockEntity- the value for theblockEntityrecord componentinventorySlot- the value for theinventorySlotrecord componentstack- the value for thestackrecord component
-
-
Method Details
-
isItem
public boolean isItem() -
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
pos
@Nullable public @Nullable net.minecraft.core.BlockPos pos()Returns the value of theposrecord component.- Returns:
- the value of the
posrecord component
-
blockEntity
@Nullable public @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity()Returns the value of theblockEntityrecord component.- Returns:
- the value of the
blockEntityrecord component
-
inventorySlot
public int inventorySlot()Returns the value of theinventorySlotrecord component.- Returns:
- the value of the
inventorySlotrecord component
-
stack
@Nullable public @Nullable net.minecraft.world.item.ItemStack stack()Returns the value of thestackrecord component.- Returns:
- the value of the
stackrecord component
-