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
FieldsModifier and TypeFieldDescriptionprivate com.mojang.datafixers.util.Pair<ResourceLocation, ResourceLocation> final Containerintprivate final intfinal intfinal int -
Constructor Summary
Constructors -
Method Summary
Modifier 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()booleanisFake()booleanbooleanisSameInventory(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.voidsetByPlayer(ItemStack p_270152_) voidsetByPlayer(ItemStack p_299990_, ItemStack p_299965_) 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() -
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.
-
tryRemove
-
safeTake
-
safeInsert
-
safeInsert
-
allowModification
-
getContainerSlot
public int getContainerSlot() -
isHighlightable
public boolean isHighlightable() -
isFake
public boolean isFake()
-