Class SlotReference.Container
java.lang.Object
net.ixdarklord.coolcatcore.api.utils.SlotReference<net.minecraft.world.Container>
net.ixdarklord.coolcatcore.api.utils.SlotReference.Container
- Enclosing class:
SlotReference<T>
A
SlotReference implementation for generic containers (e.g., chests, furnaces).-
Nested Class Summary
Nested classes/interfaces inherited from class SlotReference
SlotReference.Container, SlotReference.Player -
Field Summary
Fields inherited from class SlotReference
EMPTY, index, owner -
Constructor Summary
ConstructorsConstructorDescriptionContainer(net.minecraft.world.Container container, int index) Creates a new container slot reference. -
Method Summary
Methods inherited from class SlotReference
clear, getIndex, getOwner
-
Constructor Details
-
Container
public Container(@Nullable net.minecraft.world.Container container, int index) Creates a new container slot reference.- Parameters:
container- the container owning this slotindex- the slot index within the container
-
-
Method Details
-
get
@NotNull public @NotNull net.minecraft.world.item.ItemStack get()Description copied from class:SlotReferenceRetrieves theItemStackcurrently stored in this slot.- Specified by:
getin classSlotReference<net.minecraft.world.Container>- Returns:
- the stored item, or
ItemStack.EMPTYif the slot is empty
-
set
public boolean set(net.minecraft.world.item.ItemStack stack) Description copied from class:SlotReferenceReplaces the item in this slot.- Specified by:
setin classSlotReference<net.minecraft.world.Container>- Parameters:
stack- the newItemStackto place- Returns:
trueif the item was successfully set,falseif unchanged
-