Class ItemContainerContents
java.lang.Object
net.minecraft.world.item.component.ItemContainerContents
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static final record
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<ItemContainerContents> static final ItemContainerContents
private final int
private final NonNullList
<ItemStack> private static final int
private static final int
static final StreamCodec
<RegistryFriendlyByteBuf, ItemContainerContents> -
Constructor Summary
ModifierConstructorDescriptionprivate
ItemContainerContents
(int p_331689_) private
ItemContainerContents
(List<ItemStack> p_331046_) private
ItemContainerContents
(NonNullList<ItemStack> p_332193_) -
Method Summary
Modifier and TypeMethodDescriptionprivate List
<ItemContainerContents.Slot> asSlots()
void
copyInto
(NonNullList<ItemStack> p_330513_) copyOne()
boolean
private static int
findLastNonEmptySlot
(List<ItemStack> p_340916_) static ItemContainerContents
private static ItemContainerContents
fromSlots
(List<ItemContainerContents.Slot> p_331424_) int
getSlots()
Returns the number of slots in this container.getStackInSlot
(int slot) Gets a copy of the stack at a particular slot.int
hashCode()
stream()
private void
validateSlotIndex
(int slot) ThrowsUnsupportedOperationException
if the provided slot index is invalid.
-
Field Details
-
NO_SLOT
private static final int NO_SLOT- See Also:
-
MAX_SIZE
private static final int MAX_SIZE- See Also:
-
EMPTY
-
CODEC
-
STREAM_CODEC
-
items
-
hashCode
private final int hashCode
-
-
Constructor Details
-
ItemContainerContents
-
ItemContainerContents
private ItemContainerContents(int p_331689_) -
ItemContainerContents
-
-
Method Details
-
fromSlots
-
fromItems
-
findLastNonEmptySlot
-
asSlots
-
copyInto
-
copyOne
-
stream
-
nonEmptyStream
-
nonEmptyItems
-
nonEmptyItemsCopy
-
equals
-
hashCode
public int hashCode() -
getSlots
public int getSlots()Returns the number of slots in this container.- Returns:
- the number of slots in this container
-
getStackInSlot
Gets a copy of the stack at a particular slot.- Parameters:
slot
- The slot to check. Must be within [0,getSlots()
]- Returns:
- A copy of the stack in that slot
- Throws:
UnsupportedOperationException
- if the provided slot index is out-of-bounds.
-
validateSlotIndex
private void validateSlotIndex(int slot) ThrowsUnsupportedOperationException
if the provided slot index is invalid.
-