Class Slot

java.lang.Object
net.minecraft.world.inventory.Slot
Direct Known Subclasses:
BeaconMenu.PaymentSlot, BrewingStandMenu.FuelSlot, BrewingStandMenu.IngredientsSlot, BrewingStandMenu.PotionSlot, CrafterSlot, CreativeModeInventoryScreen.CustomCreativeSlot, CreativeModeInventoryScreen.SlotWrapper, FurnaceFuelSlot, FurnaceResultSlot, MerchantResultSlot, NonInteractiveResultSlot, ResultSlot, ShulkerBoxSlot, SlotItemHandler

public class Slot extends Object
  • Field Details

    • slot

      private final int slot
    • container

      public final Container container
    • index

      public int index
    • x

      public final int x
    • y

      public final int y
    • backgroundPair

      private com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> backgroundPair
  • Constructor Details

    • Slot

      public Slot(Container p_40223_, int p_40224_, int p_40225_, int p_40226_)
  • Method Details

    • onQuickCraft

      public void onQuickCraft(ItemStack p_40235_, ItemStack p_40236_)
    • onQuickCraft

      protected void onQuickCraft(ItemStack p_40232_, int p_40233_)
    • onSwapCraft

      protected void onSwapCraft(int p_40237_)
    • checkTakeAchievements

      protected void checkTakeAchievements(ItemStack p_40239_)
    • onTake

      public void onTake(Player p_150645_, ItemStack p_150646_)
    • mayPlace

      public boolean mayPlace(ItemStack p_40231_)
    • getItem

      public ItemStack getItem()
    • hasItem

      public boolean hasItem()
    • setByPlayer

      public void setByPlayer(ItemStack p_270152_)
    • setByPlayer

      public void setByPlayer(ItemStack p_299954_, ItemStack p_301385_)
    • set

      public void set(ItemStack p_40240_)
    • setChanged

      public void setChanged()
    • getMaxStackSize

      public int getMaxStackSize()
    • getMaxStackSize

      public int getMaxStackSize(ItemStack p_40238_)
    • getNoItemIcon

      @Nullable public com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> getNoItemIcon()
    • remove

      public ItemStack remove(int p_40227_)
    • mayPickup

      public boolean mayPickup(Player p_40228_)
    • isActive

      public boolean isActive()
    • getSlotIndex

      public int getSlotIndex()
      Retrieves the index in the inventory for this slot, this value should typically not be used, but can be useful for some occasions.
      Returns:
      Index in associated inventory for this slot.
    • isSameInventory

      public boolean isSameInventory(Slot other)
      Checks if the other slot is in the same inventory, by comparing the inventory reference.
      Parameters:
      other -
      Returns:
      true if the other slot is in the same inventory
    • setBackground

      public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite)
      Sets the background atlas and sprite location.
      Parameters:
      atlas - The atlas name
      sprite - The sprite located on that atlas.
      Returns:
      this, to allow chaining.
    • tryRemove

      public Optional<ItemStack> tryRemove(int p_150642_, int p_150643_, Player p_150644_)
    • safeTake

      public ItemStack safeTake(int p_150648_, int p_150649_, Player p_150650_)
    • safeInsert

      public ItemStack safeInsert(ItemStack p_150660_)
    • safeInsert

      public ItemStack safeInsert(ItemStack p_150657_, int p_150658_)
    • allowModification

      public boolean allowModification(Player p_150652_)
    • getContainerSlot

      public int getContainerSlot()
    • isHighlightable

      public boolean isHighlightable()
    • isFake

      public boolean isFake()