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>
backgroundPair
IInventory
container
int
index
private int
slot
int
x
int
y
-
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 void
checkTakeAchievements(ItemStack p_75208_1_)
ItemStack
getItem()
int
getMaxStackSize()
int
getMaxStackSize(ItemStack p_178170_1_)
com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation>
getNoItemIcon()
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.boolean
hasItem()
boolean
isActive()
boolean
isSameInventory(Slot other)
Checks if the other slot is in the same inventory, by comparing the inventory reference.boolean
mayPickup(PlayerEntity p_82869_1_)
boolean
mayPlace(ItemStack p_75214_1_)
protected void
onQuickCraft(ItemStack p_75210_1_, int p_75210_2_)
void
onQuickCraft(ItemStack p_75220_1_, ItemStack p_75220_2_)
protected void
onSwapCraft(int p_190900_1_)
ItemStack
onTake(PlayerEntity p_190901_1_, ItemStack p_190901_2_)
ItemStack
remove(int p_75209_1_)
void
set(ItemStack p_75215_1_)
Slot
setBackground(ResourceLocation atlas, ResourceLocation sprite)
Sets the background atlas and sprite location.void
setChanged()
-
-
-
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.
-
-