Package net.minecraft.village
Class MerchantInventory
java.lang.Object
net.minecraft.village.MerchantInventory
public class MerchantInventory extends Object implements Inventory
-
Field Summary
Fields Modifier and Type Field Description private DefaultedList<ItemStack>inventoryprivate Merchantmerchantprivate intmerchantRewardedExperienceprivate intrecipeIndexprivate TradeOffertradeOffer -
Constructor Summary
Constructors Constructor Description MerchantInventory(Merchant merchant) -
Method Summary
Modifier and Type Method Description booleancanPlayerUse(PlayerEntity player)voidclear()intgetMerchantRewardedExperience()ItemStackgetStack(int slot)Fetches the stack currently stored at the given slot.TradeOffergetTradeOffer()booleanisEmpty()voidmarkDirty()private booleanneedRecipeUpdate(int slot)ItemStackremoveStack(int slot)Removes the stack currently stored at the indicated slot.ItemStackremoveStack(int slot, int amount)Removes a specific number of items from the given slot.voidsetRecipeIndex(int index)voidsetStack(int slot, ItemStack stack)intsize()voidupdateRecipes()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.inventory.Inventory
containsAny, count, getMaxCountPerStack, isValid, onClose, onOpen
-
Field Details
-
merchant
-
inventory
-
tradeOffer
-
recipeIndex
private int recipeIndex -
merchantRewardedExperience
private int merchantRewardedExperience
-
-
Constructor Details
-
MerchantInventory
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
getStack
Fetches the stack currently stored at the given slot. If the slot is empty, or is outside the bounds of this inventory, returns seeItemStack.EMPTY. -
removeStack
Removes a specific number of items from the given slot.- Specified by:
removeStackin interfaceInventory- Returns:
- the removed items as a stack
-
needRecipeUpdate
private boolean needRecipeUpdate(int slot) -
removeStack
Removes the stack currently stored at the indicated slot.- Specified by:
removeStackin interfaceInventory- Returns:
- the stack previously stored at the indicated slot.
-
setStack
-
canPlayerUse
- Specified by:
canPlayerUsein interfaceInventory
-
markDirty
public void markDirty() -
updateRecipes
public void updateRecipes() -
getTradeOffer
-
setRecipeIndex
public void setRecipeIndex(int index) -
clear
public void clear() -
getMerchantRewardedExperience
@Environment(CLIENT) public int getMerchantRewardedExperience()
-