Package net.minecraft.village
Class TraderInventory
java.lang.Object
net.minecraft.village.TraderInventory
public class TraderInventory extends Object implements Inventory
-
Field Summary
Fields Modifier and Type Field Description private DefaultedList<ItemStack>inventoryprivate intrecipeIndexprivate Tradertraderprivate TradeOffertraderRecipeprivate inttraderRewardedExperience -
Constructor Summary
Constructors Constructor Description TraderInventory(Trader trader) -
Method Summary
Modifier and Type Method Description booleancanPlayerUse(PlayerEntity player)voidclear()ItemStackgetStack(int slot)Fetches the stack currently stored at the given slot.TradeOffergetTradeOffer()intgetTraderRewardedExperience()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
-
trader
-
inventory
-
traderRecipe
-
recipeIndex
private int recipeIndex -
traderRewardedExperience
private int traderRewardedExperience
-
-
Constructor Details
-
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() -
getTraderRewardedExperience
@Environment(CLIENT) public int getTraderRewardedExperience()
-