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>
inventory
private Merchant
merchant
private int
merchantRewardedExperience
private int
recipeIndex
private TradeOffer
tradeOffer
-
Constructor Summary
Constructors Constructor Description MerchantInventory(Merchant merchant)
-
Method Summary
Modifier and Type Method Description boolean
canPlayerUse(PlayerEntity player)
void
clear()
int
getMerchantRewardedExperience()
ItemStack
getStack(int slot)
Fetches the stack currently stored at the given slot.TradeOffer
getTradeOffer()
boolean
isEmpty()
void
markDirty()
private boolean
needRecipeUpdate(int slot)
ItemStack
removeStack(int slot)
Removes the stack currently stored at the indicated slot.ItemStack
removeStack(int slot, int amount)
Removes a specific number of items from the given slot.void
setRecipeIndex(int index)
void
setStack(int slot, ItemStack stack)
int
size()
void
updateRecipes()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
removeStack
in 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:
removeStack
in interfaceInventory
- Returns:
- the stack previously stored at the indicated slot.
-
setStack
-
canPlayerUse
- Specified by:
canPlayerUse
in 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()
-