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
named net/minecraft/inventory/StackReference
intermediary net/minecraft/class_5630
official bui
  • Field Details

    • EMPTY

      static final StackReference EMPTY
      An immutable empty stack reference.
      Mappings:
      Namespace Name Mixin selector
      named EMPTY Lnet/minecraft/inventory/StackReference;EMPTY:Lnet/minecraft/inventory/StackReference;
      intermediary field_27860 Lnet/minecraft/class_5630;field_27860:Lnet/minecraft/class_5630;
      official a Lbui;a:Lbui;
  • Method Details

    • of

      static StackReference of(Supplier<ItemStack> getter, Consumer<ItemStack> setter)
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/inventory/StackReference;of(Ljava/util/function/Supplier;Ljava/util/function/Consumer;)Lnet/minecraft/inventory/StackReference;
      intermediary method_59666 Lnet/minecraft/class_5630;method_59666(Ljava/util/function/Supplier;Ljava/util/function/Consumer;)Lnet/minecraft/class_5630;
      official a Lbui;a(Ljava/util/function/Supplier;Ljava/util/function/Consumer;)Lbui;
    • of

      static StackReference of(Inventory inventory, int index, Predicate<ItemStack> stackFilter)
      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
      named of Lnet/minecraft/inventory/StackReference;of(Lnet/minecraft/inventory/Inventory;ILjava/util/function/Predicate;)Lnet/minecraft/inventory/StackReference;
      intermediary method_32329 Lnet/minecraft/class_5630;method_32329(Lnet/minecraft/class_1263;ILjava/util/function/Predicate;)Lnet/minecraft/class_5630;
      official a Lbui;a(Lbqo;ILjava/util/function/Predicate;)Lbui;
    • of

      static StackReference of(Inventory inventory, int index)
      Creates a stack reference backed by an index within an inventory.
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/inventory/StackReference;of(Lnet/minecraft/inventory/Inventory;I)Lnet/minecraft/inventory/StackReference;
      intermediary method_32328 Lnet/minecraft/class_5630;method_32328(Lnet/minecraft/class_1263;I)Lnet/minecraft/class_5630;
      official a Lbui;a(Lbqo;I)Lbui;
    • of

      static StackReference of(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.
      Parameters:
      filter - the condition to guard stack setting
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/inventory/StackReference;of(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;Ljava/util/function/Predicate;)Lnet/minecraft/inventory/StackReference;
      intermediary method_32331 Lnet/minecraft/class_5630;method_32331(Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;Ljava/util/function/Predicate;)Lnet/minecraft/class_5630;
      official a Lbui;a(Lbtq;Lbtc;Ljava/util/function/Predicate;)Lbui;
    • of

      static StackReference of(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.
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/inventory/StackReference;of(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;)Lnet/minecraft/inventory/StackReference;
      intermediary method_32330 Lnet/minecraft/class_5630;method_32330(Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;)Lnet/minecraft/class_5630;
      official a Lbui;a(Lbtq;Lbtc;)Lbui;
    • get

      ItemStack get()
      Gets the current item stack.
      Mappings:
      Namespace Name Mixin selector
      named get Lnet/minecraft/inventory/StackReference;get()Lnet/minecraft/item/ItemStack;
      intermediary method_32327 Lnet/minecraft/class_5630;method_32327()Lnet/minecraft/class_1799;
      official a Lbui;a()Lcuq;
    • set

      boolean set(ItemStack stack)
      Sets the stack.
      Parameters:
      stack - the item stack to set
      Returns:
      true if the setting is successful, false if rejected
      Mappings:
      Namespace Name Mixin selector
      named set Lnet/minecraft/inventory/StackReference;set(Lnet/minecraft/item/ItemStack;)Z
      intermediary method_32332 Lnet/minecraft/class_5630;method_32332(Lnet/minecraft/class_1799;)Z
      official a Lbui;a(Lcuq;)Z