public abstract class EntityEquipmentInvWrapper extends java.lang.Object implements IItemHandlerModifiable
EntityLivingBase as an IItemHandler using EntityLivingBase.getItemStackFromSlot(net.minecraft.inventory.EntityEquipmentSlot) and
EntityLivingBase.setItemStackToSlot(net.minecraft.inventory.EntityEquipmentSlot, net.minecraft.item.ItemStack).| Modifier and Type | Field and Description |
|---|---|
protected EntityLivingBase |
entity
The entity.
|
protected java.util.List<EntityEquipmentSlot> |
slots
The slots exposed by this wrapper, with
EntityEquipmentSlot.index as the index. |
| Constructor and Description |
|---|
EntityEquipmentInvWrapper(EntityLivingBase entity,
EntityEquipmentSlot.Type slotType) |
| Modifier and Type | Method and Description |
|---|---|
ItemStack |
extractItem(int slot,
int amount,
boolean simulate)
Extracts an ItemStack from the given slot.
|
int |
getSlotLimit(int slot)
Retrieves the maximum stack size allowed to exist in the given slot.
|
int |
getSlots()
Returns the number of slots available
|
ItemStack |
getStackInSlot(int slot)
Returns the ItemStack in a given slot.
|
protected int |
getStackLimit(int slot,
ItemStack stack) |
ItemStack |
insertItem(int slot,
ItemStack stack,
boolean simulate)
Inserts an ItemStack into the given slot and return the remainder.
|
void |
setStackInSlot(int slot,
ItemStack stack)
Overrides the stack in the given slot.
|
protected EntityEquipmentSlot |
validateSlotIndex(int slot) |
protected final EntityLivingBase entity
protected final java.util.List<EntityEquipmentSlot> slots
EntityEquipmentSlot.index as the index.public EntityEquipmentInvWrapper(EntityLivingBase entity, EntityEquipmentSlot.Type slotType)
entity - The entity.slotType - The slot type to expose.public int getSlots()
IItemHandlergetSlots in interface IItemHandlerpublic ItemStack getStackInSlot(int slot)
IItemHandlergetStackInSlot in interface IItemHandlerslot - Slot to querypublic ItemStack insertItem(int slot, ItemStack stack, boolean simulate)
IItemHandlerinsertItem in interface IItemHandlerslot - Slot to insert into.stack - ItemStack to insert.simulate - If true, the insertion is only simulatedpublic ItemStack extractItem(int slot, int amount, boolean simulate)
IItemHandlerextractItem in interface IItemHandlerslot - Slot to extract from.amount - Amount to extract (may be greater than the current stacks max limit)simulate - If true, the extraction is only simulatedpublic int getSlotLimit(int slot)
IItemHandlergetSlotLimit in interface IItemHandlerslot - Slot to query.protected int getStackLimit(int slot,
ItemStack stack)
public void setStackInSlot(int slot,
ItemStack stack)
IItemHandlerModifiablesetStackInSlot in interface IItemHandlerModifiableslot - Slot to modifystack - ItemStack to set slot to (may be null)protected EntityEquipmentSlot validateSlotIndex(int slot)