Package net.minecraft.world.inventory
Class Slot
java.lang.Object
net.minecraft.world.inventory.Slot
- Direct Known Subclasses:
- BeaconMenu.PaymentSlot,- BrewingStandMenu.FuelSlot,- BrewingStandMenu.IngredientsSlot,- BrewingStandMenu.PotionSlot,- CreativeModeInventoryScreen.CustomCreativeSlot,- CreativeModeInventoryScreen.SlotWrapper,- FurnaceFuelSlot,- FurnaceResultSlot,- MerchantResultSlot,- ResultSlot,- ShulkerBoxSlot,- SlotItemHandler
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> final Containerintprivate final intfinal intfinal int
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanallowModification(Player p_150652_) protected voidcheckTakeAchievements(ItemStack p_40239_) intgetItem()intintgetMaxStackSize(ItemStack p_40238_) com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> intRetrieves the index in the inventory for this slot, this value should typically not be used, but can be useful for some occasions.booleanhasItem()booleanisActive()booleanisSameInventory(Slot other) Checks if the other slot is in the same inventory, by comparing the inventory reference.booleanbooleanprotected voidonQuickCraft(ItemStack p_40232_, int p_40233_) voidonQuickCraft(ItemStack p_40235_, ItemStack p_40236_) protected voidonSwapCraft(int p_40237_) voidremove(int p_40227_) safeInsert(ItemStack p_150660_) safeInsert(ItemStack p_150657_, int p_150658_) voidsetBackground(ResourceLocation atlas, ResourceLocation sprite) Sets the background atlas and sprite location.void
- 
Field Details- 
slotprivate final int slot
- 
container
- 
indexpublic int index
- 
xpublic final int x
- 
ypublic final int y
- 
backgroundPair
 
- 
- 
Constructor Details- 
Slot
 
- 
- 
Method Details- 
onQuickCraft
- 
onQuickCraft
- 
onSwapCraftprotected void onSwapCraft(int p_40237_) 
- 
checkTakeAchievements
- 
onTake
- 
mayPlace
- 
getItem
- 
hasItempublic boolean hasItem()
- 
set
- 
setChangedpublic void setChanged()
- 
getMaxStackSizepublic int getMaxStackSize()
- 
getMaxStackSize
- 
getNoItemIcon
- 
remove
- 
mayPickup
- 
isActivepublic boolean isActive()
- 
getSlotIndexpublic int getSlotIndex()Retrieves the index in the inventory for this slot, this value should typically not be used, but can be useful for some occasions.- Returns:
- Index in associated inventory for this slot.
 
- 
isSameInventoryChecks if the other slot is in the same inventory, by comparing the inventory reference.- Parameters:
- other-
- Returns:
- true if the other slot is in the same inventory
 
- 
setBackgroundSets the background atlas and sprite location.- Parameters:
- atlas- The atlas name
- sprite- The sprite located on that atlas.
- Returns:
- this, to allow chaining.
 
- 
tryRemove
- 
safeTake
- 
safeInsert
- 
safeInsert
- 
allowModification
- 
getContainerSlotpublic int getContainerSlot()
 
-