Class MerchantMenu
java.lang.Object
net.minecraft.world.inventory.AbstractContainerMenu
net.minecraft.world.inventory.MerchantMenu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate booleanprivate static final intprivate static final intprivate intprotected static final intprotected static final intprotected static final intprivate static final intprivate static final intprivate static final intprivate booleanprivate final MerchantContainerprivate final Merchantprivate static final intprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionMerchantMenu(int containerId, Inventory inventory) MerchantMenu(int containerId, Inventory inventory, Merchant merchant) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancanTakeItemForPickAll(ItemStack carried, Slot target) Called to determine if the current slot is valid for the stack merging (double-click) code.intintintprivate voidmoveFromInventoryToPaymentSlot(int paymentSlot, ItemCost cost) private voidquickMoveStack(Player player, int slotIndex) Handle when the stack in slotindexis shift-clicked.voidCalled when the container is closed.voidsetCanRestock(boolean canRestock) voidsetMerchantLevel(int level) voidsetOffers(MerchantOffers offers) ClientPacketListeneruses this to set offers for the client side MerchantContainer.voidsetSelectionHint(int hint) voidsetShowProgressBar(boolean show) voidsetXp(int xp) booleanvoidslotsChanged(Container container) Callback for when the crafting matrix is changed.booleanstillValid(Player player) Determines whether supplied player can use this containervoidtryMoveItems(int newTradeIndex) Methods inherited from class AbstractContainerMenu
addDataSlot, addDataSlots, addInventoryExtendedSlots, addInventoryHotbarSlots, addSlot, addSlotListener, addStandardInventorySlots, broadcastChanges, broadcastFullState, canDragTo, canItemQuickReplace, checkContainerDataCount, checkContainerSize, clearContainer, clicked, clickMenuButton, findSlot, getCarried, getItems, getQuickcraftHeader, getQuickcraftMask, getQuickCraftPlaceCount, getQuickcraftType, getRedstoneSignalFromBlockEntity, getRedstoneSignalFromContainer, getSlot, getStateId, getType, incrementStateId, initializeContents, isValidQuickcraftType, isValidSlotIndex, moveItemStackTo, removeSlotListener, resetQuickCraft, resumeRemoteUpdates, sendAllDataToRemote, setCarried, setData, setItem, setRemoteCarried, setRemoteSlot, setRemoteSlotUnsafe, setSelectedBundleItemIndex, setSynchronizer, stillValid, suppressRemoteUpdates, transferState
-
Field Details
-
PAYMENT1_SLOT
protected static final int PAYMENT1_SLOT- See Also:
-
PAYMENT2_SLOT
protected static final int PAYMENT2_SLOT- See Also:
-
RESULT_SLOT
protected static final int RESULT_SLOT- See Also:
-
INV_SLOT_START
private static final int INV_SLOT_START- See Also:
-
INV_SLOT_END
private static final int INV_SLOT_END- See Also:
-
USE_ROW_SLOT_START
private static final int USE_ROW_SLOT_START- See Also:
-
USE_ROW_SLOT_END
private static final int USE_ROW_SLOT_END- See Also:
-
SELLSLOT1_X
private static final int SELLSLOT1_X- See Also:
-
SELLSLOT2_X
private static final int SELLSLOT2_X- See Also:
-
BUYSLOT_X
private static final int BUYSLOT_X- See Also:
-
ROW_Y
private static final int ROW_Y- See Also:
-
trader
-
tradeContainer
-
merchantLevel
private int merchantLevel -
showProgressBar
private boolean showProgressBar -
canRestock
private boolean canRestock
-
-
Constructor Details
-
MerchantMenu
-
MerchantMenu
-
-
Method Details
-
setShowProgressBar
public void setShowProgressBar(boolean show) -
slotsChanged
Callback for when the crafting matrix is changed.- Overrides:
slotsChangedin classAbstractContainerMenu
-
setSelectionHint
public void setSelectionHint(int hint) -
stillValid
Determines whether supplied player can use this container- Specified by:
stillValidin classAbstractContainerMenu
-
getTraderXp
public int getTraderXp() -
getFutureTraderXp
public int getFutureTraderXp() -
setXp
public void setXp(int xp) -
getTraderLevel
public int getTraderLevel() -
setMerchantLevel
public void setMerchantLevel(int level) -
setCanRestock
public void setCanRestock(boolean canRestock) -
canRestock
public boolean canRestock() -
canTakeItemForPickAll
Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in is null for the initial slot that was double-clicked.- Overrides:
canTakeItemForPickAllin classAbstractContainerMenu
-
quickMoveStack
Handle when the stack in slotindexis shift-clicked. Normally this moves the stack between the player inventory and the other inventory(s).- Specified by:
quickMoveStackin classAbstractContainerMenu
-
playTradeSound
private void playTradeSound() -
removed
Called when the container is closed.- Overrides:
removedin classAbstractContainerMenu
-
tryMoveItems
public void tryMoveItems(int newTradeIndex) -
moveFromInventoryToPaymentSlot
-
setOffers
ClientPacketListeneruses this to set offers for the client side MerchantContainer. -
getOffers
-
showProgressBar
public boolean showProgressBar()
-