Class Slot

java.lang.Object
net.minecraft.screen.slot.Slot
Direct Known Subclasses:
BeaconScreenHandler.PaymentSlot, BrewingStandScreenHandler.FuelSlot, BrewingStandScreenHandler.IngredientSlot, BrewingStandScreenHandler.PotionSlot, CraftingResultSlot, CreativeInventoryScreen.CreativeSlot, CreativeInventoryScreen.LockableSlot, FurnaceFuelSlot, FurnaceOutputSlot, ShulkerBoxSlot, TradeOutputSlot

public class Slot extends Object
A slot of a screen handler that holds an item stack. A slot is temporary holder that holds the stack for the lifetime of the screen handler. They are backed by an inventory, which implements the persistent storage if necessary.

To add slots, call ScreenHandler.addSlot(net.minecraft.screen.slot.Slot) inside the screen handler's constructor.

Mappings:
Namespace Name
official cax
intermediary net/minecraft/class_1735
named net/minecraft/screen/slot/Slot
  • Field Details

    • index

      private final int index
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a:I
      intermediary field_7875 Lnet/minecraft/class_1735;field_7875:I
      named index Lnet/minecraft/screen/slot/Slot;index:I
    • inventory

      public final Inventory inventory
      Mappings:
      Namespace Name Mixin selector
      official d Lcax;d:Lbcf;
      intermediary field_7871 Lnet/minecraft/class_1735;field_7871:Lnet/minecraft/class_1263;
      named inventory Lnet/minecraft/screen/slot/Slot;inventory:Lnet/minecraft/inventory/Inventory;
    • id

      public int id
      Mappings:
      Namespace Name Mixin selector
      official e Lcax;e:I
      intermediary field_7874 Lnet/minecraft/class_1735;field_7874:I
      named id Lnet/minecraft/screen/slot/Slot;id:I
    • x

      public final int x
      Mappings:
      Namespace Name Mixin selector
      official f Lcax;f:I
      intermediary field_7873 Lnet/minecraft/class_1735;field_7873:I
      named x Lnet/minecraft/screen/slot/Slot;x:I
    • y

      public final int y
      Mappings:
      Namespace Name Mixin selector
      official g Lcax;g:I
      intermediary field_7872 Lnet/minecraft/class_1735;field_7872:I
      named y Lnet/minecraft/screen/slot/Slot;y:I
  • Constructor Details

    • Slot

      public Slot(Inventory inventory, int index, int x, int y)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcax;<init>(Lbcf;III)V
      intermediary <init> Lnet/minecraft/class_1735;<init>(Lnet/minecraft/class_1263;III)V
      named <init> Lnet/minecraft/screen/slot/Slot;<init>(Lnet/minecraft/inventory/Inventory;III)V
  • Method Details

    • onQuickTransfer

      public void onQuickTransfer(ItemStack newItem, ItemStack original)
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a(Lcdt;Lcdt;)V
      intermediary method_7670 Lnet/minecraft/class_1735;method_7670(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)V
      named onQuickTransfer Lnet/minecraft/screen/slot/Slot;onQuickTransfer(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)V
    • onCrafted

      protected void onCrafted(ItemStack stack, int amount)
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a(Lcdt;I)V
      intermediary method_7678 Lnet/minecraft/class_1735;method_7678(Lnet/minecraft/class_1799;I)V
      named onCrafted Lnet/minecraft/screen/slot/Slot;onCrafted(Lnet/minecraft/item/ItemStack;I)V
    • onTake

      protected void onTake(int amount)
      Mappings:
      Namespace Name Mixin selector
      official b Lcax;b(I)V
      intermediary method_7672 Lnet/minecraft/class_1735;method_7672(I)V
      named onTake Lnet/minecraft/screen/slot/Slot;onTake(I)V
    • onCrafted

      protected void onCrafted(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official b_ Lcax;b_(Lcdt;)V
      intermediary method_7669 Lnet/minecraft/class_1735;method_7669(Lnet/minecraft/class_1799;)V
      named onCrafted Lnet/minecraft/screen/slot/Slot;onCrafted(Lnet/minecraft/item/ItemStack;)V
    • onTakeItem

      public void onTakeItem(PlayerEntity player, ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a(Lbwp;Lcdt;)V
      intermediary method_7667 Lnet/minecraft/class_1735;method_7667(Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;)V
      named onTakeItem Lnet/minecraft/screen/slot/Slot;onTakeItem(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)V
    • canInsert

      public boolean canInsert(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a(Lcdt;)Z
      intermediary method_7680 Lnet/minecraft/class_1735;method_7680(Lnet/minecraft/class_1799;)Z
      named canInsert Lnet/minecraft/screen/slot/Slot;canInsert(Lnet/minecraft/item/ItemStack;)Z
    • getStack

      public ItemStack getStack()
      Mappings:
      Namespace Name Mixin selector
      official e Lcax;e()Lcdt;
      intermediary method_7677 Lnet/minecraft/class_1735;method_7677()Lnet/minecraft/class_1799;
      named getStack Lnet/minecraft/screen/slot/Slot;getStack()Lnet/minecraft/item/ItemStack;
    • hasStack

      public boolean hasStack()
      Mappings:
      Namespace Name Mixin selector
      official f Lcax;f()Z
      intermediary method_7681 Lnet/minecraft/class_1735;method_7681()Z
      named hasStack Lnet/minecraft/screen/slot/Slot;hasStack()Z
    • setStack

      public void setStack(ItemStack stack)
      Sets the slot's stack to stack and marks the slot as dirty. Subclasses may override this method to perform additional operations.
      Mappings:
      Namespace Name Mixin selector
      official d Lcax;d(Lcdt;)V
      intermediary method_7673 Lnet/minecraft/class_1735;method_7673(Lnet/minecraft/class_1799;)V
      named setStack Lnet/minecraft/screen/slot/Slot;setStack(Lnet/minecraft/item/ItemStack;)V
    • setStackNoCallbacks

      public void setStackNoCallbacks(ItemStack stack)
      Sets the slot's stack to stack and marks the slot as dirty. Unlike setStack(net.minecraft.item.ItemStack) subclasses may not override this method to perform additional operations.
      Mappings:
      Namespace Name Mixin selector
      official e Lcax;e(Lcdt;)V
      intermediary method_44206 Lnet/minecraft/class_1735;method_44206(Lnet/minecraft/class_1799;)V
      named setStackNoCallbacks Lnet/minecraft/screen/slot/Slot;setStackNoCallbacks(Lnet/minecraft/item/ItemStack;)V
    • markDirty

      public void markDirty()
      Mappings:
      Namespace Name Mixin selector
      official d Lcax;d()V
      intermediary method_7668 Lnet/minecraft/class_1735;method_7668()V
      named markDirty Lnet/minecraft/screen/slot/Slot;markDirty()V
    • getMaxItemCount

      public int getMaxItemCount()
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a()I
      intermediary method_7675 Lnet/minecraft/class_1735;method_7675()I
      named getMaxItemCount Lnet/minecraft/screen/slot/Slot;getMaxItemCount()I
    • getMaxItemCount

      public int getMaxItemCount(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official a_ Lcax;a_(Lcdt;)I
      intermediary method_7676 Lnet/minecraft/class_1735;method_7676(Lnet/minecraft/class_1799;)I
      named getMaxItemCount Lnet/minecraft/screen/slot/Slot;getMaxItemCount(Lnet/minecraft/item/ItemStack;)I
    • getBackgroundSprite

      @Nullable public @Nullable com.mojang.datafixers.util.Pair<Identifier,Identifier> getBackgroundSprite()
      Mappings:
      Namespace Name Mixin selector
      official c Lcax;c()Lcom/mojang/datafixers/util/Pair;
      intermediary method_7679 Lnet/minecraft/class_1735;method_7679()Lcom/mojang/datafixers/util/Pair;
      named getBackgroundSprite Lnet/minecraft/screen/slot/Slot;getBackgroundSprite()Lcom/mojang/datafixers/util/Pair;
    • takeStack

      public ItemStack takeStack(int amount)
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a(I)Lcdt;
      intermediary method_7671 Lnet/minecraft/class_1735;method_7671(I)Lnet/minecraft/class_1799;
      named takeStack Lnet/minecraft/screen/slot/Slot;takeStack(I)Lnet/minecraft/item/ItemStack;
    • canTakeItems

      public boolean canTakeItems(PlayerEntity playerEntity)
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a(Lbwp;)Z
      intermediary method_7674 Lnet/minecraft/class_1735;method_7674(Lnet/minecraft/class_1657;)Z
      named canTakeItems Lnet/minecraft/screen/slot/Slot;canTakeItems(Lnet/minecraft/entity/player/PlayerEntity;)Z
    • isEnabled

      public boolean isEnabled()
      Mappings:
      Namespace Name Mixin selector
      official b Lcax;b()Z
      intermediary method_7682 Lnet/minecraft/class_1735;method_7682()Z
      named isEnabled Lnet/minecraft/screen/slot/Slot;isEnabled()Z
    • tryTakeStackRange

      public Optional<ItemStack> tryTakeStackRange(int min, int max, PlayerEntity player)
      Mappings:
      Namespace Name Mixin selector
      official a Lcax;a(IILbwp;)Ljava/util/Optional;
      intermediary method_34264 Lnet/minecraft/class_1735;method_34264(IILnet/minecraft/class_1657;)Ljava/util/Optional;
      named tryTakeStackRange Lnet/minecraft/screen/slot/Slot;tryTakeStackRange(IILnet/minecraft/entity/player/PlayerEntity;)Ljava/util/Optional;
    • takeStackRange

      public ItemStack takeStackRange(int min, int max, PlayerEntity player)
      Mappings:
      Namespace Name Mixin selector
      official b Lcax;b(IILbwp;)Lcdt;
      intermediary method_32753 Lnet/minecraft/class_1735;method_32753(IILnet/minecraft/class_1657;)Lnet/minecraft/class_1799;
      named takeStackRange Lnet/minecraft/screen/slot/Slot;takeStackRange(IILnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
    • insertStack

      public ItemStack insertStack(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official f Lcax;f(Lcdt;)Lcdt;
      intermediary method_32756 Lnet/minecraft/class_1735;method_32756(Lnet/minecraft/class_1799;)Lnet/minecraft/class_1799;
      named insertStack Lnet/minecraft/screen/slot/Slot;insertStack(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;
    • insertStack

      public ItemStack insertStack(ItemStack stack, int count)
      Mappings:
      Namespace Name Mixin selector
      official b Lcax;b(Lcdt;I)Lcdt;
      intermediary method_32755 Lnet/minecraft/class_1735;method_32755(Lnet/minecraft/class_1799;I)Lnet/minecraft/class_1799;
      named insertStack Lnet/minecraft/screen/slot/Slot;insertStack(Lnet/minecraft/item/ItemStack;I)Lnet/minecraft/item/ItemStack;
    • canTakePartial

      public boolean canTakePartial(PlayerEntity player)
      Mappings:
      Namespace Name Mixin selector
      official b Lcax;b(Lbwp;)Z
      intermediary method_32754 Lnet/minecraft/class_1735;method_32754(Lnet/minecraft/class_1657;)Z
      named canTakePartial Lnet/minecraft/screen/slot/Slot;canTakePartial(Lnet/minecraft/entity/player/PlayerEntity;)Z
    • getIndex

      public int getIndex()
      Mappings:
      Namespace Name Mixin selector
      official g Lcax;g()I
      intermediary method_34266 Lnet/minecraft/class_1735;method_34266()I
      named getIndex Lnet/minecraft/screen/slot/Slot;getIndex()I