Package net.minecraft.inventory
Interface StackReference
public interface StackReference
Represents a reference to a stack that supports getting and setting.
Often for command access. Usually obtained from entities.
Screen handlers also use stack references to pass a mutable cursor stack to some methods.
- See Also:
- Mappings:
Namespace Name official bgqintermediary net/minecraft/class_5630named net/minecraft/inventory/StackReference
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionget()Gets the current item stack.static StackReferenceof(LivingEntity entity, EquipmentSlot slot) Creates a stack reference backed by an equipment slot of a living entity with no filter, allowing direct manipulation of the equipment slot.static StackReferenceof(LivingEntity entity, EquipmentSlot slot, Predicate<ItemStack> filter) Creates a stack reference backed by an equipment slot of a living entity and guarded by a condition for setting stacks into the inventory.static StackReferenceCreates a stack reference backed by an index within an inventory.static StackReferenceCreates a stack reference backed by an index within an inventory and guarded by a condition for setting stacks into the inventory.booleanSets thestack.
-
Field Details
-
EMPTY
An immutable empty stack reference.- Mappings:
Namespace Name Mixin selector official bLbgq;b:Lbgq;intermediary field_27860Lnet/minecraft/class_5630;field_27860:Lnet/minecraft/class_5630;named EMPTYLnet/minecraft/inventory/StackReference;EMPTY:Lnet/minecraft/inventory/StackReference;
-
-
Method Details
-
of
Creates a stack reference backed by an index within an inventory and guarded by a condition for setting stacks into the inventory.- Parameters:
stackFilter- the condition to guard stack setting- Mappings:
Namespace Name Mixin selector official aLbgq;a(Lbdp;ILjava/util/function/Predicate;)Lbgq;intermediary method_32329Lnet/minecraft/class_5630;method_32329(Lnet/minecraft/class_1263;ILjava/util/function/Predicate;)Lnet/minecraft/class_5630;named ofLnet/minecraft/inventory/StackReference;of(Lnet/minecraft/inventory/Inventory;ILjava/util/function/Predicate;)Lnet/minecraft/inventory/StackReference;
-
of
Creates a stack reference backed by an index within an inventory.- Mappings:
Namespace Name Mixin selector official aLbgq;a(Lbdp;I)Lbgq;intermediary method_32328Lnet/minecraft/class_5630;method_32328(Lnet/minecraft/class_1263;I)Lnet/minecraft/class_5630;named ofLnet/minecraft/inventory/StackReference;of(Lnet/minecraft/inventory/Inventory;I)Lnet/minecraft/inventory/StackReference;
-
of
Creates a stack reference backed by an equipment slot of a living entity and guarded by a condition for setting stacks into the inventory.- Parameters:
filter- the condition to guard stack setting- Mappings:
Namespace Name Mixin selector official aLbgq;a(Lbfx;Lbfm;Ljava/util/function/Predicate;)Lbgq;intermediary method_32331Lnet/minecraft/class_5630;method_32331(Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;Ljava/util/function/Predicate;)Lnet/minecraft/class_5630;named ofLnet/minecraft/inventory/StackReference;of(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;Ljava/util/function/Predicate;)Lnet/minecraft/inventory/StackReference;
-
of
Creates a stack reference backed by an equipment slot of a living entity with no filter, allowing direct manipulation of the equipment slot.- Mappings:
Namespace Name Mixin selector official aLbgq;a(Lbfx;Lbfm;)Lbgq;intermediary method_32330Lnet/minecraft/class_5630;method_32330(Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;)Lnet/minecraft/class_5630;named ofLnet/minecraft/inventory/StackReference;of(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;)Lnet/minecraft/inventory/StackReference;
-
get
ItemStack get()Gets the current item stack.- Mappings:
Namespace Name Mixin selector official aLbgq;a()Lcfx;intermediary method_32327Lnet/minecraft/class_5630;method_32327()Lnet/minecraft/class_1799;named getLnet/minecraft/inventory/StackReference;get()Lnet/minecraft/item/ItemStack;
-
set
Sets thestack.- Parameters:
stack- the item stack to set- Returns:
trueif the setting is successful,falseif rejected- Mappings:
Namespace Name Mixin selector official aLbgq;a(Lcfx;)Zintermediary method_32332Lnet/minecraft/class_5630;method_32332(Lnet/minecraft/class_1799;)Znamed setLnet/minecraft/inventory/StackReference;set(Lnet/minecraft/item/ItemStack;)Z
-