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 bjr
intermediary net/minecraft/class_1703
named net/minecraft/screen/ScreenHandler
-
Field Summary
Fields Modifier and Type Field Description private short
actionId
private List<ScreenHandlerListener>
listeners
private List<Property>
properties
private int
quickCraftButton
private Set<Slot>
quickCraftSlots
private int
quickCraftStage
private Set<PlayerEntity>
restrictedPlayers
DefaultedList<Slot>
slots
int
syncId
private DefaultedList<ItemStack>
trackedStacks
A list of item stacks that is used for tracking changes insendContentUpdates()
.private ScreenHandlerType<?>
type
-
Constructor Summary
Constructors Modifier Constructor Description protected
ScreenHandler(ScreenHandlerType<?> type, int syncId)
-
Method Summary
Modifier and Type Method Description void
addListener(ScreenHandlerListener listener)
protected void
addProperties(PropertyDelegate propertyDelegate)
protected Property
addProperty(Property property)
protected Slot
addSlot(Slot slot)
static int
calculateComparatorOutput(BlockEntity entity)
static int
calculateComparatorOutput(Inventory inventory)
static void
calculateStackSize(Set<Slot> slots, int mode, ItemStack stack, int stackSize)
boolean
canInsertIntoSlot(ItemStack stack, Slot slot)
boolean
canInsertIntoSlot(Slot slot)
static boolean
canInsertItemIntoSlot(Slot slot, ItemStack stack, boolean allowOverflow)
abstract boolean
canUse(PlayerEntity player)
protected static boolean
canUse(ScreenHandlerContext context, PlayerEntity player, Block block)
protected static void
checkDataCount(PropertyDelegate data, int expectedCount)
Checks that the size of thedata
is at least as large as theexpectedCount
.protected static void
checkSize(Inventory inventory, int expectedSize)
Checks that the size of the provided inventory is at least as large as theexpectedSize
.void
close(PlayerEntity player)
protected void
dropInventory(PlayerEntity player, Inventory inventory)
protected void
endQuickCraft()
short
getNextActionId(PlayerInventory playerInventory)
Slot
getSlot(int index)
DefaultedList<ItemStack>
getStacks()
ScreenHandlerType<?>
getType()
protected boolean
insertItem(ItemStack stack, int startIndex, int endIndex, boolean fromLast)
boolean
isNotRestricted(PlayerEntity player)
boolean
onButtonClick(PlayerEntity player, int id)
void
onContentChanged(Inventory inventory)
ItemStack
onSlotClick(int slotIndex, int clickData, SlotActionType actionType, PlayerEntity player)
Performs a slot click.static int
packQuickCraftData(int quickCraftStage, int buttonId)
void
removeListener(ScreenHandlerListener listener)
private ItemStack
removeStack(int slotIndex, int clickData, SlotActionType actionType, PlayerEntity player)
void
sendContentUpdates()
Sends updates to listeners if any properties or slot stacks have changed.void
setPlayerRestriction(PlayerEntity player, boolean unrestricted)
void
setProperty(int id, int value)
void
setStackInSlot(int slot, ItemStack stack)
static boolean
shouldQuickCraftContinue(int stage, PlayerEntity player)
ItemStack
transferSlot(PlayerEntity player, int index)
static int
unpackQuickCraftButton(int quickCraftData)
static int
unpackQuickCraftStage(int quickCraftData)
void
updateSlotStacks(List<ItemStack> stacks)
-
Field Details
-
trackedStacks
A list of item stacks that is used for tracking changes insendContentUpdates()
.- Mappings:
Namespace Name Mixin selector official c
Lbjr;c:Lgj;
intermediary field_7764
Lnet/minecraft/class_1703;field_7764:Lnet/minecraft/class_2371;
named trackedStacks
Lnet/minecraft/screen/ScreenHandler;trackedStacks:Lnet/minecraft/util/collection/DefaultedList;
-
slots
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a:Lgj;
intermediary field_7761
Lnet/minecraft/class_1703;field_7761:Lnet/minecraft/class_2371;
named slots
Lnet/minecraft/screen/ScreenHandler;slots:Lnet/minecraft/util/collection/DefaultedList;
-
properties
- Mappings:
Namespace Name Mixin selector official d
Lbjr;d:Ljava/util/List;
intermediary field_17285
Lnet/minecraft/class_1703;field_17285:Ljava/util/List;
named properties
Lnet/minecraft/screen/ScreenHandler;properties:Ljava/util/List;
-
type
- Mappings:
Namespace Name Mixin selector official e
Lbjr;e:Lbku;
intermediary field_17493
Lnet/minecraft/class_1703;field_17493:Lnet/minecraft/class_3917;
named type
Lnet/minecraft/screen/ScreenHandler;type:Lnet/minecraft/screen/ScreenHandlerType;
-
syncId
public final int syncId- Mappings:
Namespace Name Mixin selector official b
Lbjr;b:I
intermediary field_7763
Lnet/minecraft/class_1703;field_7763:I
named syncId
Lnet/minecraft/screen/ScreenHandler;syncId:I
-
actionId
- Mappings:
Namespace Name Mixin selector official f
Lbjr;f:S
intermediary field_7758
Lnet/minecraft/class_1703;field_7758:S
named actionId
Lnet/minecraft/screen/ScreenHandler;actionId:S
-
quickCraftButton
private int quickCraftButton- Mappings:
Namespace Name Mixin selector official g
Lbjr;g:I
intermediary field_7762
Lnet/minecraft/class_1703;field_7762:I
named quickCraftButton
Lnet/minecraft/screen/ScreenHandler;quickCraftButton:I
-
quickCraftStage
private int quickCraftStage- Mappings:
Namespace Name Mixin selector official h
Lbjr;h:I
intermediary field_7759
Lnet/minecraft/class_1703;field_7759:I
named quickCraftStage
Lnet/minecraft/screen/ScreenHandler;quickCraftStage:I
-
quickCraftSlots
- Mappings:
Namespace Name Mixin selector official i
Lbjr;i:Ljava/util/Set;
intermediary field_7757
Lnet/minecraft/class_1703;field_7757:Ljava/util/Set;
named quickCraftSlots
Lnet/minecraft/screen/ScreenHandler;quickCraftSlots:Ljava/util/Set;
-
listeners
- Mappings:
Namespace Name Mixin selector official j
Lbjr;j:Ljava/util/List;
intermediary field_7765
Lnet/minecraft/class_1703;field_7765:Ljava/util/List;
named listeners
Lnet/minecraft/screen/ScreenHandler;listeners:Ljava/util/List;
-
restrictedPlayers
- Mappings:
Namespace Name Mixin selector official k
Lbjr;k:Ljava/util/Set;
intermediary field_7760
Lnet/minecraft/class_1703;field_7760:Ljava/util/Set;
named restrictedPlayers
Lnet/minecraft/screen/ScreenHandler;restrictedPlayers:Ljava/util/Set;
-
-
Constructor Details
-
ScreenHandler
- Mappings:
Namespace Name Mixin selector official <init>
Lbjr;<init>(Lbku;I)V
intermediary <init>
Lnet/minecraft/class_1703;<init>(Lnet/minecraft/class_3917;I)V
named <init>
Lnet/minecraft/screen/ScreenHandler;<init>(Lnet/minecraft/screen/ScreenHandlerType;I)V
-
-
Method Details
-
canUse
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbkc;Lbhl;Lbwu;)Z
intermediary method_17695
Lnet/minecraft/class_1703;method_17695(Lnet/minecraft/class_3914;Lnet/minecraft/class_1657;Lnet/minecraft/class_2248;)Z
named canUse
Lnet/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 a
Lbjr;a()Lbku;
intermediary method_17358
Lnet/minecraft/class_1703;method_17358()Lnet/minecraft/class_3917;
named getType
Lnet/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 a
Lbjr;a(Lapj;I)V
intermediary method_17359
Lnet/minecraft/class_1703;method_17359(Lnet/minecraft/class_1263;I)V
named checkSize
Lnet/minecraft/screen/ScreenHandler;checkSize(Lnet/minecraft/inventory/Inventory;I)V
-
checkDataCount
Checks that the size of thedata
is at least as large as theexpectedCount
.- Throws:
IllegalArgumentException
- if thedata
has a smaller size thanexpectedCount
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbkb;I)V
intermediary method_17361
Lnet/minecraft/class_1703;method_17361(Lnet/minecraft/class_3913;I)V
named checkDataCount
Lnet/minecraft/screen/ScreenHandler;checkDataCount(Lnet/minecraft/screen/PropertyDelegate;I)V
-
addSlot
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lblh;)Lblh;
intermediary method_7621
Lnet/minecraft/class_1703;method_7621(Lnet/minecraft/class_1735;)Lnet/minecraft/class_1735;
named addSlot
Lnet/minecraft/screen/ScreenHandler;addSlot(Lnet/minecraft/screen/slot/Slot;)Lnet/minecraft/screen/slot/Slot;
-
addProperty
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbkg;)Lbkg;
intermediary method_17362
Lnet/minecraft/class_1703;method_17362(Lnet/minecraft/class_3915;)Lnet/minecraft/class_3915;
named addProperty
Lnet/minecraft/screen/ScreenHandler;addProperty(Lnet/minecraft/screen/Property;)Lnet/minecraft/screen/Property;
-
addProperties
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbkb;)V
intermediary method_17360
Lnet/minecraft/class_1703;method_17360(Lnet/minecraft/class_3913;)V
named addProperties
Lnet/minecraft/screen/ScreenHandler;addProperties(Lnet/minecraft/screen/PropertyDelegate;)V
-
addListener
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbkd;)V
intermediary method_7596
Lnet/minecraft/class_1703;method_7596(Lnet/minecraft/class_1712;)V
named addListener
Lnet/minecraft/screen/ScreenHandler;addListener(Lnet/minecraft/screen/ScreenHandlerListener;)V
-
removeListener
- Mappings:
Namespace Name Mixin selector official b
Lbjr;b(Lbkd;)V
intermediary method_7603
Lnet/minecraft/class_1703;method_7603(Lnet/minecraft/class_1712;)V
named removeListener
Lnet/minecraft/screen/ScreenHandler;removeListener(Lnet/minecraft/screen/ScreenHandlerListener;)V
-
getStacks
- Mappings:
Namespace Name Mixin selector official b
Lbjr;b()Lgj;
intermediary method_7602
Lnet/minecraft/class_1703;method_7602()Lnet/minecraft/class_2371;
named getStacks
Lnet/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 c
Lbjr;c()V
intermediary method_7623
Lnet/minecraft/class_1703;method_7623()V
named sendContentUpdates
Lnet/minecraft/screen/ScreenHandler;sendContentUpdates()V
-
onButtonClick
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbhl;I)Z
intermediary method_7604
Lnet/minecraft/class_1703;method_7604(Lnet/minecraft/class_1657;I)Z
named onButtonClick
Lnet/minecraft/screen/ScreenHandler;onButtonClick(Lnet/minecraft/entity/player/PlayerEntity;I)Z
-
getSlot
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(I)Lblh;
intermediary method_7611
Lnet/minecraft/class_1703;method_7611(I)Lnet/minecraft/class_1735;
named getSlot
Lnet/minecraft/screen/ScreenHandler;getSlot(I)Lnet/minecraft/screen/slot/Slot;
-
transferSlot
- Mappings:
Namespace Name Mixin selector official b
Lbjr;b(Lbhl;I)Lbnv;
intermediary method_7601
Lnet/minecraft/class_1703;method_7601(Lnet/minecraft/class_1657;I)Lnet/minecraft/class_1799;
named transferSlot
Lnet/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 a
Lbjr;a(IILbka;Lbhl;)Lbnv;
intermediary method_7593
Lnet/minecraft/class_1703;method_7593(IILnet/minecraft/class_1713;Lnet/minecraft/class_1657;)Lnet/minecraft/class_1799;
named onSlotClick
Lnet/minecraft/screen/ScreenHandler;onSlotClick(IILnet/minecraft/screen/slot/SlotActionType;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
-
removeStack
private ItemStack removeStack(int slotIndex, int clickData, SlotActionType actionType, PlayerEntity player)- Mappings:
Namespace Name Mixin selector official b
Lbjr;b(IILbka;Lbhl;)Lbnv;
intermediary method_30010
Lnet/minecraft/class_1703;method_30010(IILnet/minecraft/class_1713;Lnet/minecraft/class_1657;)Lnet/minecraft/class_1799;
named removeStack
Lnet/minecraft/screen/ScreenHandler;removeStack(IILnet/minecraft/screen/slot/SlotActionType;Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;
-
canInsertIntoSlot
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbnv;Lblh;)Z
intermediary method_7613
Lnet/minecraft/class_1703;method_7613(Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;)Z
named canInsertIntoSlot
Lnet/minecraft/screen/ScreenHandler;canInsertIntoSlot(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;)Z
-
close
- Mappings:
Namespace Name Mixin selector official b
Lbjr;b(Lbhl;)V
intermediary method_7595
Lnet/minecraft/class_1703;method_7595(Lnet/minecraft/class_1657;)V
named close
Lnet/minecraft/screen/ScreenHandler;close(Lnet/minecraft/entity/player/PlayerEntity;)V
-
dropInventory
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbhl;Lapj;)V
intermediary method_7607
Lnet/minecraft/class_1703;method_7607(Lnet/minecraft/class_1657;Lnet/minecraft/class_1263;)V
named dropInventory
Lnet/minecraft/screen/ScreenHandler;dropInventory(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/inventory/Inventory;)V
-
onContentChanged
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lapj;)V
intermediary method_7609
Lnet/minecraft/class_1703;method_7609(Lnet/minecraft/class_1263;)V
named onContentChanged
Lnet/minecraft/screen/ScreenHandler;onContentChanged(Lnet/minecraft/inventory/Inventory;)V
-
setStackInSlot
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(ILbnv;)V
intermediary method_7619
Lnet/minecraft/class_1703;method_7619(ILnet/minecraft/class_1799;)V
named setStackInSlot
Lnet/minecraft/screen/ScreenHandler;setStackInSlot(ILnet/minecraft/item/ItemStack;)V
-
updateSlotStacks
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Ljava/util/List;)V
intermediary method_7610
Lnet/minecraft/class_1703;method_7610(Ljava/util/List;)V
named updateSlotStacks
Lnet/minecraft/screen/ScreenHandler;updateSlotStacks(Ljava/util/List;)V
-
setProperty
public void setProperty(int id, int value)- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(II)V
intermediary method_7606
Lnet/minecraft/class_1703;method_7606(II)V
named setProperty
Lnet/minecraft/screen/ScreenHandler;setProperty(II)V
-
getNextActionId
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbhk;)S
intermediary method_7614
Lnet/minecraft/class_1703;method_7614(Lnet/minecraft/class_1661;)S
named getNextActionId
Lnet/minecraft/screen/ScreenHandler;getNextActionId(Lnet/minecraft/entity/player/PlayerInventory;)S
-
isNotRestricted
- Mappings:
Namespace Name Mixin selector official c
Lbjr;c(Lbhl;)Z
intermediary method_7622
Lnet/minecraft/class_1703;method_7622(Lnet/minecraft/class_1657;)Z
named isNotRestricted
Lnet/minecraft/screen/ScreenHandler;isNotRestricted(Lnet/minecraft/entity/player/PlayerEntity;)Z
-
setPlayerRestriction
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbhl;Z)V
intermediary method_7590
Lnet/minecraft/class_1703;method_7590(Lnet/minecraft/class_1657;Z)V
named setPlayerRestriction
Lnet/minecraft/screen/ScreenHandler;setPlayerRestriction(Lnet/minecraft/entity/player/PlayerEntity;Z)V
-
canUse
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbhl;)Z
intermediary method_7597
Lnet/minecraft/class_1703;method_7597(Lnet/minecraft/class_1657;)Z
named canUse
Lnet/minecraft/screen/ScreenHandler;canUse(Lnet/minecraft/entity/player/PlayerEntity;)Z
-
insertItem
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lbnv;IIZ)Z
intermediary method_7616
Lnet/minecraft/class_1703;method_7616(Lnet/minecraft/class_1799;IIZ)Z
named insertItem
Lnet/minecraft/screen/ScreenHandler;insertItem(Lnet/minecraft/item/ItemStack;IIZ)Z
-
unpackQuickCraftButton
public static int unpackQuickCraftButton(int quickCraftData)- Mappings:
Namespace Name Mixin selector official b
Lbjr;b(I)I
intermediary method_7620
Lnet/minecraft/class_1703;method_7620(I)I
named unpackQuickCraftButton
Lnet/minecraft/screen/ScreenHandler;unpackQuickCraftButton(I)I
-
unpackQuickCraftStage
public static int unpackQuickCraftStage(int quickCraftData)- Mappings:
Namespace Name Mixin selector official c
Lbjr;c(I)I
intermediary method_7594
Lnet/minecraft/class_1703;method_7594(I)I
named unpackQuickCraftStage
Lnet/minecraft/screen/ScreenHandler;unpackQuickCraftStage(I)I
-
packQuickCraftData
- Mappings:
Namespace Name Mixin selector official b
Lbjr;b(II)I
intermediary method_7591
Lnet/minecraft/class_1703;method_7591(II)I
named packQuickCraftData
Lnet/minecraft/screen/ScreenHandler;packQuickCraftData(II)I
-
shouldQuickCraftContinue
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(ILbhl;)Z
intermediary method_7600
Lnet/minecraft/class_1703;method_7600(ILnet/minecraft/class_1657;)Z
named shouldQuickCraftContinue
Lnet/minecraft/screen/ScreenHandler;shouldQuickCraftContinue(ILnet/minecraft/entity/player/PlayerEntity;)Z
-
endQuickCraft
protected void endQuickCraft()- Mappings:
Namespace Name Mixin selector official d
Lbjr;d()V
intermediary method_7605
Lnet/minecraft/class_1703;method_7605()V
named endQuickCraft
Lnet/minecraft/screen/ScreenHandler;endQuickCraft()V
-
canInsertItemIntoSlot
public static boolean canInsertItemIntoSlot(@Nullable Slot slot, ItemStack stack, boolean allowOverflow)- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lblh;Lbnv;Z)Z
intermediary method_7592
Lnet/minecraft/class_1703;method_7592(Lnet/minecraft/class_1735;Lnet/minecraft/class_1799;Z)Z
named canInsertItemIntoSlot
Lnet/minecraft/screen/ScreenHandler;canInsertItemIntoSlot(Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/item/ItemStack;Z)Z
-
calculateStackSize
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Ljava/util/Set;ILbnv;I)V
intermediary method_7617
Lnet/minecraft/class_1703;method_7617(Ljava/util/Set;ILnet/minecraft/class_1799;I)V
named calculateStackSize
Lnet/minecraft/screen/ScreenHandler;calculateStackSize(Ljava/util/Set;ILnet/minecraft/item/ItemStack;I)V
-
canInsertIntoSlot
- Mappings:
Namespace Name Mixin selector official b
Lbjr;b(Lblh;)Z
intermediary method_7615
Lnet/minecraft/class_1703;method_7615(Lnet/minecraft/class_1735;)Z
named canInsertIntoSlot
Lnet/minecraft/screen/ScreenHandler;canInsertIntoSlot(Lnet/minecraft/screen/slot/Slot;)Z
-
calculateComparatorOutput
- Mappings:
Namespace Name Mixin selector official a
Lbjr;a(Lcfr;)I
intermediary method_7608
Lnet/minecraft/class_1703;method_7608(Lnet/minecraft/class_2586;)I
named calculateComparatorOutput
Lnet/minecraft/screen/ScreenHandler;calculateComparatorOutput(Lnet/minecraft/block/entity/BlockEntity;)I
-
calculateComparatorOutput
- Mappings:
Namespace Name Mixin selector official b
Lbjr;b(Lapj;)I
intermediary method_7618
Lnet/minecraft/class_1703;method_7618(Lnet/minecraft/class_1263;)I
named calculateComparatorOutput
Lnet/minecraft/screen/ScreenHandler;calculateComparatorOutput(Lnet/minecraft/inventory/Inventory;)I
-