Class MerchantScreenHandler

java.lang.Object
net.minecraft.screen.ScreenHandler
net.minecraft.screen.MerchantScreenHandler

public class MerchantScreenHandler extends ScreenHandler
Mappings:
Namespace Name
named net/minecraft/screen/MerchantScreenHandler
intermediary net/minecraft/class_1728
official cum
  • Field Details

    • INPUT_1_ID

      protected static final int INPUT_1_ID
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named INPUT_1_ID Lnet/minecraft/screen/MerchantScreenHandler;INPUT_1_ID:I
      intermediary field_30830 Lnet/minecraft/class_1728;field_30830:I
      official m Lcum;m:I
    • INPUT_2_ID

      protected static final int INPUT_2_ID
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named INPUT_2_ID Lnet/minecraft/screen/MerchantScreenHandler;INPUT_2_ID:I
      intermediary field_30831 Lnet/minecraft/class_1728;field_30831:I
      official n Lcum;n:I
    • OUTPUT_ID

      protected static final int OUTPUT_ID
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named OUTPUT_ID Lnet/minecraft/screen/MerchantScreenHandler;OUTPUT_ID:I
      intermediary field_30832 Lnet/minecraft/class_1728;field_30832:I
      official o Lcum;o:I
    • INVENTORY_START

      private static final int INVENTORY_START
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named INVENTORY_START Lnet/minecraft/screen/MerchantScreenHandler;INVENTORY_START:I
      intermediary field_30833 Lnet/minecraft/class_1728;field_30833:I
      official p Lcum;p:I
    • INVENTORY_END

      private static final int INVENTORY_END
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named INVENTORY_END Lnet/minecraft/screen/MerchantScreenHandler;INVENTORY_END:I
      intermediary field_30834 Lnet/minecraft/class_1728;field_30834:I
      official q Lcum;q:I
    • HOTBAR_START

      private static final int HOTBAR_START
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named HOTBAR_START Lnet/minecraft/screen/MerchantScreenHandler;HOTBAR_START:I
      intermediary field_30835 Lnet/minecraft/class_1728;field_30835:I
      official r Lcum;r:I
    • HOTBAR_END

      private static final int HOTBAR_END
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named HOTBAR_END Lnet/minecraft/screen/MerchantScreenHandler;HOTBAR_END:I
      intermediary field_30836 Lnet/minecraft/class_1728;field_30836:I
      official s Lcum;s:I
    • INPUT_1_X

      private static final int INPUT_1_X
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named INPUT_1_X Lnet/minecraft/screen/MerchantScreenHandler;INPUT_1_X:I
      intermediary field_30837 Lnet/minecraft/class_1728;field_30837:I
      official t Lcum;t:I
    • INPUT_2_X

      private static final int INPUT_2_X
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named INPUT_2_X Lnet/minecraft/screen/MerchantScreenHandler;INPUT_2_X:I
      intermediary field_30838 Lnet/minecraft/class_1728;field_30838:I
      official u Lcum;u:I
    • OUTPUT_X

      private static final int OUTPUT_X
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named OUTPUT_X Lnet/minecraft/screen/MerchantScreenHandler;OUTPUT_X:I
      intermediary field_30839 Lnet/minecraft/class_1728;field_30839:I
      official v Lcum;v:I
    • SLOT_Y

      private static final int SLOT_Y
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named SLOT_Y Lnet/minecraft/screen/MerchantScreenHandler;SLOT_Y:I
      intermediary field_30840 Lnet/minecraft/class_1728;field_30840:I
      official w Lcum;w:I
    • merchant

      private final Merchant merchant
      Mappings:
      Namespace Name Mixin selector
      named merchant Lnet/minecraft/screen/MerchantScreenHandler;merchant:Lnet/minecraft/village/Merchant;
      intermediary field_7863 Lnet/minecraft/class_1728;field_7863:Lnet/minecraft/class_1915;
      official x Lcum;x:Ldgd;
    • merchantInventory

      private final MerchantInventory merchantInventory
      Mappings:
      Namespace Name Mixin selector
      named merchantInventory Lnet/minecraft/screen/MerchantScreenHandler;merchantInventory:Lnet/minecraft/village/MerchantInventory;
      intermediary field_7861 Lnet/minecraft/class_1728;field_7861:Lnet/minecraft/class_1725;
      official y Lcum;y:Lcul;
    • levelProgress

      private int levelProgress
      Mappings:
      Namespace Name Mixin selector
      named levelProgress Lnet/minecraft/screen/MerchantScreenHandler;levelProgress:I
      intermediary field_18669 Lnet/minecraft/class_1728;field_18669:I
      official z Lcum;z:I
    • leveled

      private boolean leveled
      Mappings:
      Namespace Name Mixin selector
      named leveled Lnet/minecraft/screen/MerchantScreenHandler;leveled:Z
      intermediary field_18670 Lnet/minecraft/class_1728;field_18670:Z
      official A Lcum;A:Z
    • canRefreshTrades

      private boolean canRefreshTrades
      Mappings:
      Namespace Name Mixin selector
      named canRefreshTrades Lnet/minecraft/screen/MerchantScreenHandler;canRefreshTrades:Z
      intermediary field_19358 Lnet/minecraft/class_1728;field_19358:Z
      official B Lcum;B:Z
  • Constructor Details

    • MerchantScreenHandler

      public MerchantScreenHandler(int syncId, PlayerInventory playerInventory)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/screen/MerchantScreenHandler;<init>(ILnet/minecraft/entity/player/PlayerInventory;)V
      intermediary <init> Lnet/minecraft/class_1728;<init>(ILnet/minecraft/class_1661;)V
      official <init> Lcum;<init>(ILcpv;)V
    • MerchantScreenHandler

      public MerchantScreenHandler(int syncId, PlayerInventory playerInventory, Merchant merchant)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/screen/MerchantScreenHandler;<init>(ILnet/minecraft/entity/player/PlayerInventory;Lnet/minecraft/village/Merchant;)V
      intermediary <init> Lnet/minecraft/class_1728;<init>(ILnet/minecraft/class_1661;Lnet/minecraft/class_1915;)V
      official <init> Lcum;<init>(ILcpv;Ldgd;)V
  • Method Details

    • setLeveled

      public void setLeveled(boolean leveled)
      Mappings:
      Namespace Name Mixin selector
      named setLeveled Lnet/minecraft/screen/MerchantScreenHandler;setLeveled(Z)V
      intermediary method_19253 Lnet/minecraft/class_1728;method_19253(Z)V
      official a Lcum;a(Z)V
    • onContentChanged

      public void onContentChanged(Inventory inventory)
      Called when a slot's content has changed.

      This is not called by default; subclasses that override this method should also use a custom Inventory whose markDirty method is overridden to call this method as a backing inventory of the slot.

      This can be used to update the output slot when input changes.

      Overrides:
      onContentChanged in class ScreenHandler
      Mappings:
      Namespace Name Mixin selector
      named onContentChanged Lnet/minecraft/screen/ScreenHandler;onContentChanged(Lnet/minecraft/inventory/Inventory;)V
      intermediary method_7609 Lnet/minecraft/class_1703;method_7609(Lnet/minecraft/class_1263;)V
      official a Lctb;a(Lbtb;)V
    • setRecipeIndex

      public void setRecipeIndex(int index)
      Mappings:
      Namespace Name Mixin selector
      named setRecipeIndex Lnet/minecraft/screen/MerchantScreenHandler;setRecipeIndex(I)V
      intermediary method_7650 Lnet/minecraft/class_1728;method_7650(I)V
      official e Lcum;e(I)V
    • canUse

      public boolean canUse(PlayerEntity player)
      Returns whether the screen handler can be used.

      Subclasses should call #canUse(ScreenHandlerContext, PlayerEntity, Block)} or implement the check itself. The implementation should check that the player is near the screen handler's source position (e.g. block position) and that the source (e.g. block) is not destroyed.

      Specified by:
      canUse in class ScreenHandler
      Returns:
      whether the screen handler can be used
      Mappings:
      Namespace Name Mixin selector
      named canUse Lnet/minecraft/screen/ScreenHandler;canUse(Lnet/minecraft/entity/player/PlayerEntity;)Z
      intermediary method_7597 Lnet/minecraft/class_1703;method_7597(Lnet/minecraft/class_1657;)Z
      official b Lctb;b(Lcpw;)Z
    • getExperience

      public int getExperience()
      Mappings:
      Namespace Name Mixin selector
      named getExperience Lnet/minecraft/screen/MerchantScreenHandler;getExperience()I
      intermediary method_19254 Lnet/minecraft/class_1728;method_19254()I
      official l Lcum;l()I
    • getMerchantRewardedExperience

      public int getMerchantRewardedExperience()
      Mappings:
      Namespace Name Mixin selector
      named getMerchantRewardedExperience Lnet/minecraft/screen/MerchantScreenHandler;getMerchantRewardedExperience()I
      intermediary method_19256 Lnet/minecraft/class_1728;method_19256()I
      official m Lcum;m()I
    • setExperienceFromServer

      public void setExperienceFromServer(int experience)
      Mappings:
      Namespace Name Mixin selector
      named setExperienceFromServer Lnet/minecraft/screen/MerchantScreenHandler;setExperienceFromServer(I)V
      intermediary method_19255 Lnet/minecraft/class_1728;method_19255(I)V
      official f Lcum;f(I)V
    • getLevelProgress

      public int getLevelProgress()
      Mappings:
      Namespace Name Mixin selector
      named getLevelProgress Lnet/minecraft/screen/MerchantScreenHandler;getLevelProgress()I
      intermediary method_19258 Lnet/minecraft/class_1728;method_19258()I
      official n Lcum;n()I
    • setLevelProgress

      public void setLevelProgress(int levelProgress)
      Mappings:
      Namespace Name Mixin selector
      named setLevelProgress Lnet/minecraft/screen/MerchantScreenHandler;setLevelProgress(I)V
      intermediary method_19257 Lnet/minecraft/class_1728;method_19257(I)V
      official g Lcum;g(I)V
    • setCanRefreshTrades

      public void setCanRefreshTrades(boolean canRefreshTrades)
      Mappings:
      Namespace Name Mixin selector
      named setCanRefreshTrades Lnet/minecraft/screen/MerchantScreenHandler;setCanRefreshTrades(Z)V
      intermediary method_20700 Lnet/minecraft/class_1728;method_20700(Z)V
      official b Lcum;b(Z)V
    • canRefreshTrades

      public boolean canRefreshTrades()
      Mappings:
      Namespace Name Mixin selector
      named canRefreshTrades Lnet/minecraft/screen/MerchantScreenHandler;canRefreshTrades()Z
      intermediary method_20701 Lnet/minecraft/class_1728;method_20701()Z
      official o Lcum;o()Z
    • canInsertIntoSlot

      public boolean canInsertIntoSlot(ItemStack stack, Slot slot)
      Returns whether stack can be inserted to slot.

      Subclasses should override this to return false if the slot is used for output.

      Overrides:
      canInsertIntoSlot in class ScreenHandler
      Returns:
      whether stack can be inserted to slot
      Mappings:
      Namespace Name Mixin selector
      named canInsertIntoSlot Lnet/minecraft/screen/ScreenHandler;canInsertIntoSlot(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;)Z
      intermediary method_7613 Lnet/minecraft/class_1703;method_7613(Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;)Z
      official a Lctb;a(Lcxo;Lcuy;)Z
    • quickMove

      public ItemStack quickMove(PlayerEntity player, int slot)
      Quick-moves the stack at slot to other slots of the screen handler that belong to a different inventory or another section of the same inventory. For example, items can be quick-moved between a chest's slots and the player inventory or between the main player inventory and the hotbar.

      Subclasses should call ScreenHandler.insertItem(net.minecraft.item.ItemStack, int, int, boolean), and if the insertion was successful, clear the slot (if the stack is exhausted) or mark it as dirty. See the vanilla subclasses for basic implementation.

      Quick-moving is also known as "shift-clicking" since it's usually triggered using Shift+left click.

      Specified by:
      quickMove in class ScreenHandler
      Parameters:
      slot - the index of the slot to quick-move from
      Returns:
      ItemStack.EMPTY when no stack can be transferred, otherwise the original stack
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named quickMove Lnet/minecraft/screen/ScreenHandler;quickMove(Lnet/minecraft/entity/player/PlayerEntity;I)Lnet/minecraft/item/ItemStack;
      intermediary method_7601 Lnet/minecraft/class_1703;method_7601(Lnet/minecraft/class_1657;I)Lnet/minecraft/class_1799;
      official b Lctb;b(Lcpw;I)Lcxo;
    • playYesSound

      private void playYesSound()
      Mappings:
      Namespace Name Mixin selector
      named playYesSound Lnet/minecraft/screen/MerchantScreenHandler;playYesSound()V
      intermediary method_20595 Lnet/minecraft/class_1728;method_20595()V
      official r Lcum;r()V
    • onClosed

      public void onClosed(PlayerEntity player)
      Called when this screen handler is closed.

      To close a screen handler, call PlayerEntity.closeHandledScreen() on the server instead of this method.

      This drops the cursor stack by default. Subclasses that have slots not backed by a persistent inventory should call ScreenHandler.dropInventory(net.minecraft.entity.player.PlayerEntity, net.minecraft.inventory.Inventory) to drop the stacks.

      Overrides:
      onClosed in class ScreenHandler
      Mappings:
      Namespace Name Mixin selector
      named onClosed Lnet/minecraft/screen/ScreenHandler;onClosed(Lnet/minecraft/entity/player/PlayerEntity;)V
      intermediary method_7595 Lnet/minecraft/class_1703;method_7595(Lnet/minecraft/class_1657;)V
      official a Lctb;a(Lcpw;)V
    • switchTo

      public void switchTo(int recipeIndex)
      Mappings:
      Namespace Name Mixin selector
      named switchTo Lnet/minecraft/screen/MerchantScreenHandler;switchTo(I)V
      intermediary method_20215 Lnet/minecraft/class_1728;method_20215(I)V
      official h Lcum;h(I)V
    • autofill

      private void autofill(int slot, TradedItem stack)
      Mappings:
      Namespace Name Mixin selector
      named autofill Lnet/minecraft/screen/MerchantScreenHandler;autofill(ILnet/minecraft/village/TradedItem;)V
      intermediary method_20214 Lnet/minecraft/class_1728;method_20214(ILnet/minecraft/class_9306;)V
      official a Lcum;a(ILdgc;)V
    • setOffers

      public void setOffers(TradeOfferList offers)
      Mappings:
      Namespace Name Mixin selector
      named setOffers Lnet/minecraft/screen/MerchantScreenHandler;setOffers(Lnet/minecraft/village/TradeOfferList;)V
      intermediary method_17437 Lnet/minecraft/class_1728;method_17437(Lnet/minecraft/class_1916;)V
      official a Lcum;a(Ldgf;)V
    • getRecipes

      public TradeOfferList getRecipes()
      Mappings:
      Namespace Name Mixin selector
      named getRecipes Lnet/minecraft/screen/MerchantScreenHandler;getRecipes()Lnet/minecraft/village/TradeOfferList;
      intermediary method_17438 Lnet/minecraft/class_1728;method_17438()Lnet/minecraft/class_1916;
      official p Lcum;p()Ldgf;
    • isLeveled

      public boolean isLeveled()
      Mappings:
      Namespace Name Mixin selector
      named isLeveled Lnet/minecraft/screen/MerchantScreenHandler;isLeveled()Z
      intermediary method_19259 Lnet/minecraft/class_1728;method_19259()Z
      official q Lcum;q()Z