Package net.minecraft.screen
Class ScreenHandler
java.lang.Object
net.minecraft.screen.ScreenHandler
- Direct Known Subclasses:
AbstractRecipeScreenHandler,BeaconScreenHandler,BrewingStandScreenHandler,CartographyTableScreenHandler,CreativeInventoryScreen.CreativeScreenHandler,EnchantmentScreenHandler,ForgingScreenHandler,Generic3x3ContainerScreenHandler,GenericContainerScreenHandler,GrindstoneScreenHandler,HopperScreenHandler,HorseScreenHandler,LecternScreenHandler,LoomScreenHandler,MerchantScreenHandler,ShulkerBoxScreenHandler,StonecutterScreenHandler
public abstract class ScreenHandler extends Object
- Mappings:
Namespace Name official bjrintermediary net/minecraft/class_1703named net/minecraft/screen/ScreenHandler
-
Field Summary
Fields Modifier and Type Field Description private shortactionIdprivate List<ScreenHandlerListener>listenersprivate List<Property>propertiesprivate intquickCraftButtonprivate Set<Slot>quickCraftSlotsprivate intquickCraftStageprivate Set<PlayerEntity>restrictedPlayersDefaultedList<Slot>slotsintsyncIdprivate DefaultedList<ItemStack>trackedStacksA list of item stacks that is used for tracking changes insendContentUpdates().private ScreenHandlerType<?>type -
Constructor Summary
Constructors Modifier Constructor Description protectedScreenHandler(ScreenHandlerType<?> type, int syncId) -
Method Summary
Modifier and Type Method Description voidaddListener(ScreenHandlerListener listener)protected voidaddProperties(PropertyDelegate propertyDelegate)protected PropertyaddProperty(Property property)protected SlotaddSlot(Slot slot)static intcalculateComparatorOutput(BlockEntity entity)static intcalculateComparatorOutput(Inventory inventory)static voidcalculateStackSize(Set<Slot> slots, int mode, ItemStack stack, int stackSize)booleancanInsertIntoSlot(ItemStack stack, Slot slot)booleancanInsertIntoSlot(Slot slot)static booleancanInsertItemIntoSlot(Slot slot, ItemStack stack, boolean allowOverflow)abstract booleancanUse(PlayerEntity player)protected static booleancanUse(ScreenHandlerContext context, PlayerEntity player, Block block)protected static voidcheckDataCount(PropertyDelegate data, int expectedCount)Checks that the size of thedatais at least as large as theexpectedCount.protected static voidcheckSize(Inventory inventory, int expectedSize)Checks that the size of the provided inventory is at least as large as theexpectedSize.voidclose(PlayerEntity player)protected voiddropInventory(PlayerEntity player, Inventory inventory)protected voidendQuickCraft()shortgetNextActionId(PlayerInventory playerInventory)SlotgetSlot(int index)DefaultedList<ItemStack>getStacks()ScreenHandlerType<?>getType()protected booleaninsertItem(ItemStack stack, int startIndex, int endIndex, boolean fromLast)private ItemStackinternalOnSlotClick(int slotIndex, int clickData, SlotActionType actionType, PlayerEntity player)The actual logic that handles a slot click.booleanisNotRestricted(PlayerEntity player)booleanonButtonClick(PlayerEntity player, int id)voidonContentChanged(Inventory inventory)ItemStackonSlotClick(int slotIndex, int clickData, SlotActionType actionType, PlayerEntity player)Performs a slot click.static intpackQuickCraftData(int quickCraftStage, int buttonId)voidremoveListener(ScreenHandlerListener listener)voidsendContentUpdates()Sends updates to listeners if any properties or slot stacks have changed.voidsetPlayerRestriction(PlayerEntity player, boolean unrestricted)voidsetProperty(int id, int value)voidsetStackInSlot(int slot, ItemStack stack)static booleanshouldQuickCraftContinue(int stage, PlayerEntity player)ItemStacktransferSlot(PlayerEntity player, int index)static intunpackQuickCraftButton(int quickCraftData)static intunpackQuickCraftStage(int quickCraftData)voidupdateSlotStacks(List<ItemStack> stacks)
-
Field Details
-
trackedStacks
A list of item stacks that is used for tracking changes insendContentUpdates().- Mappings:
Namespace Name Mixin selector official cLbjr;c:Lgj;intermediary field_7764Lnet/minecraft/class_1703;field_7764:Lnet/minecraft/class_2371;named trackedStacksLnet/minecraft/screen/ScreenHandler;trackedStacks:Lnet/minecraft/util/collection/DefaultedList;
-
slots
- Mappings:
Namespace Name Mixin selector official aLbjr;a:Lgj;intermediary field_7761Lnet/minecraft/class_1703;field_7761:Lnet/minecraft/class_2371;named slotsLnet/minecraft/screen/ScreenHandler;slots:Lnet/minecraft/util/collection/DefaultedList;
-
properties
- Mappings:
Namespace Name Mixin selector official dLbjr;d:Ljava/util/List;intermediary field_17285Lnet/minecraft/class_1703;field_17285:Ljava/util/List;named propertiesLnet/minecraft/screen/ScreenHandler;properties:Ljava/util/List;
-
type
- Mappings:
Namespace Name Mixin selector official eLbjr;e:Lbku;intermediary field_17493Lnet/minecraft/class_1703;field_17493:Lnet/minecraft/class_3917;named typeLnet/minecraft/screen/ScreenHandler;type:Lnet/minecraft/screen/ScreenHandlerType;
-
syncId
public final int syncId- Mappings:
Namespace Name Mixin selector official bLbjr;b:Iintermediary field_7763Lnet/minecraft/class_1703;field_7763:Inamed syncIdLnet/minecraft/screen/ScreenHandler;syncId:I
-
actionId
- Mappings:
Namespace Name Mixin selector official fLbjr;f:Sintermediary field_7758Lnet/minecraft/class_1703;field_7758:Snamed actionIdLnet/minecraft/screen/ScreenHandler;actionId:S
-
quickCraftButton
private int quickCraftButton- Mappings:
Namespace Name Mixin selector official gLbjr;g:Iintermediary field_7762Lnet/minecraft/class_1703;field_7762:Inamed quickCraftButtonLnet/minecraft/screen/ScreenHandler;quickCraftButton:I
-
quickCraftStage
private int quickCraftStage- Mappings:
Namespace Name Mixin selector official hLbjr;h:Iintermediary field_7759Lnet/minecraft/class_1703;field_7759:Inamed quickCraftStageLnet/minecraft/screen/ScreenHandler;quickCraftStage:I
-
quickCraftSlots
- Mappings:
Namespace Name Mixin selector official iLbjr;i:Ljava/util/Set;intermediary field_7757Lnet/minecraft/class_1703;field_7757:Ljava/util/Set;named quickCraftSlotsLnet/minecraft/screen/ScreenHandler;quickCraftSlots:Ljava/util/Set;
-
listeners
- Mappings:
Namespace Name Mixin selector official jLbjr;j:Ljava/util/List;intermediary field_7765Lnet/minecraft/class_1703;field_7765:Ljava/util/List;named listenersLnet/minecraft/screen/ScreenHandler;listeners:Ljava/util/List;
-
restrictedPlayers
- Mappings:
Namespace Name Mixin selector official kLbjr;k:Ljava/util/Set;intermediary field_7760Lnet/minecraft/class_1703;field_7760:Ljava/util/Set;named restrictedPlayersLnet/minecraft/screen/ScreenHandler;restrictedPlayers:Ljava/util/Set;
-
-
Constructor Details
-
ScreenHandler
- Mappings:
Namespace Name Mixin selector official <init>Lbjr;<init>(Lbku;I)Vintermediary <init>Lnet/minecraft/class_1703;<init>(Lnet/minecraft/class_3917;I)Vnamed <init>Lnet/minecraft/screen/ScreenHandler;<init>(Lnet/minecraft/screen/ScreenHandlerType;I)V
-
-
Method Details
-
canUse
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbkc;Lbhl;Lbwu;)Zintermediary method_17695Lnet/minecraft/class_1703;method_17695(Lnet/minecraft/class_3914;Lnet/minecraft/class_1657;Lnet/minecraft/class_2248;)Znamed canUseLnet/minecraft/screen/ScreenHandler;canUse(Lnet/minecraft/screen/ScreenHandlerContext;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/block/Block;)Z
-
getType
- Mappings:
Namespace Name Mixin selector official aLbjr;a()Lbku;intermediary method_17358Lnet/minecraft/class_1703;method_17358()Lnet/minecraft/class_3917;named getTypeLnet/minecraft/screen/ScreenHandler;getType()Lnet/minecraft/screen/ScreenHandlerType;
-
checkSize
Checks that the size of the provided inventory is at least as large as theexpectedSize.- Throws:
IllegalArgumentException- if the inventory size is smaller thanexpectedSize- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lapj;I)Vintermediary method_17359Lnet/minecraft/class_1703;method_17359(Lnet/minecraft/class_1263;I)Vnamed checkSizeLnet/minecraft/screen/ScreenHandler;checkSize(Lnet/minecraft/inventory/Inventory;I)V
-
checkDataCount
Checks that the size of thedatais at least as large as theexpectedCount.- Throws:
IllegalArgumentException- if thedatahas a smaller size thanexpectedCount- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbkb;I)Vintermediary method_17361Lnet/minecraft/class_1703;method_17361(Lnet/minecraft/class_3913;I)Vnamed checkDataCountLnet/minecraft/screen/ScreenHandler;checkDataCount(Lnet/minecraft/screen/PropertyDelegate;I)V
-
addSlot
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lblh;)Lblh;intermediary method_7621Lnet/minecraft/class_1703;method_7621(Lnet/minecraft/class_1735;)Lnet/minecraft/class_1735;named addSlotLnet/minecraft/screen/ScreenHandler;addSlot(Lnet/minecraft/screen/slot/Slot;)Lnet/minecraft/screen/slot/Slot;
-
addProperty
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbkg;)Lbkg;intermediary method_17362Lnet/minecraft/class_1703;method_17362(Lnet/minecraft/class_3915;)Lnet/minecraft/class_3915;named addPropertyLnet/minecraft/screen/ScreenHandler;addProperty(Lnet/minecraft/screen/Property;)Lnet/minecraft/screen/Property;
-
addProperties
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbkb;)Vintermediary method_17360Lnet/minecraft/class_1703;method_17360(Lnet/minecraft/class_3913;)Vnamed addPropertiesLnet/minecraft/screen/ScreenHandler;addProperties(Lnet/minecraft/screen/PropertyDelegate;)V
-
addListener
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbkd;)Vintermediary method_7596Lnet/minecraft/class_1703;method_7596(Lnet/minecraft/class_1712;)Vnamed addListenerLnet/minecraft/screen/ScreenHandler;addListener(Lnet/minecraft/screen/ScreenHandlerListener;)V
-
removeListener
- Mappings:
Namespace Name Mixin selector official bLbjr;b(Lbkd;)Vintermediary method_7603Lnet/minecraft/class_1703;method_7603(Lnet/minecraft/class_1712;)Vnamed removeListenerLnet/minecraft/screen/ScreenHandler;removeListener(Lnet/minecraft/screen/ScreenHandlerListener;)V
-
getStacks
- Mappings:
Namespace Name Mixin selector official bLbjr;b()Lgj;intermediary method_7602Lnet/minecraft/class_1703;method_7602()Lnet/minecraft/class_2371;named getStacksLnet/minecraft/screen/ScreenHandler;getStacks()Lnet/minecraft/util/collection/DefaultedList;
-
sendContentUpdates
public void sendContentUpdates()Sends updates to listeners if any properties or slot stacks have changed.- Mappings:
Namespace Name Mixin selector official cLbjr;c()Vintermediary method_7623Lnet/minecraft/class_1703;method_7623()Vnamed sendContentUpdatesLnet/minecraft/screen/ScreenHandler;sendContentUpdates()V
-
onButtonClick
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbhl;I)Zintermediary method_7604Lnet/minecraft/class_1703;method_7604(Lnet/minecraft/class_1657;I)Znamed onButtonClickLnet/minecraft/screen/ScreenHandler;onButtonClick(Lnet/minecraft/entity/player/PlayerEntity;I)Z
-
getSlot
- Mappings:
Namespace Name Mixin selector official aLbjr;a(I)Lblh;intermediary method_7611Lnet/minecraft/class_1703;method_7611(I)Lnet/minecraft/class_1735;named getSlotLnet/minecraft/screen/ScreenHandler;getSlot(I)Lnet/minecraft/screen/slot/Slot;
-
transferSlot
- Mappings:
Namespace Name Mixin selector official bLbjr;b(Lbhl;I)Lbnv;intermediary method_7601Lnet/minecraft/class_1703;method_7601(Lnet/minecraft/class_1657;I)Lnet/minecraft/class_1799;named transferSlotLnet/minecraft/screen/ScreenHandler;transferSlot(Lnet/minecraft/entity/player/PlayerEntity;I)Lnet/minecraft/item/ItemStack;
-
onSlotClick
public ItemStack onSlotClick(int slotIndex, int clickData, SlotActionType actionType, PlayerEntity player)Performs a slot click. This can behave in many different ways depending mainly on the action type.- Parameters:
actionType- The type of slot click. Check the docs for each SlotActionType value for details- Returns:
- The stack that was clicked on before anything changed, used mostly for verifying that the client and server are in sync
- Mappings:
Namespace Name Mixin selector official aLbjr;a(IILbka;Lbhl;)Lbnv;intermediary method_7593Lnet/minecraft/class_1703;method_7593(IILnet/minecraft/class_1713;Lnet/minecraft/class_1657;)Lnet/minecraft/class_1799;named onSlotClickLnet/minecraft/screen/ScreenHandler;onSlotClick(IILnet/minecraft/screen/slot/SlotActionType;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
-
internalOnSlotClick
private ItemStack internalOnSlotClick(int slotIndex, int clickData, SlotActionType actionType, PlayerEntity player)The actual logic that handles a slot click. Called by(int, int, SlotActionType, PlayerEntity)in a try-catch block that wraps exceptions from this method into a crash report.- Mappings:
Namespace Name Mixin selector official bLbjr;b(IILbka;Lbhl;)Lbnv;intermediary method_30010Lnet/minecraft/class_1703;method_30010(IILnet/minecraft/class_1713;Lnet/minecraft/class_1657;)Lnet/minecraft/class_1799;named internalOnSlotClickLnet/minecraft/screen/ScreenHandler;internalOnSlotClick(IILnet/minecraft/screen/slot/SlotActionType;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
-
canInsertIntoSlot
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbnv;Lblh;)Zintermediary method_7613Lnet/minecraft/class_1703;method_7613(Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;)Znamed canInsertIntoSlotLnet/minecraft/screen/ScreenHandler;canInsertIntoSlot(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;)Z
-
close
- Mappings:
Namespace Name Mixin selector official bLbjr;b(Lbhl;)Vintermediary method_7595Lnet/minecraft/class_1703;method_7595(Lnet/minecraft/class_1657;)Vnamed closeLnet/minecraft/screen/ScreenHandler;close(Lnet/minecraft/entity/player/PlayerEntity;)V
-
dropInventory
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbhl;Lapj;)Vintermediary method_7607Lnet/minecraft/class_1703;method_7607(Lnet/minecraft/class_1657;Lnet/minecraft/class_1263;)Vnamed dropInventoryLnet/minecraft/screen/ScreenHandler;dropInventory(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/inventory/Inventory;)V
-
onContentChanged
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lapj;)Vintermediary method_7609Lnet/minecraft/class_1703;method_7609(Lnet/minecraft/class_1263;)Vnamed onContentChangedLnet/minecraft/screen/ScreenHandler;onContentChanged(Lnet/minecraft/inventory/Inventory;)V
-
setStackInSlot
- Mappings:
Namespace Name Mixin selector official aLbjr;a(ILbnv;)Vintermediary method_7619Lnet/minecraft/class_1703;method_7619(ILnet/minecraft/class_1799;)Vnamed setStackInSlotLnet/minecraft/screen/ScreenHandler;setStackInSlot(ILnet/minecraft/item/ItemStack;)V
-
updateSlotStacks
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Ljava/util/List;)Vintermediary method_7610Lnet/minecraft/class_1703;method_7610(Ljava/util/List;)Vnamed updateSlotStacksLnet/minecraft/screen/ScreenHandler;updateSlotStacks(Ljava/util/List;)V
-
setProperty
public void setProperty(int id, int value)- Mappings:
Namespace Name Mixin selector official aLbjr;a(II)Vintermediary method_7606Lnet/minecraft/class_1703;method_7606(II)Vnamed setPropertyLnet/minecraft/screen/ScreenHandler;setProperty(II)V
-
getNextActionId
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbhk;)Sintermediary method_7614Lnet/minecraft/class_1703;method_7614(Lnet/minecraft/class_1661;)Snamed getNextActionIdLnet/minecraft/screen/ScreenHandler;getNextActionId(Lnet/minecraft/entity/player/PlayerInventory;)S
-
isNotRestricted
- Mappings:
Namespace Name Mixin selector official cLbjr;c(Lbhl;)Zintermediary method_7622Lnet/minecraft/class_1703;method_7622(Lnet/minecraft/class_1657;)Znamed isNotRestrictedLnet/minecraft/screen/ScreenHandler;isNotRestricted(Lnet/minecraft/entity/player/PlayerEntity;)Z
-
setPlayerRestriction
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbhl;Z)Vintermediary method_7590Lnet/minecraft/class_1703;method_7590(Lnet/minecraft/class_1657;Z)Vnamed setPlayerRestrictionLnet/minecraft/screen/ScreenHandler;setPlayerRestriction(Lnet/minecraft/entity/player/PlayerEntity;Z)V
-
canUse
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbhl;)Zintermediary method_7597Lnet/minecraft/class_1703;method_7597(Lnet/minecraft/class_1657;)Znamed canUseLnet/minecraft/screen/ScreenHandler;canUse(Lnet/minecraft/entity/player/PlayerEntity;)Z
-
insertItem
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lbnv;IIZ)Zintermediary method_7616Lnet/minecraft/class_1703;method_7616(Lnet/minecraft/class_1799;IIZ)Znamed insertItemLnet/minecraft/screen/ScreenHandler;insertItem(Lnet/minecraft/item/ItemStack;IIZ)Z
-
unpackQuickCraftButton
public static int unpackQuickCraftButton(int quickCraftData)- Mappings:
Namespace Name Mixin selector official bLbjr;b(I)Iintermediary method_7620Lnet/minecraft/class_1703;method_7620(I)Inamed unpackQuickCraftButtonLnet/minecraft/screen/ScreenHandler;unpackQuickCraftButton(I)I
-
unpackQuickCraftStage
public static int unpackQuickCraftStage(int quickCraftData)- Mappings:
Namespace Name Mixin selector official cLbjr;c(I)Iintermediary method_7594Lnet/minecraft/class_1703;method_7594(I)Inamed unpackQuickCraftStageLnet/minecraft/screen/ScreenHandler;unpackQuickCraftStage(I)I
-
packQuickCraftData
- Mappings:
Namespace Name Mixin selector official bLbjr;b(II)Iintermediary method_7591Lnet/minecraft/class_1703;method_7591(II)Inamed packQuickCraftDataLnet/minecraft/screen/ScreenHandler;packQuickCraftData(II)I
-
shouldQuickCraftContinue
- Mappings:
Namespace Name Mixin selector official aLbjr;a(ILbhl;)Zintermediary method_7600Lnet/minecraft/class_1703;method_7600(ILnet/minecraft/class_1657;)Znamed shouldQuickCraftContinueLnet/minecraft/screen/ScreenHandler;shouldQuickCraftContinue(ILnet/minecraft/entity/player/PlayerEntity;)Z
-
endQuickCraft
protected void endQuickCraft()- Mappings:
Namespace Name Mixin selector official dLbjr;d()Vintermediary method_7605Lnet/minecraft/class_1703;method_7605()Vnamed endQuickCraftLnet/minecraft/screen/ScreenHandler;endQuickCraft()V
-
canInsertItemIntoSlot
public static boolean canInsertItemIntoSlot(@Nullable Slot slot, ItemStack stack, boolean allowOverflow)- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lblh;Lbnv;Z)Zintermediary method_7592Lnet/minecraft/class_1703;method_7592(Lnet/minecraft/class_1735;Lnet/minecraft/class_1799;Z)Znamed canInsertItemIntoSlotLnet/minecraft/screen/ScreenHandler;canInsertItemIntoSlot(Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/item/ItemStack;Z)Z
-
calculateStackSize
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Ljava/util/Set;ILbnv;I)Vintermediary method_7617Lnet/minecraft/class_1703;method_7617(Ljava/util/Set;ILnet/minecraft/class_1799;I)Vnamed calculateStackSizeLnet/minecraft/screen/ScreenHandler;calculateStackSize(Ljava/util/Set;ILnet/minecraft/item/ItemStack;I)V
-
canInsertIntoSlot
- Mappings:
Namespace Name Mixin selector official bLbjr;b(Lblh;)Zintermediary method_7615Lnet/minecraft/class_1703;method_7615(Lnet/minecraft/class_1735;)Znamed canInsertIntoSlotLnet/minecraft/screen/ScreenHandler;canInsertIntoSlot(Lnet/minecraft/screen/slot/Slot;)Z
-
calculateComparatorOutput
- Mappings:
Namespace Name Mixin selector official aLbjr;a(Lcfr;)Iintermediary method_7608Lnet/minecraft/class_1703;method_7608(Lnet/minecraft/class_2586;)Inamed calculateComparatorOutputLnet/minecraft/screen/ScreenHandler;calculateComparatorOutput(Lnet/minecraft/block/entity/BlockEntity;)I
-
calculateComparatorOutput
- Mappings:
Namespace Name Mixin selector official bLbjr;b(Lapj;)Iintermediary method_7618Lnet/minecraft/class_1703;method_7618(Lnet/minecraft/class_1263;)Inamed calculateComparatorOutputLnet/minecraft/screen/ScreenHandler;calculateComparatorOutput(Lnet/minecraft/inventory/Inventory;)I
-