mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-26 06:52:58 +00:00
40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
package tconstruct.armor.inventory;
|
|
|
|
import net.minecraft.inventory.IInventory;
|
|
import net.minecraft.inventory.Slot;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import tconstruct.library.accessory.IHealthAccessory;
|
|
|
|
public class SlotCanister extends Slot
|
|
{
|
|
private final int slotID;
|
|
|
|
public SlotCanister(IInventory par2IInventory, int par3, int par4, int par5)
|
|
{
|
|
super(par2IInventory, par3, par4, par5);
|
|
this.slotID = par3;
|
|
}
|
|
|
|
/**
|
|
* Returns the maximum stack size for a given slot (usually the same as
|
|
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
|
*/
|
|
@Override
|
|
public int getSlotStackLimit ()
|
|
{
|
|
return 10;
|
|
}
|
|
|
|
/**
|
|
* Check if the stack is a valid item for this slot. Always true beside for
|
|
* the armor slots.
|
|
*/
|
|
@Override
|
|
public boolean isItemValid (ItemStack par1ItemStack)
|
|
{
|
|
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
|
return item != null && (item instanceof IHealthAccessory) && ((IHealthAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
|
|
|
}
|
|
} |