Class MerchantInventory

java.lang.Object
net.minecraft.village.MerchantInventory
All Implemented Interfaces:
Inventory, Clearable

public class MerchantInventory
extends Object
implements Inventory
  • Field Details

    • merchant

      private final Merchant merchant
    • inventory

      private final DefaultedList<ItemStack> inventory
    • tradeOffer

      @Nullable private TradeOffer tradeOffer
    • recipeIndex

      private int recipeIndex
    • merchantRewardedExperience

      private int merchantRewardedExperience
  • Constructor Details

    • MerchantInventory

      public MerchantInventory​(Merchant merchant)
  • Method Details

    • size

      public int size()
      Specified by:
      size in interface Inventory
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Inventory
    • getStack

      public ItemStack getStack​(int slot)
      Fetches the stack currently stored at the given slot. If the slot is empty, or is outside the bounds of this inventory, returns see ItemStack.EMPTY.
      Specified by:
      getStack in interface Inventory
    • removeStack

      public ItemStack removeStack​(int slot, int amount)
      Removes a specific number of items from the given slot.
      Specified by:
      removeStack in interface Inventory
      Returns:
      the removed items as a stack
    • needRecipeUpdate

      private boolean needRecipeUpdate​(int slot)
    • removeStack

      public ItemStack removeStack​(int slot)
      Removes the stack currently stored at the indicated slot.
      Specified by:
      removeStack in interface Inventory
      Returns:
      the stack previously stored at the indicated slot.
    • setStack

      public void setStack​(int slot, ItemStack stack)
      Specified by:
      setStack in interface Inventory
    • canPlayerUse

      public boolean canPlayerUse​(PlayerEntity player)
      Specified by:
      canPlayerUse in interface Inventory
    • markDirty

      public void markDirty()
      Specified by:
      markDirty in interface Inventory
    • updateRecipes

      public void updateRecipes()
    • getTradeOffer

      @Nullable public TradeOffer getTradeOffer()
    • setRecipeIndex

      public void setRecipeIndex​(int index)
    • clear

      public void clear()
      Specified by:
      clear in interface Clearable
    • getMerchantRewardedExperience

      @Environment(CLIENT) public int getMerchantRewardedExperience()