Class MerchantContainer

java.lang.Object
net.minecraft.world.inventory.MerchantContainer
All Implemented Interfaces:
Iterable<ItemStack>, Clearable, Container

public class MerchantContainer extends Object implements Container
  • Field Details

    • merchant

      private final Merchant merchant
    • itemStacks

      private final NonNullList<ItemStack> itemStacks
    • activeOffer

      @Nullable private MerchantOffer activeOffer
    • selectionHint

      private int selectionHint
    • futureXp

      private int futureXp
  • Constructor Details

    • MerchantContainer

      public MerchantContainer(Merchant pMerchant)
  • Method Details

    • getContainerSize

      public int getContainerSize()
      Specified by:
      getContainerSize in interface Container
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Container
    • getItem

      public ItemStack getItem(int pIndex)
      Returns the stack in the given slot.
      Specified by:
      getItem in interface Container
    • removeItem

      public ItemStack removeItem(int pIndex, int pCount)
      Removes up to a specified number of items from an inventory slot and returns them in a new stack.
      Specified by:
      removeItem in interface Container
    • isPaymentSlot

      private boolean isPaymentSlot(int pSlot)
      if par1 slot has changed, does resetRecipeAndSlots need to be called?
    • removeItemNoUpdate

      public ItemStack removeItemNoUpdate(int pIndex)
      Removes a stack from the given slot and returns it.
      Specified by:
      removeItemNoUpdate in interface Container
    • setItem

      public void setItem(int pIndex, ItemStack pStack)
      Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
      Specified by:
      setItem in interface Container
    • stillValid

      public boolean stillValid(Player pPlayer)
      Don't rename this method to canInteractWith due to conflicts with Container
      Specified by:
      stillValid in interface Container
    • setChanged

      public void setChanged()
      Specified by:
      setChanged in interface Container
    • updateSellItem

      public void updateSellItem()
    • getActiveOffer

      @Nullable public MerchantOffer getActiveOffer()
    • setSelectionHint

      public void setSelectionHint(int pCurrentRecipeIndex)
    • clearContent

      public void clearContent()
      Specified by:
      clearContent in interface Clearable
    • getFutureXp

      public int getFutureXp()