Class StonecutterMenu

java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
net.minecraft.world.inventory.StonecutterMenu

public class StonecutterMenu extends AbstractContainerMenu
  • Field Details

    • INPUT_SLOT

      public static final int INPUT_SLOT
      See Also:
    • RESULT_SLOT

      public static final int RESULT_SLOT
      See Also:
    • INV_SLOT_START

      private static final int INV_SLOT_START
      See Also:
    • INV_SLOT_END

      private static final int INV_SLOT_END
      See Also:
    • USE_ROW_SLOT_START

      private static final int USE_ROW_SLOT_START
      See Also:
    • USE_ROW_SLOT_END

      private static final int USE_ROW_SLOT_END
      See Also:
    • access

      private final ContainerLevelAccess access
    • selectedRecipeIndex

      private final DataSlot selectedRecipeIndex
      The index of the selected recipe in the GUI.
    • level

      private final Level level
    • recipes

      private List<RecipeHolder<StonecutterRecipe>> recipes
    • input

      private ItemStack input
      The ItemStack set in the input slot by the player.
    • lastSoundTime

      long lastSoundTime
      Stores the game time of the last time the player took items from the the crafting result slot. This is used to prevent the sound from being played multiple times on the same tick.
    • inputSlot

      final Slot inputSlot
    • resultSlot

      final Slot resultSlot
      The inventory slot that stores the output of the crafting recipe.
    • slotUpdateListener

      Runnable slotUpdateListener
    • container

      public final Container container
    • resultContainer

      final ResultContainer resultContainer
      The inventory that stores the output of the crafting recipe.
  • Constructor Details

    • StonecutterMenu

      public StonecutterMenu(int pContainerId, Inventory pPlayerInventory)
    • StonecutterMenu

      public StonecutterMenu(int pContainerId, Inventory pPlayerInventory, ContainerLevelAccess pAccess)
  • Method Details

    • getSelectedRecipeIndex

      public int getSelectedRecipeIndex()
    • getRecipes

      public List<RecipeHolder<StonecutterRecipe>> getRecipes()
    • getNumRecipes

      public int getNumRecipes()
    • hasInputItem

      public boolean hasInputItem()
    • stillValid

      public boolean stillValid(Player pPlayer)
      Determines whether supplied player can use this container
      Specified by:
      stillValid in class AbstractContainerMenu
    • clickMenuButton

      public boolean clickMenuButton(Player pPlayer, int pId)
      Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy.
      Overrides:
      clickMenuButton in class AbstractContainerMenu
    • isValidRecipeIndex

      private boolean isValidRecipeIndex(int pRecipeIndex)
    • slotsChanged

      public void slotsChanged(Container pInventory)
      Callback for when the crafting matrix is changed.
      Overrides:
      slotsChanged in class AbstractContainerMenu
    • createRecipeInput

      private static SingleRecipeInput createRecipeInput(Container pContainer)
    • setupRecipeList

      private void setupRecipeList(Container pContainer, ItemStack pStack)
    • setupResultSlot

      void setupResultSlot()
    • getType

      public MenuType<?> getType()
      Overrides:
      getType in class AbstractContainerMenu
    • registerUpdateListener

      public void registerUpdateListener(Runnable pListener)
    • canTakeItemForPickAll

      public boolean canTakeItemForPickAll(ItemStack pStack, Slot pSlot)
      Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in is null for the initial slot that was double-clicked.
      Overrides:
      canTakeItemForPickAll in class AbstractContainerMenu
    • quickMoveStack

      public ItemStack quickMoveStack(Player pPlayer, int pIndex)
      Handle when the stack in slot index is shift-clicked. Normally this moves the stack between the player inventory and the other inventory(s).
      Specified by:
      quickMoveStack in class AbstractContainerMenu
    • removed

      public void removed(Player pPlayer)
      Called when the container is closed.
      Overrides:
      removed in class AbstractContainerMenu