Class Slot
java.lang.Object
net.minecraft.world.inventory.Slot
- Direct Known Subclasses:
ArmorSlot, BeaconMenu.PaymentSlot, BrewingStandMenu.FuelSlot, BrewingStandMenu.IngredientsSlot, BrewingStandMenu.PotionSlot, CrafterSlot, CreativeModeInventoryScreen.CustomCreativeSlot, CreativeModeInventoryScreen.SlotWrapper, FurnaceFuelSlot, FurnaceResultSlot, MerchantResultSlot, NonInteractiveResultSlot, ResultSlot, ShulkerBoxSlot, SlotItemHandler, StackCopySlot
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Identifierfinal Containerintprivate final intfinal intfinal int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowModification(Player player) protected voidcheckTakeAchievements(ItemStack carried) intgetItem()intintgetMaxStackSize(ItemStack itemStack) @Nullable IdentifierintRetrieves 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 picked, int count) voidonQuickCraft(ItemStack picked, ItemStack original) protected voidonSwapCraft(int count) voidremove(int amount) safeInsert(ItemStack stack) safeInsert(ItemStack inputStack, int inputAmount) voidsetBackground(Identifier sprite) Sets the background atlas and sprite location.voidsetByPlayer(ItemStack itemStack) voidsetByPlayer(ItemStack itemStack, ItemStack previous) void
-
Field Details
-
slot
private final int slot -
container
-
index
public int index -
x
public final int x -
y
public final int y -
backgroundSprite
-
-
Constructor Details
-
Slot
-
-
Method Details
-
onQuickCraft
-
onQuickCraft
-
onSwapCraft
protected void onSwapCraft(int count) -
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:
sprite- 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()
-