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
,CrafterSlot
,CreativeModeInventoryScreen.CustomCreativeSlot
,CreativeModeInventoryScreen.SlotWrapper
,FurnaceFuelSlot
,FurnaceResultSlot
,MerchantResultSlot
,NonInteractiveResultSlot
,ResultSlot
,ShulkerBoxSlot
,SlotItemHandler
-
Field Summary
Modifier and TypeFieldDescriptionprivate com.mojang.datafixers.util.Pair
<ResourceLocation, ResourceLocation> final Container
int
private final int
final int
final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
allowModification
(Player p_150652_) protected void
checkTakeAchievements
(ItemStack p_40239_) int
getItem()
int
int
getMaxStackSize
(ItemStack p_40238_) com.mojang.datafixers.util.Pair
<ResourceLocation, ResourceLocation> int
Retrieves the index in the inventory for this slot, this value should typically not be used, but can be useful for some occasions.boolean
hasItem()
boolean
isActive()
boolean
isFake()
boolean
boolean
isSameInventory
(Slot other) Checks if the other slot is in the same inventory, by comparing the inventory reference.boolean
boolean
protected void
onQuickCraft
(ItemStack p_40232_, int p_40233_) void
onQuickCraft
(ItemStack p_40235_, ItemStack p_40236_) protected void
onSwapCraft
(int p_40237_) void
remove
(int p_40227_) safeInsert
(ItemStack p_150660_) safeInsert
(ItemStack p_150657_, int p_150658_) void
setBackground
(ResourceLocation atlas, ResourceLocation sprite) Sets the background atlas and sprite location.void
setByPlayer
(ItemStack p_270152_) void
setByPlayer
(ItemStack p_299954_, ItemStack p_301385_) void
-
Field Details
-
slot
private final int slot -
container
-
index
public int index -
x
public final int x -
y
public final int y -
backgroundPair
-
-
Constructor Details
-
Slot
-
-
Method Details
-
onQuickCraft
-
onQuickCraft
-
onSwapCraft
protected void onSwapCraft(int p_40237_) -
checkTakeAchievements
-
onTake
-
mayPlace
-
getItem
-
hasItem
public boolean hasItem() -
setByPlayer
-
setByPlayer
-
set
-
setChanged
public void setChanged() -
getMaxStackSize
public int getMaxStackSize() -
getMaxStackSize
-
getNoItemIcon
-
remove
-
mayPickup
-
isActive
public boolean isActive() -
tryRemove
-
safeTake
-
safeInsert
-
safeInsert
-
allowModification
-
getContainerSlot
public int getContainerSlot() -
isHighlightable
public boolean isHighlightable() -
isFake
public boolean isFake() -
getSlotIndex
public 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.
-
isSameInventory
Checks 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
-
setBackground
Sets the background atlas and sprite location.- Parameters:
atlas
- The atlas namesprite
- The sprite located on that atlas.- Returns:
- this, to allow chaining.
-