类 Slot

java.lang.Object
net.minecraft.world.inventory.Slot
直接已知子类:
BeaconMenu.PaymentSlot, BrewingStandMenu.FuelSlot, BrewingStandMenu.IngredientsSlot, BrewingStandMenu.PotionSlot, CreativeModeInventoryScreen.CustomCreativeSlot, CreativeModeInventoryScreen.SlotWrapper, FurnaceFuelSlot, FurnaceResultSlot, MerchantResultSlot, ResultSlot, ShulkerBoxSlot, SlotItemHandler

public class Slot extends Object
  • 字段详细资料

    • 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
  • 构造器详细资料

    • Slot

      public Slot(Container pContainer, int pSlot, int pX, int pY)
  • 方法详细资料

    • onQuickCraft

      public void onQuickCraft(ItemStack pOldStack, ItemStack pNewStack)
    • onQuickCraft

      protected void onQuickCraft(ItemStack pStack, int pAmount)
    • onSwapCraft

      protected void onSwapCraft(int pNumItemsCrafted)
    • checkTakeAchievements

      protected void checkTakeAchievements(ItemStack pStack)
    • onTake

      public void onTake(Player pPlayer, ItemStack pStack)
    • mayPlace

      public boolean mayPlace(ItemStack pStack)
    • getItem

      public ItemStack getItem()
    • hasItem

      public boolean hasItem()
    • setByPlayer

      public void setByPlayer(ItemStack pStack)
    • set

      public void set(ItemStack pStack)
    • setChanged

      public void setChanged()
    • getMaxStackSize

      public int getMaxStackSize()
    • getMaxStackSize

      public int getMaxStackSize(ItemStack pStack)
    • getNoItemIcon

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

      public ItemStack remove(int pAmount)
    • mayPickup

      public boolean mayPickup(Player pPlayer)
    • 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.
    • tryRemove

      public Optional<ItemStack> tryRemove(int pCount, int pDecrement, Player pPlayer)
    • safeTake

      public ItemStack safeTake(int pCount, int pDecrement, Player pPlayer)
    • safeInsert

      public ItemStack safeInsert(ItemStack pStack)
    • safeInsert

      public ItemStack safeInsert(ItemStack pStack, int pIncrement)
    • allowModification

      public boolean allowModification(Player pPlayer)
    • getContainerSlot

      public int getContainerSlot()
    • isHighlightable

      public boolean isHighlightable()