Class EntityEquipmentInvWrapper
- All Implemented Interfaces:
IItemHandler,IItemHandlerModifiable
- Direct Known Subclasses:
EntityArmorInvWrapper,EntityHandsInvWrapper
LivingEntity as an IItemHandler using LivingEntity.getItemBySlot(EquipmentSlot) and
LivingEntity.setItemSlot(EquipmentSlot, ItemStack).-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LivingEntityDeprecated, for removal: This API element is subject to removal in a future version.The entity.protected final List<EquipmentSlot> Deprecated, for removal: This API element is subject to removal in a future version.The slots exposed by this wrapper, withEquipmentSlot.getIndex()as the index. -
Constructor Summary
ConstructorsConstructorDescriptionEntityEquipmentInvWrapper(LivingEntity entity, EquipmentSlot.Type slotType) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionextractItem(int slot, int amount, boolean simulate) Deprecated, for removal: This API element is subject to removal in a future version.Extracts an ItemStack from the given slot.intgetSlotLimit(int slot) Deprecated, for removal: This API element is subject to removal in a future version.Retrieves the maximum stack size allowed to exist in the given slot.intgetSlots()Deprecated, for removal: This API element is subject to removal in a future version.Returns the number of slots availablegetStackInSlot(int slot) Deprecated, for removal: This API element is subject to removal in a future version.Returns the ItemStack in a given slot.protected intgetStackLimit(int slot, ItemStack stack) Deprecated, for removal: This API element is subject to removal in a future version.insertItem(int slot, ItemStack stack, boolean simulate) Deprecated, for removal: This API element is subject to removal in a future version.Inserts an ItemStack into the given slot and return the remainder.booleanisItemValid(int slot, ItemStack stack) Deprecated, for removal: This API element is subject to removal in a future version.This function re-implements the vanilla functionContainer.canPlaceItem(int, ItemStack).voidsetStackInSlot(int slot, ItemStack stack) Deprecated, for removal: This API element is subject to removal in a future version.Overrides the stack in the given slot.protected EquipmentSlotvalidateSlotIndex(int slot) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
entity
Deprecated, for removal: This API element is subject to removal in a future version.The entity. -
slots
Deprecated, for removal: This API element is subject to removal in a future version.The slots exposed by this wrapper, withEquipmentSlot.getIndex()as the index.
-
-
Constructor Details
-
EntityEquipmentInvWrapper
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
entity- The entity.slotType- The slot type to expose.
-
-
Method Details
-
getSlots
public int getSlots()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IItemHandlerReturns the number of slots available- Specified by:
getSlotsin interfaceIItemHandler- Returns:
- The number of slots available
-
getStackInSlot
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IItemHandlerReturns the ItemStack in a given slot. The result's stack size may be greater than the itemstack's max size. If the result is empty, then the slot is empty.IMPORTANT: This ItemStack MUST NOT be modified. This method is not for altering an inventory's contents. Any implementers who are able to detect modification through this method should throw an exception.
SERIOUSLY: DO NOT MODIFY THE RETURNED ITEMSTACK
- Specified by:
getStackInSlotin interfaceIItemHandler- Parameters:
slot- Slot to query- Returns:
- ItemStack in given slot. Empty Itemstack if the slot is empty.
-
insertItem
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IItemHandlerInserts an ItemStack into the given slot and return the remainder. The ItemStack should not be modified in this function!
Note: This behaviour is subtly different fromIFluidHandler.fill(FluidStack, IFluidHandler.FluidAction)- Specified by:
insertItemin interfaceIItemHandler- Parameters:
slot- Slot to insert into.stack- ItemStack to insert. This must not be modified by the item handler.simulate- If true, the insertion is only simulated- Returns:
- The remaining ItemStack that was not inserted (if the entire stack is accepted, then return an empty ItemStack). May be the same as the input ItemStack if unchanged, otherwise a new ItemStack. The returned ItemStack can be safely modified after.
-
extractItem
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IItemHandlerExtracts an ItemStack from the given slot.The returned value must be empty if nothing is extracted, otherwise its stack size must be less than or equal to
amountandItemStack.getMaxStackSize().- Specified by:
extractItemin interfaceIItemHandler- Parameters:
slot- Slot to extract from.amount- Amount to extract (may be greater than the current stack's max limit)simulate- If true, the extraction is only simulated- Returns:
- ItemStack extracted from the slot, must be empty if nothing can be extracted. The returned ItemStack can be safely modified after, so item handlers should return a new or copied stack.
-
getSlotLimit
public int getSlotLimit(int slot) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IItemHandlerRetrieves the maximum stack size allowed to exist in the given slot.- Specified by:
getSlotLimitin interfaceIItemHandler- Parameters:
slot- Slot to query.- Returns:
- The maximum stack size allowed in the slot.
-
getStackLimit
Deprecated, for removal: This API element is subject to removal in a future version. -
setStackInSlot
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IItemHandlerModifiableOverrides the stack in the given slot. This method is used by the standard Forge helper methods and classes. It is not intended for general use by other mods, and the handler may throw an error if it is called unexpectedly.- Specified by:
setStackInSlotin interfaceIItemHandlerModifiable- Parameters:
slot- Slot to modifystack- ItemStack to set slot to (may be empty).
-
isItemValid
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IItemHandlerThis function re-implements the vanilla function
Container.canPlaceItem(int, ItemStack). It should be used instead of simulated insertions in cases where the contents and state of the inventory are irrelevant, mainly for the purpose of automation and logic (for instance, testing if a minecart can wait to deposit its items into a full inventory, or if the items in the minecart can never be placed into the inventory and should move on).- isItemValid is false when insertion of the item is never valid.
- When isItemValid is true, no assumptions can be made and insertion must be simulated case-by-case.
- The actual items in the inventory, its fullness, or any other state are not considered by isItemValid.
- Specified by:
isItemValidin interfaceIItemHandler- Parameters:
slot- Slot to query for validitystack- Stack to test with for validity- Returns:
- true if the slot can insert the ItemStack, not considering the current state of the inventory. false if the slot can never insert the ItemStack in any situation.
-
validateSlotIndex
Deprecated, for removal: This API element is subject to removal in a future version.
-
LivingEntityEquipmentWrapperinstead.