Class HopperScreenHandler

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

public class HopperScreenHandler extends ScreenHandler
Mappings:
Namespace Name
named net/minecraft/screen/HopperScreenHandler
intermediary net/minecraft/class_1722
official cuc
  • Field Details

    • SLOT_COUNT

      public static final int SLOT_COUNT
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named SLOT_COUNT Lnet/minecraft/screen/HopperScreenHandler;SLOT_COUNT:I
      intermediary field_30801 Lnet/minecraft/class_1722;field_30801:I
      official m Lcuc;m:I
    • inventory

      private final Inventory inventory
      Mappings:
      Namespace Name Mixin selector
      named inventory Lnet/minecraft/screen/HopperScreenHandler;inventory:Lnet/minecraft/inventory/Inventory;
      intermediary field_7826 Lnet/minecraft/class_1722;field_7826:Lnet/minecraft/class_1263;
      official n Lcuc;n:Lbtb;
  • Constructor Details

    • HopperScreenHandler

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

      public HopperScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/screen/HopperScreenHandler;<init>(ILnet/minecraft/entity/player/PlayerInventory;Lnet/minecraft/inventory/Inventory;)V
      intermediary <init> Lnet/minecraft/class_1722;<init>(ILnet/minecraft/class_1661;Lnet/minecraft/class_1263;)V
      official <init> Lcuc;<init>(ILcpv;Lbtb;)V
  • Method Details

    • 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
    • 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;
    • 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