Class MerchantMenu

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

public class MerchantMenu extends AbstractContainerMenu
  • Field Details

  • Constructor Details

    • MerchantMenu

      public MerchantMenu(int pContainerId, Inventory pPlayerInventory)
    • MerchantMenu

      public MerchantMenu(int pContainerId, Inventory pPlayerInventory, Merchant pTrader)
  • Method Details

    • setShowProgressBar

      public void setShowProgressBar(boolean pShowProgressBar)
    • slotsChanged

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

      public void setSelectionHint(int pCurrentRecipeIndex)
    • stillValid

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

      public int getTraderXp()
    • getFutureTraderXp

      public int getFutureTraderXp()
    • setXp

      public void setXp(int pXp)
    • getTraderLevel

      public int getTraderLevel()
    • setMerchantLevel

      public void setMerchantLevel(int pLevel)
    • setCanRestock

      public void setCanRestock(boolean pCanRestock)
    • canRestock

      public boolean canRestock()
    • 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
    • playTradeSound

      private void playTradeSound()
    • removed

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

      public void tryMoveItems(int pSelectedMerchantRecipe)
    • moveFromInventoryToPaymentSlot

      private void moveFromInventoryToPaymentSlot(int pPaymentSlotIndex, ItemCost pPayment)
    • setOffers

      public void setOffers(MerchantOffers pOffers)
      ClientPacketListener uses this to set offers for the client side MerchantContainer.
    • getOffers

      public MerchantOffers getOffers()
    • showProgressBar

      public boolean showProgressBar()