2020-03-08 18:18:57 -04:00
|
|
|
CLASS net/minecraft/class_1703 net/minecraft/screen/ScreenHandler
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Manages lists of item stacks and properties between the server and the client for use
|
|
|
|
COMMENT in a screen. They are usually used for synchronizing the screens of container blocks
|
|
|
|
COMMENT such as chests and furnaces.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>On the client, screen handlers are coupled with a {@link
|
|
|
|
COMMENT net.minecraft.client.gui.screen.ingame.HandledScreen}. Handled screens have a
|
|
|
|
COMMENT reference to a client-sided screen handler that is exposed through the
|
|
|
|
COMMENT {@link net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider} interface.
|
|
|
|
COMMENT
|
2022-09-10 05:33:18 -04:00
|
|
|
COMMENT <h2 id="models">Models</h2>
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT <p>Screen handlers hold slots, properties, property delegates, and screen handler
|
|
|
|
COMMENT contexts. This allows easy synchronization of states between the client and the
|
|
|
|
COMMENT server, and prevents running code on the wrong side.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>{@link Slot} holds one item stack. The slots are usually controlled by the server,
|
|
|
|
COMMENT and the changes to slots on the server are automatically synchronized to the client.
|
|
|
|
COMMENT Slots can be backed by an inventory, allowing the changes to be reflected to the
|
|
|
|
COMMENT persistent storage (like block entities) on the server. Clients manipulate the
|
|
|
|
COMMENT slots by issuing a "slot click" packet. "Clicking" a slot includes actions like
|
|
|
|
COMMENT picking up crafting result, shift-clicking stacks, swapping stacks between the
|
|
|
|
COMMENT inventory and the hotbar, or dropping stacks.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Screen handlers also contain a list of {@linkplain Property properties}
|
|
|
|
COMMENT that are used for syncing integers (e.g. progress bars) from the server to the client.
|
|
|
|
COMMENT Properties can also be used to sync an integer from the client to the server, although
|
|
|
|
COMMENT it has to be manually performed. If a property relies on other objects, like
|
|
|
|
COMMENT a value from a block entity instance, then the property can delegate its operations
|
|
|
|
COMMENT using {@link PropertyDelegate}. The delegate is passed when creating the screen handler.
|
|
|
|
COMMENT On the server, access to the property's value is delegated to the delegate (which in
|
|
|
|
COMMENT turn delegates to another object like a block entity instance).
|
|
|
|
COMMENT On the client, access to the property's value still uses the synced value.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>{@link ScreenHandlerContext} allows running code on the server side only. Screen
|
|
|
|
COMMENT handlers are designed to be used on both sides; any action modifying the world has
|
|
|
|
COMMENT to be wrapped in a call to the context. Like with the property delegate, a context
|
|
|
|
COMMENT with the world is passed to the screen handler on creation on the server. On the
|
|
|
|
COMMENT server, the context executes the function with the world and the position. On the
|
|
|
|
COMMENT client, the context does nothing.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <h2 id="usage">How to use screen handlers</h2>
|
|
|
|
COMMENT <h3 id="creation">Creation</h3>
|
|
|
|
COMMENT <p>To create a new screen handler, subclass {@link ScreenHandler}, create and register
|
|
|
|
COMMENT a new {@linkplain ScreenHandlerType screen handler type}, and associate it with
|
|
|
|
COMMENT a handled screen.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>A subclass should have two constructors. One is for the server, and should take
|
|
|
|
COMMENT the {@code syncId} and inventories, property delegates, or contexts that are used.
|
|
|
|
COMMENT The {@link #syncId} is shared between the two sides. It is used to verify that a player
|
|
|
|
COMMENT has a specific screen (handler) open so that they can move items, for example.
|
|
|
|
COMMENT The inventories are used to back a slot so that any changes to a slot is reflected
|
|
|
|
COMMENT on the backing inventory, and vice versa. Property delegates and contexts bridge
|
|
|
|
COMMENT between the screen handler and other parts of the world; see above for more description.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>The constructor should {@linkplain #addSlot add slots}, {@link #addProperties
|
|
|
|
COMMENT add properties from delegates}, and store the property delegates and screen handler
|
|
|
|
COMMENT context in the instance fields.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>The other constructor is for the client. There, the only parameters allowed are the
|
|
|
|
COMMENT {@code syncId} and the player inventory. This is because all other things are
|
|
|
|
COMMENT unavailable at creation time and synced later. This constructor should call the
|
|
|
|
COMMENT other constructor with {@linkplain net.minecraft.inventory.SimpleInventory
|
|
|
|
COMMENT a new simple inventory of sufficient size}, {@linkplain ArrayPropertyDelegate
|
|
|
|
COMMENT a new array property delegate}, and {@linkplain ScreenHandlerContext#EMPTY
|
|
|
|
COMMENT an empty screen handler context}. Synced data then fills the inventory and property
|
|
|
|
COMMENT delegate.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>The screen handler then has to be registered in a registry. Create a new instance of
|
|
|
|
COMMENT {@link ScreenHandlerType} with the screen handler type factory (which can be a reference
|
|
|
|
COMMENT to the client-side constructor; i.e. {@code MyScreenHandler::MyScreenHandler})
|
|
|
|
COMMENT and register it to {@link net.minecraft.util.registry.Registry#SCREEN_HANDLER}.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <h3 id="opening">Opening</h3>
|
|
|
|
COMMENT <p>Most of the screen handlers are associated with a block and opened by using the block.
|
|
|
|
COMMENT Screen handlers are opened on the server and synced to the client. To open a
|
|
|
|
COMMENT screen handler, use {@link PlayerEntity#openHandledScreen}. This takes a
|
|
|
|
COMMENT {@link NamedScreenHandlerFactory}, which creates a screen handler. In vanilla,
|
|
|
|
COMMENT block entity instances implement the interface, allowing them to be passed.
|
|
|
|
COMMENT {@link SimpleNamedScreenHandlerFactory} is a screen handler factory implementation
|
|
|
|
COMMENT for use cases that do not involve a block entity.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>The factory should create a new instance of a screen handler with the server-side
|
|
|
|
COMMENT constructor (one that takes inventories, etc). If the screen handler requires
|
|
|
|
COMMENT a property delegate or a context, create an instance and pass it here.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>As long as the screen handler only uses the slots and properties, there should not
|
|
|
|
COMMENT be any need for external synchronization.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <h3 id="interaction">Interaction</h3>
|
|
|
|
COMMENT <p>Screen handler interaction mainly involves "slot clicks" and "button clicks".
|
|
|
|
COMMENT A {@linkplain #onSlotClick slot click} is, as mentioned before, an action manipulating
|
|
|
|
COMMENT the slots' held item stacks. Slot clicks are implemented in this class and
|
2022-11-10 11:25:19 -05:00
|
|
|
COMMENT {@link #quickMove}. To manipulate the stacks, get the slot via {@link #getSlot}
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT and call methods of it. Screen handlers also provide methods for common operations,
|
|
|
|
COMMENT such as {@link #insertItem} that inserts a stack to the screen handler's available slots.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>The "cursor stack" is an item stack held by the cursor. When moving item stacks
|
|
|
|
COMMENT between slots, the cursor stack can hold the stack temporarily. The cursor stack
|
|
|
|
COMMENT is not held by any slots. When the screen handler is closed, the stack will be
|
|
|
|
COMMENT inserted to the player inventory or dropped as an item entity.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Some screen handlers also handle {@linkplain #onButtonClick button clicks}.
|
|
|
|
COMMENT This is used to execute an action on the server as a response to clients sending a
|
|
|
|
COMMENT button click packet. In most cases, this is triggered by a button in the screen
|
|
|
|
COMMENT rendered by the client, hence the name. Inside screen handlers, buttons are identified
|
|
|
|
COMMENT with an integer.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Subclasses must implement two methods: {@link #canUse(PlayerEntity)} and {@link
|
2022-11-10 11:25:19 -05:00
|
|
|
COMMENT #quickMove}. See the documentation of each method for more details.
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT
|
|
|
|
COMMENT <h3 id="closing">Closing</h3>
|
|
|
|
COMMENT <p>Since a screen handler handles the client's screen, the screen must be closed at the
|
|
|
|
COMMENT same time. To close the screen handler and the screen, call {@link
|
|
|
|
COMMENT PlayerEntity#closeHandledScreen} on the server.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Screen handlers should override {@link #close}. In there, it should {@linkplain
|
|
|
|
COMMENT #dropInventory drop contents} of all slots not backed by an inventory and call
|
|
|
|
COMMENT {@link Inventory#onClose} on the backing inventory. See the documentation of
|
|
|
|
COMMENT the method for more details.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @see ScreenHandlerType
|
|
|
|
COMMENT @see ScreenHandlerFactory
|
|
|
|
COMMENT @see Slot
|
|
|
|
COMMENT @see Inventory
|
|
|
|
COMMENT @see net.minecraft.client.gui.screen.ingame.HandledScreen
|
2019-06-28 17:55:20 -04:00
|
|
|
FIELD field_17285 properties Ljava/util/List;
|
|
|
|
FIELD field_17493 type Lnet/minecraft/class_3917;
|
2021-03-16 15:42:00 -04:00
|
|
|
FIELD field_29205 cursorStack Lnet/minecraft/class_1799;
|
|
|
|
FIELD field_29206 previousTrackedStacks Lnet/minecraft/class_2371;
|
|
|
|
FIELD field_29207 previousCursorStack Lnet/minecraft/class_1799;
|
|
|
|
FIELD field_29208 syncHandler Lnet/minecraft/class_5916;
|
|
|
|
FIELD field_29209 disableSync Z
|
2021-04-04 08:09:51 -04:00
|
|
|
FIELD field_29559 trackedPropertyValues Lit/unimi/dsi/fastutil/ints/IntList;
|
|
|
|
FIELD field_30730 EMPTY_SPACE_SLOT_INDEX I
|
|
|
|
COMMENT A special slot index value ({@value}) indicating that the player has clicked outside the main panel
|
|
|
|
COMMENT of a screen. Used for dropping the cursor stack.
|
2021-06-26 07:53:03 -04:00
|
|
|
FIELD field_34024 revision I
|
2022-02-18 17:44:32 -05:00
|
|
|
FIELD field_36534 LOGGER Lorg/slf4j/Logger;
|
2019-06-28 17:55:20 -04:00
|
|
|
FIELD field_7757 quickCraftSlots Ljava/util/Set;
|
2021-01-31 07:37:36 -05:00
|
|
|
FIELD field_7759 quickCraftStage I
|
2020-11-04 15:44:22 -05:00
|
|
|
FIELD field_7761 slots Lnet/minecraft/class_2371;
|
2021-01-31 07:37:36 -05:00
|
|
|
FIELD field_7762 quickCraftButton I
|
2019-06-28 17:55:20 -04:00
|
|
|
FIELD field_7763 syncId I
|
2020-01-21 13:21:12 -05:00
|
|
|
FIELD field_7764 trackedStacks Lnet/minecraft/class_2371;
|
|
|
|
COMMENT A list of item stacks that is used for tracking changes in {@link #sendContentUpdates()}.
|
2019-06-28 17:55:20 -04:00
|
|
|
FIELD field_7765 listeners Ljava/util/List;
|
2019-07-08 12:09:22 -04:00
|
|
|
METHOD <init> (Lnet/minecraft/class_3917;I)V
|
2021-03-11 14:11:49 -05:00
|
|
|
ARG 1 type
|
2019-01-24 16:38:44 -05:00
|
|
|
ARG 2 syncId
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_17358 getType ()Lnet/minecraft/class_3917;
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT {@return the screen handler type}
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>A screen handler must have associated screen handler type to open it.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @throws UnsupportedOperationException if the type is not passed in the constructor
|
2020-03-12 17:05:02 -04:00
|
|
|
METHOD method_17359 checkSize (Lnet/minecraft/class_1263;I)V
|
2020-01-21 13:21:12 -05:00
|
|
|
COMMENT Checks that the size of the provided inventory is at least as large as the {@code expectedSize}.
|
|
|
|
COMMENT
|
2020-06-24 12:34:48 -04:00
|
|
|
COMMENT @throws IllegalArgumentException if the inventory size is smaller than {@code expectedSize}
|
2020-03-12 17:05:02 -04:00
|
|
|
ARG 0 inventory
|
2019-06-28 17:55:20 -04:00
|
|
|
ARG 1 expectedSize
|
|
|
|
METHOD method_17360 addProperties (Lnet/minecraft/class_3913;)V
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Adds properties of {@code propertyDelegate} to this screen handler.
|
|
|
|
COMMENT This must be called inside the subclass's constructor.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @see #addProperty
|
2021-03-11 14:11:49 -05:00
|
|
|
ARG 1 propertyDelegate
|
2020-03-12 17:05:02 -04:00
|
|
|
METHOD method_17361 checkDataCount (Lnet/minecraft/class_3913;I)V
|
2020-06-24 12:34:48 -04:00
|
|
|
COMMENT Checks that the size of the {@code data} is at least as large as the {@code expectedCount}.
|
2020-01-21 13:21:12 -05:00
|
|
|
COMMENT
|
2020-06-24 12:34:48 -04:00
|
|
|
COMMENT @throws IllegalArgumentException if the {@code data} has a smaller size than {@code expectedCount}
|
2019-06-28 17:55:20 -04:00
|
|
|
ARG 0 data
|
|
|
|
ARG 1 expectedCount
|
|
|
|
METHOD method_17362 addProperty (Lnet/minecraft/class_3915;)Lnet/minecraft/class_3915;
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Adds {@code property} to this screen handler. This must be called inside the
|
|
|
|
COMMENT subclass's constructor.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>If the property relies on external objects (such as a block entity instance),
|
|
|
|
COMMENT it should instead use property delegates and {@link #addProperties}.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @return the added property
|
|
|
|
COMMENT
|
|
|
|
COMMENT @see #addProperties
|
2021-01-31 07:37:36 -05:00
|
|
|
ARG 1 property
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_17695 canUse (Lnet/minecraft/class_3914;Lnet/minecraft/class_1657;Lnet/minecraft/class_2248;)Z
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT {@return whether the screen handler can be used}
|
|
|
|
COMMENT
|
|
|
|
COMMENT @apiNote This should be called inside {@link #canUse(PlayerEntity)}.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @implNote On the server, this checks that the block at the position is
|
|
|
|
COMMENT {@code block} and the player is within 8 blocks from the block's center.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @see #canUse(PlayerEntity)
|
2020-01-21 13:21:12 -05:00
|
|
|
ARG 0 context
|
|
|
|
ARG 1 player
|
|
|
|
ARG 2 block
|
2021-01-31 07:37:36 -05:00
|
|
|
METHOD method_17696 (Lnet/minecraft/class_2248;Lnet/minecraft/class_1657;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)Ljava/lang/Boolean;
|
|
|
|
ARG 2 world
|
|
|
|
ARG 3 pos
|
2021-03-10 13:34:17 -05:00
|
|
|
METHOD method_30010 internalOnSlotClick (IILnet/minecraft/class_1713;Lnet/minecraft/class_1657;)V
|
2021-02-07 08:31:42 -05:00
|
|
|
COMMENT The actual logic that handles a slot click. Called by {@link #onSlotClick
|
|
|
|
COMMENT (int, int, SlotActionType, PlayerEntity)} in a try-catch block that wraps
|
|
|
|
COMMENT exceptions from this method into a crash report.
|
2020-12-09 08:21:10 -05:00
|
|
|
ARG 1 slotIndex
|
2021-04-04 08:09:51 -04:00
|
|
|
ARG 2 button
|
2020-12-09 08:21:10 -05:00
|
|
|
ARG 3 actionType
|
|
|
|
ARG 4 player
|
2021-03-16 15:42:00 -04:00
|
|
|
METHOD method_34245 setPreviousTrackedSlot (ILnet/minecraft/class_1799;)V
|
|
|
|
ARG 1 slot
|
|
|
|
ARG 2 stack
|
|
|
|
METHOD method_34246 updateTrackedSlot (ILnet/minecraft/class_1799;Ljava/util/function/Supplier;)V
|
|
|
|
ARG 1 slot
|
|
|
|
ARG 2 stack
|
|
|
|
ARG 3 copySupplier
|
|
|
|
METHOD method_34247 copySharedSlots (Lnet/minecraft/class_1703;)V
|
|
|
|
ARG 1 handler
|
|
|
|
METHOD method_34248 updateSyncHandler (Lnet/minecraft/class_5916;)V
|
|
|
|
ARG 1 handler
|
2021-06-27 06:18:10 -04:00
|
|
|
METHOD method_34249 (Lnet/minecraft/class_1735;Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;)V
|
|
|
|
ARG 3 stack
|
2021-03-16 15:42:00 -04:00
|
|
|
METHOD method_34250 setPreviousCursorStack (Lnet/minecraft/class_1799;)V
|
|
|
|
ARG 1 stack
|
2021-06-27 06:18:10 -04:00
|
|
|
METHOD method_34251 (Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;)V
|
|
|
|
ARG 3 stack
|
2021-03-16 15:42:00 -04:00
|
|
|
METHOD method_34252 syncState ()V
|
2021-04-04 08:09:51 -04:00
|
|
|
METHOD method_34253 checkSlotUpdates (ILnet/minecraft/class_1799;Ljava/util/function/Supplier;)V
|
2021-03-16 15:42:00 -04:00
|
|
|
ARG 1 slot
|
|
|
|
ARG 2 stack
|
|
|
|
ARG 3 copySupplier
|
|
|
|
METHOD method_34254 setCursorStack (Lnet/minecraft/class_1799;)V
|
|
|
|
ARG 1 stack
|
|
|
|
METHOD method_34255 getCursorStack ()Lnet/minecraft/class_1799;
|
|
|
|
METHOD method_34256 disableSyncing ()V
|
|
|
|
METHOD method_34257 enableSyncing ()V
|
2021-04-04 08:09:51 -04:00
|
|
|
METHOD method_34258 checkCursorStackUpdates ()V
|
2021-05-30 17:10:13 -04:00
|
|
|
METHOD method_34259 getCursorStackReference ()Lnet/minecraft/class_5630;
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT {@return a reference to the cursor's stack}
|
2021-04-04 08:09:51 -04:00
|
|
|
METHOD method_34715 checkPropertyUpdates (II)V
|
|
|
|
ARG 1 id
|
|
|
|
ARG 2 value
|
2021-06-26 07:53:03 -04:00
|
|
|
METHOD method_37418 getSlotIndex (Lnet/minecraft/class_1263;I)Ljava/util/OptionalInt;
|
|
|
|
ARG 1 inventory
|
|
|
|
ARG 2 index
|
2021-06-24 09:15:19 -04:00
|
|
|
METHOD method_37419 notifyPropertyUpdate (II)V
|
|
|
|
ARG 1 index
|
|
|
|
ARG 2 value
|
|
|
|
METHOD method_37420 updateToClient ()V
|
2021-06-26 07:53:03 -04:00
|
|
|
METHOD method_37421 getRevision ()I
|
|
|
|
METHOD method_37422 nextRevision ()I
|
2021-07-01 08:54:06 -04:00
|
|
|
METHOD method_37449 setPreviousTrackedSlotMutable (ILnet/minecraft/class_1799;)V
|
|
|
|
ARG 1 slot
|
2022-02-18 17:44:32 -05:00
|
|
|
ARG 2 stack
|
|
|
|
METHOD method_40442 isValid (I)Z
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT {@return whether the given slot index is valid}
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>This returns {@code true} for all added slots, {@value #EMPTY_SPACE_SLOT_INDEX},
|
|
|
|
COMMENT and {@code -1}.
|
2022-02-18 17:44:32 -05:00
|
|
|
ARG 1 slot
|
2022-11-01 07:11:24 -04:00
|
|
|
METHOD method_45409 handleSlotClick (Lnet/minecraft/class_1657;Lnet/minecraft/class_5536;Lnet/minecraft/class_1735;Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Z
|
|
|
|
ARG 1 player
|
|
|
|
ARG 2 clickType
|
|
|
|
ARG 3 slot
|
|
|
|
ARG 4 stack
|
|
|
|
ARG 5 cursorStack
|
2020-03-19 10:41:44 -04:00
|
|
|
METHOD method_7591 packQuickCraftData (II)I
|
|
|
|
ARG 0 quickCraftStage
|
|
|
|
ARG 1 buttonId
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7592 canInsertItemIntoSlot (Lnet/minecraft/class_1735;Lnet/minecraft/class_1799;Z)Z
|
|
|
|
ARG 0 slot
|
|
|
|
ARG 1 stack
|
2020-03-12 17:05:02 -04:00
|
|
|
ARG 2 allowOverflow
|
2021-03-10 13:34:17 -05:00
|
|
|
METHOD method_7593 onSlotClick (IILnet/minecraft/class_1713;Lnet/minecraft/class_1657;)V
|
2020-03-19 10:41:44 -04:00
|
|
|
COMMENT Performs a slot click. This can behave in many different ways depending mainly on the action type.
|
2020-12-09 08:21:10 -05:00
|
|
|
ARG 1 slotIndex
|
2021-04-04 08:09:51 -04:00
|
|
|
ARG 2 button
|
2018-11-04 07:22:38 -05:00
|
|
|
ARG 3 actionType
|
2021-04-13 07:59:43 -04:00
|
|
|
COMMENT the type of slot click, check the docs for each {@link SlotActionType} value for details
|
2020-12-09 08:21:10 -05:00
|
|
|
ARG 4 player
|
2020-03-19 10:41:44 -04:00
|
|
|
METHOD method_7594 unpackQuickCraftStage (I)I
|
|
|
|
ARG 0 quickCraftData
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7595 close (Lnet/minecraft/class_1657;)V
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Closes this screen handler.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>To close a screen handler, call {@link PlayerEntity#closeHandledScreen}
|
|
|
|
COMMENT on the server instead of this method.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>This drops the cursor stack by default. Subclasses that have slots not backed
|
|
|
|
COMMENT by a persistent inventory should call {@link #dropInventory} to drop the stacks.
|
2021-06-26 07:53:03 -04:00
|
|
|
ARG 1 player
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7596 addListener (Lnet/minecraft/class_1712;)V
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Adds {@code listener} to the screen handler.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Listeners are often used to listen to slot or property changes on the
|
|
|
|
COMMENT client's screen.
|
2021-03-11 14:11:49 -05:00
|
|
|
ARG 1 listener
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7597 canUse (Lnet/minecraft/class_1657;)Z
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT {@return whether the screen handler can be used}
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Subclasses should call #canUse(ScreenHandlerContext, PlayerEntity, Block)}
|
|
|
|
COMMENT or implement the check itself. The implementation should check that the
|
|
|
|
COMMENT player is near the screen handler's source position (e.g. block position) and
|
|
|
|
COMMENT that the source (e.g. block) is not destroyed.
|
2018-11-04 07:22:38 -05:00
|
|
|
ARG 1 player
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7600 shouldQuickCraftContinue (ILnet/minecraft/class_1657;)Z
|
2020-03-12 17:05:02 -04:00
|
|
|
ARG 0 stage
|
|
|
|
ARG 1 player
|
2022-11-10 11:25:19 -05:00
|
|
|
METHOD method_7601 quickMove (Lnet/minecraft/class_1657;I)Lnet/minecraft/class_1799;
|
|
|
|
COMMENT Quick-moves the stack at {@code slot} to other
|
|
|
|
COMMENT slots of the screen handler that belong to a different inventory or
|
|
|
|
COMMENT another section of the same inventory. For example, items can be quick-moved
|
|
|
|
COMMENT between a chest's slots and the player inventory or between the main player inventory
|
|
|
|
COMMENT and the hotbar.
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Subclasses should call {@link #insertItem}, and if the insertion was successful,
|
|
|
|
COMMENT clear the slot (if the stack is exhausted) or mark it as dirty. See the vanilla
|
|
|
|
COMMENT subclasses for basic implementation.
|
|
|
|
COMMENT
|
2022-11-10 11:25:19 -05:00
|
|
|
COMMENT <p>Quick-moving is also known as "shift-clicking" since it's usually triggered
|
|
|
|
COMMENT using <kbd>Shift</kbd>+<kbd>left click</kbd>.
|
|
|
|
COMMENT
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT @return {@link ItemStack#EMPTY} when no stack can be transferred, otherwise
|
|
|
|
COMMENT the original stack
|
|
|
|
COMMENT
|
|
|
|
COMMENT @see #insertItem
|
2019-06-28 17:55:20 -04:00
|
|
|
ARG 1 player
|
2022-11-10 11:25:19 -05:00
|
|
|
ARG 2 slot
|
|
|
|
COMMENT the index of the slot to quick-move from
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7602 getStacks ()Lnet/minecraft/class_2371;
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT {@return a list of all stacks of the screen handler's slot}
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>This should not be used in most cases, and modifying the returned list
|
|
|
|
COMMENT has no effect to the screen handler.
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7603 removeListener (Lnet/minecraft/class_1712;)V
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Removes {@code listener} from this screen handler.
|
2018-12-08 17:20:01 -05:00
|
|
|
ARG 1 listener
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7604 onButtonClick (Lnet/minecraft/class_1657;I)Z
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Called when {@code player} clicks a button with {@code id}.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>"Button click" is an abstract concept; it does not have to be triggered by a
|
|
|
|
COMMENT button. Examples of button clicks include selecting a recipe for a stonecutter,
|
|
|
|
COMMENT turning a page of a lectern's book, or selecting an enchantment on an enchanting table.
|
|
|
|
COMMENT Buttons are identified by an integer.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @implNote This is normally only called by the server; however, screens that use buttons
|
|
|
|
COMMENT can call this on the client.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @return whether the button click is handled successfully
|
2019-06-28 17:55:20 -04:00
|
|
|
ARG 1 player
|
|
|
|
ARG 2 id
|
|
|
|
METHOD method_7605 endQuickCraft ()V
|
2020-01-21 13:21:12 -05:00
|
|
|
METHOD method_7606 setProperty (II)V
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Sets the property with ID {@code id} to {@code value}.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Subclasses can call {@link #sendContentUpdates} to manually sync the change
|
|
|
|
COMMENT to the client.
|
2020-01-21 13:21:12 -05:00
|
|
|
ARG 1 id
|
|
|
|
ARG 2 value
|
2020-11-04 15:44:22 -05:00
|
|
|
METHOD method_7607 dropInventory (Lnet/minecraft/class_1657;Lnet/minecraft/class_1263;)V
|
2020-01-21 13:21:12 -05:00
|
|
|
ARG 1 player
|
2021-01-31 07:37:36 -05:00
|
|
|
ARG 2 inventory
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7608 calculateComparatorOutput (Lnet/minecraft/class_2586;)I
|
|
|
|
ARG 0 entity
|
|
|
|
METHOD method_7609 onContentChanged (Lnet/minecraft/class_1263;)V
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Called when a slot's content has changed.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>This is not called by default; subclasses that override this method
|
|
|
|
COMMENT should also use a custom {@link Inventory} whose {@link Inventory#markDirty markDirty} method is
|
|
|
|
COMMENT overridden to call this method as a backing inventory of the slot.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>This can be used to update the output slot when input changes.
|
2019-06-28 17:55:20 -04:00
|
|
|
ARG 1 inventory
|
2021-06-18 09:36:45 -04:00
|
|
|
METHOD method_7610 updateSlotStacks (ILjava/util/List;Lnet/minecraft/class_1799;)V
|
2021-06-26 07:53:03 -04:00
|
|
|
ARG 1 revision
|
|
|
|
ARG 2 stacks
|
|
|
|
ARG 3 cursorStack
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7611 getSlot (I)Lnet/minecraft/class_1735;
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT {@return the slot with index {@code index}}
|
2020-01-21 13:21:12 -05:00
|
|
|
ARG 1 index
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7613 canInsertIntoSlot (Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;)Z
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT {@return whether {@code stack} can be inserted to {@code slot}}
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>Subclasses should override this to return {@code false} if the slot is
|
|
|
|
COMMENT used for output.
|
2017-05-13 02:02:51 -04:00
|
|
|
ARG 1 stack
|
2019-06-28 17:55:20 -04:00
|
|
|
ARG 2 slot
|
|
|
|
METHOD method_7615 canInsertIntoSlot (Lnet/minecraft/class_1735;)Z
|
2020-03-12 17:05:02 -04:00
|
|
|
ARG 1 slot
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7616 insertItem (Lnet/minecraft/class_1799;IIZ)Z
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Tries to consume {@code stack} by inserting to slots from {@code startIndex}
|
|
|
|
COMMENT to {@code endIndex - 1} (both inclusive) until the entire stack is used.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>If {@code fromLast} is {@code true}, this attempts the insertion in reverse
|
|
|
|
COMMENT order; i.e. {@code endIndex - 1} to {@code startIndex} (both inclusive).
|
|
|
|
COMMENT
|
|
|
|
COMMENT @return whether {@code stack} was decremented
|
2018-11-04 07:22:38 -05:00
|
|
|
ARG 1 stack
|
|
|
|
ARG 2 startIndex
|
|
|
|
ARG 3 endIndex
|
2019-04-12 10:16:50 -04:00
|
|
|
ARG 4 fromLast
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7617 calculateStackSize (Ljava/util/Set;ILnet/minecraft/class_1799;I)V
|
2017-05-13 02:02:51 -04:00
|
|
|
ARG 0 slots
|
2020-06-24 12:34:48 -04:00
|
|
|
ARG 1 mode
|
2017-05-13 02:02:51 -04:00
|
|
|
ARG 2 stack
|
|
|
|
ARG 3 stackSize
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7618 calculateComparatorOutput (Lnet/minecraft/class_1263;)I
|
2018-10-24 15:39:56 -04:00
|
|
|
ARG 0 inventory
|
2021-06-18 09:36:45 -04:00
|
|
|
METHOD method_7619 setStackInSlot (IILnet/minecraft/class_1799;)V
|
2019-06-28 17:55:20 -04:00
|
|
|
ARG 1 slot
|
2021-06-26 07:53:03 -04:00
|
|
|
ARG 2 revision
|
|
|
|
ARG 3 stack
|
2020-03-19 10:41:44 -04:00
|
|
|
METHOD method_7620 unpackQuickCraftButton (I)I
|
|
|
|
ARG 0 quickCraftData
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7621 addSlot (Lnet/minecraft/class_1735;)Lnet/minecraft/class_1735;
|
2022-08-13 09:37:06 -04:00
|
|
|
COMMENT Adds {@code slot} to this screen handler. This must be called inside
|
|
|
|
COMMENT the subclass's constructor.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @return the added slot
|
2021-03-11 14:11:49 -05:00
|
|
|
ARG 1 slot
|
2019-06-28 17:55:20 -04:00
|
|
|
METHOD method_7623 sendContentUpdates ()V
|
2020-01-21 13:21:12 -05:00
|
|
|
COMMENT Sends updates to listeners if any properties or slot stacks have changed.
|