diff --git a/src/main/java/net/minecraftforge/items/IItemHandler.java b/src/main/java/net/minecraftforge/items/IItemHandler.java index f9f725ef53..733b65e771 100644 --- a/src/main/java/net/minecraftforge/items/IItemHandler.java +++ b/src/main/java/net/minecraftforge/items/IItemHandler.java @@ -37,9 +37,7 @@ public interface IItemHandler * * The result's stack size may be greater than the itemstacks max size. * - * If the result is null, then the slot is empty. - * If the result is not null but the stack size is zero, then it represents - * an empty slot that will only accept* a specific itemstack. + * If the result is empty, then the slot is empty. * *

* IMPORTANT: This ItemStack MUST NOT be modified. This method is not for @@ -49,7 +47,7 @@ public interface IItemHandler * SERIOUSLY: DO NOT MODIFY THE RETURNED ITEMSTACK * * @param slot Slot to query - * @return ItemStack in given slot. May be null. + * @return ItemStack in given slot. Empty Itemstack if the slot is empty. **/ @Nonnull ItemStack getStackInSlot(int slot); @@ -60,23 +58,25 @@ public interface IItemHandler * Note: This behaviour is subtly different from IFluidHandlers.fill() * * @param slot Slot to insert into. - * @param stack ItemStack to insert. + * @param stack ItemStack to insert. This must not be modified by the item handler. * @param simulate If true, the insertion is only simulated * @return The remaining ItemStack that was not inserted (if the entire stack is accepted, then return ItemStack.EMPTY). * May be the same as the input ItemStack if unchanged, otherwise a new ItemStack. + * The returned ItemStack can be safely modified after. **/ @Nonnull ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate); /** - * Extracts an ItemStack from the given slot. The returned value must be null - * if nothing is extracted, otherwise it's stack size must not be greater than amount or the - * itemstacks getMaxStackSize(). + * Extracts an ItemStack from the given slot. + * The returned value must be empty if nothing is extracted, + * otherwise it's stack size must less than than amount and {@link ItemStack#getMaxStackSize()}. * * @param slot Slot to extract from. * @param amount Amount to extract (may be greater than the current stacks max limit) * @param simulate If true, the extraction is only simulated - * @return ItemStack extracted from the slot, must be ItemStack.EMPTY, if nothing can be extracted + * @return 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. **/ @Nonnull ItemStack extractItem(int slot, int amount, boolean simulate); diff --git a/src/main/java/net/minecraftforge/items/IItemHandlerModifiable.java b/src/main/java/net/minecraftforge/items/IItemHandlerModifiable.java index 18c83bf1fd..0df63164db 100644 --- a/src/main/java/net/minecraftforge/items/IItemHandlerModifiable.java +++ b/src/main/java/net/minecraftforge/items/IItemHandlerModifiable.java @@ -32,7 +32,7 @@ public interface IItemHandlerModifiable extends IItemHandler * is called unexpectedly. * * @param slot Slot to modify - * @param stack ItemStack to set slot to (may be null) + * @param stack ItemStack to set slot to (may be empty). * @throws RuntimeException if the handler is called in a way that the handler * was not expecting. **/