Class Slot
- java.lang.Object
-
- net.minecraft.inventory.container.Slot
-
- Direct Known Subclasses:
BeaconContainer.BeaconSlot,BrewingStandContainer.FuelSlot,BrewingStandContainer.IngredientSlot,BrewingStandContainer.PotionSlot,CraftingResultSlot,CreativeScreen.CreativeSlot,CreativeScreen.LockedSlot,FurnaceFuelSlot,FurnaceResultSlot,MerchantResultSlot,ShulkerBoxSlot,SlotItemHandler
public class Slot extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation>backgroundPairIInventorycontainerintindexprivate intslotintxinty
-
Constructor Summary
Constructors Constructor Description Slot(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckTakeAchievements(ItemStack p_75208_1_)ItemStackgetItem()intgetMaxStackSize()intgetMaxStackSize(ItemStack p_178170_1_)com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation>getNoItemIcon()intgetSlotIndex()Retrieves 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.booleanmayPickup(PlayerEntity p_82869_1_)booleanmayPlace(ItemStack p_75214_1_)protected voidonQuickCraft(ItemStack p_75210_1_, int p_75210_2_)voidonQuickCraft(ItemStack p_75220_1_, ItemStack p_75220_2_)protected voidonSwapCraft(int p_190900_1_)ItemStackonTake(PlayerEntity p_190901_1_, ItemStack p_190901_2_)ItemStackremove(int p_75209_1_)voidset(ItemStack p_75215_1_)SlotsetBackground(ResourceLocation atlas, ResourceLocation sprite)Sets the background atlas and sprite location.voidsetChanged()
-
-
-
Field Detail
-
slot
private final int slot
-
container
public final IInventory container
-
index
public int index
-
x
public final int x
-
y
public final int y
-
backgroundPair
private com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> backgroundPair
-
-
Constructor Detail
-
Slot
public Slot(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_)
-
-
Method Detail
-
onQuickCraft
protected void onQuickCraft(ItemStack p_75210_1_, int p_75210_2_)
-
onSwapCraft
protected void onSwapCraft(int p_190900_1_)
-
checkTakeAchievements
protected void checkTakeAchievements(ItemStack p_75208_1_)
-
onTake
public ItemStack onTake(PlayerEntity p_190901_1_, ItemStack p_190901_2_)
-
mayPlace
public boolean mayPlace(ItemStack p_75214_1_)
-
getItem
public ItemStack getItem()
-
hasItem
public boolean hasItem()
-
set
public void set(ItemStack p_75215_1_)
-
setChanged
public void setChanged()
-
getMaxStackSize
public int getMaxStackSize()
-
getMaxStackSize
public int getMaxStackSize(ItemStack p_178170_1_)
-
getNoItemIcon
@Nullable public com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> getNoItemIcon()
-
remove
public ItemStack remove(int p_75209_1_)
-
mayPickup
public boolean mayPickup(PlayerEntity p_82869_1_)
-
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
public boolean isSameInventory(Slot other)
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
public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite)
Sets the background atlas and sprite location.- Parameters:
atlas- The atlas namesprite- The sprite located on that atlas.- Returns:
- this, to allow chaining.
-
-