Class Slot

Direct Known Subclasses:
BeaconContainer.BeaconSlot, BrewingStandContainer.FuelSlot, BrewingStandContainer.IngredientSlot, BrewingStandContainer.PotionSlot, CraftingResultSlot, CreativeScreen.CreativeSlot, CreativeScreen.LockedSlot, FurnaceFuelSlot, FurnaceResultSlot, MerchantResultSlot, ShulkerBoxSlot, SlotItemHandler

public class Slot extends Object
  • Field Details

    • slot

      private final int slot
    • container

      public final IInventory 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(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_)
  • Method Details

    • onQuickCraft

      public void onQuickCraft(ItemStack p_75220_1_, ItemStack p_75220_2_)
    • onQuickCraft

      protected void onQuickCraft(ItemStack p_75210_1_, int p_75210_2_)
    • onSwapCraft

      protected void onSwapCraft(int p_190900_1_)
    • checkTakeAchievements

      protected void checkTakeAchievements(ItemStack p_75208_1_)
    • onTake

      public ItemStack onTake(PlayerEntity p_190901_1_, ItemStack p_190901_2_)
    • mayPlace

      public boolean mayPlace(ItemStack p_75214_1_)
    • getItem

      public ItemStack getItem()
    • hasItem

      public boolean hasItem()
    • set

      public void set(ItemStack p_75215_1_)
    • setChanged

      public void setChanged()
    • getMaxStackSize

      public int getMaxStackSize()
    • getMaxStackSize

      public int getMaxStackSize(ItemStack p_178170_1_)
    • getNoItemIcon

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

      public ItemStack remove(int p_75209_1_)
    • mayPickup

      public boolean mayPickup(PlayerEntity p_82869_1_)
    • 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.
      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.
      other -
      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.
      atlas - The atlas name
      sprite - The sprite located on that atlas.
      this, to allow chaining.