接口 CommandItemSlot


  • public interface CommandItemSlot
    Represents an item slot for command access. Usually obtained from entities.

    Some dispenser behaviors also use this to simulate commands' behavior of equipping items.

    另请参阅:
    Entity.getCommandItemSlot(int)
    Mappings:
    Namespace Name
    official ato
    intermediary net/minecraft/class_5630
    named net/minecraft/inventory/CommandItemSlot
    • 字段详细资料

      • EMPTY

        static final CommandItemSlot EMPTY
        An immutable empty slot.
        Mappings:
        Namespace Name Mixin selector
        official a Lato;a:Lato;
        intermediary field_27860 Lnet/minecraft/class_5630;field_27860:Lnet/minecraft/class_5630;
        named EMPTY Lnet/minecraft/inventory/CommandItemSlot;EMPTY:Lnet/minecraft/inventory/CommandItemSlot;
    • 方法详细资料

      • of

        static CommandItemSlot of​(Inventory inventory,
                                  int index,
                                  Predicate<ItemStack> stackFilter)
        Creates a slot backed by an index within an inventory and guarded by a condition for setting stacks into the inventory.
        参数:
        stackFilter - the condition to guard stack setting
        Mappings:
        Namespace Name Mixin selector
        official a Lato;a(Laqz;ILjava/util/function/Predicate;)Lato;
        intermediary method_32329 Lnet/minecraft/class_5630;method_32329(Lnet/minecraft/class_1263;ILjava/util/function/Predicate;)Lnet/minecraft/class_5630;
        named of Lnet/minecraft/inventory/CommandItemSlot;of(Lnet/minecraft/inventory/Inventory;ILjava/util/function/Predicate;)Lnet/minecraft/inventory/CommandItemSlot;
      • of

        static CommandItemSlot of​(Inventory inventory,
                                  int index)
        Creates a slot backed by an index within an inventory.
        Mappings:
        Namespace Name Mixin selector
        official a Lato;a(Laqz;I)Lato;
        intermediary method_32328 Lnet/minecraft/class_5630;method_32328(Lnet/minecraft/class_1263;I)Lnet/minecraft/class_5630;
        named of Lnet/minecraft/inventory/CommandItemSlot;of(Lnet/minecraft/inventory/Inventory;I)Lnet/minecraft/inventory/CommandItemSlot;
      • of

        static CommandItemSlot of​(LivingEntity entity,
                                  EquipmentSlot equipmentSlot,
                                  Predicate<ItemStack> stackFilter)
        Creates a slot backed by an equipment slot of an living entity and guarded by a condition for setting stacks into the inventory.
        参数:
        stackFilter - the condition to guard stack setting
        Mappings:
        Namespace Name Mixin selector
        official a Lato;a(Lasy;Lasq;Ljava/util/function/Predicate;)Lato;
        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;
        named of Lnet/minecraft/inventory/CommandItemSlot;of(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;Ljava/util/function/Predicate;)Lnet/minecraft/inventory/CommandItemSlot;
      • of

        static CommandItemSlot of​(LivingEntity entity,
                                  EquipmentSlot equipmentSlot)
        Creates a slot backed by an equipment slot of an living entity.
        Mappings:
        Namespace Name Mixin selector
        official a Lato;a(Lasy;Lasq;)Lato;
        intermediary method_32330 Lnet/minecraft/class_5630;method_32330(Lnet/minecraft/class_1309;Lnet/minecraft/class_1304;)Lnet/minecraft/class_5630;
        named of Lnet/minecraft/inventory/CommandItemSlot;of(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;)Lnet/minecraft/inventory/CommandItemSlot;
      • get

        ItemStack get()
        Gets the current item stack in this slot.
        Mappings:
        Namespace Name Mixin selector
        official a Lato;a()Lbpr;
        intermediary method_32327 Lnet/minecraft/class_5630;method_32327()Lnet/minecraft/class_1799;
        named get Lnet/minecraft/inventory/CommandItemSlot;get()Lnet/minecraft/item/ItemStack;
      • set

        boolean set​(ItemStack stack)
        Sets the stack to this slot.
        参数:
        stack - the item stack to set
        返回:
        true if the setting is successful, false if rejected
        Mappings:
        Namespace Name Mixin selector
        official a Lato;a(Lbpr;)Z
        intermediary method_32332 Lnet/minecraft/class_5630;method_32332(Lnet/minecraft/class_1799;)Z
        named set Lnet/minecraft/inventory/CommandItemSlot;set(Lnet/minecraft/item/ItemStack;)Z