public class Slot
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> |
backgroundPair |
IInventory |
inventory |
private int |
slotIndex |
int |
slotNumber |
int |
xPos |
int |
yPos |
Constructor and Description |
---|
Slot(IInventory inventoryIn,
int index,
int xPosition,
int yPosition) |
Modifier and Type | Method and Description |
---|---|
boolean |
canTakeStack(PlayerEntity playerIn) |
ItemStack |
decrStackSize(int amount) |
com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> |
func_225517_c_() |
boolean |
getHasStack() |
int |
getItemStackLimit(ItemStack stack) |
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.
|
int |
getSlotStackLimit() |
ItemStack |
getStack() |
boolean |
isEnabled() |
boolean |
isItemValid(ItemStack stack) |
boolean |
isSameInventory(Slot other)
Checks if the other slot is in the same inventory, by comparing the inventory reference.
|
protected void |
onCrafting(ItemStack stack) |
protected void |
onCrafting(ItemStack stack,
int amount) |
void |
onSlotChange(ItemStack oldStackIn,
ItemStack newStackIn) |
void |
onSlotChanged() |
protected void |
onSwapCraft(int p_190900_1_) |
ItemStack |
onTake(PlayerEntity thePlayer,
ItemStack stack) |
void |
putStack(ItemStack stack) |
Slot |
setBackground(ResourceLocation atlas,
ResourceLocation sprite)
Sets the background atlas and sprite location.
|
private final int slotIndex
public final IInventory inventory
public int slotNumber
public final int xPos
public final int yPos
private com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> backgroundPair
public Slot(IInventory inventoryIn, int index, int xPosition, int yPosition)
protected void onCrafting(ItemStack stack, int amount)
protected void onSwapCraft(int p_190900_1_)
protected void onCrafting(ItemStack stack)
public ItemStack onTake(PlayerEntity thePlayer, ItemStack stack)
public boolean isItemValid(ItemStack stack)
public ItemStack getStack()
public boolean getHasStack()
public void putStack(ItemStack stack)
public void onSlotChanged()
public int getSlotStackLimit()
public int getItemStackLimit(ItemStack stack)
@Nullable public com.mojang.datafixers.util.Pair<ResourceLocation,ResourceLocation> func_225517_c_()
public ItemStack decrStackSize(int amount)
public boolean canTakeStack(PlayerEntity playerIn)
public boolean isEnabled()
public int getSlotIndex()
public boolean isSameInventory(Slot other)
other
- public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite)
atlas
- The atlas namesprite
- The sprite located on that atlas.