@@ -142,6 +142,14 @@ static Builder builder() {
142142 */
143143 ItemStack peek ();
144144
145+ /**
146+ * @deprecated Use {@link #offer(ItemStackLike...)} instead.
147+ */
148+ @ Deprecated (forRemoval = true )
149+ default InventoryTransactionResult offer (ItemStack ... stacks ) {
150+ return this .offer ((ItemStackLike []) stacks );
151+ }
152+
145153 /**
146154 * Adds one or more ItemStacks to this inventory.
147155 *
@@ -150,18 +158,26 @@ static Builder builder() {
150158 * @return A SUCCESS transaction-result if all stacks were added and
151159 * FAILURE when at least one stack was not or only partially added to the inventory.
152160 */
153- InventoryTransactionResult offer (ItemStack ... stacks );
161+ InventoryTransactionResult offer (ItemStackLike ... stacks );
162+
163+ /**
164+ * @deprecated Use {@link #canFit(ItemStackLike)} instead.
165+ */
166+ @ Deprecated (forRemoval = true )
167+ default boolean canFit (ItemStack stack ) {
168+ return this .canFit ((ItemStackLike ) stack );
169+ }
154170
155171 /**
156172 * Returns true if the entire stack can fit in this inventory.
157173 *
158- * <p>If this returns {@code true} {@link #offer(ItemStack ...)} should always succeed.</p>
174+ * <p>If this returns {@code true} {@link #offer(ItemStackLike ...)} should always succeed.</p>
159175 *
160176 * @param stack The stack of items to check if it can fit in this inventory.
161177 *
162178 * @return true if the entire stack can fit in this inventory.
163179 */
164- boolean canFit (ItemStack stack );
180+ boolean canFit (ItemStackLike stack );
165181
166182 /**
167183 * Gets and removes the stack at the supplied index in this Inventory.
@@ -198,17 +214,33 @@ static Builder builder() {
198214 */
199215 Optional <ItemStack > peekAt (int index );
200216
217+ /**
218+ * @deprecated Use {@link #offer(int, ItemStackLike)} instead.
219+ */
220+ @ Deprecated (forRemoval = true )
221+ default InventoryTransactionResult offer (int index , ItemStack stack ) {
222+ return this .offer (index , (ItemStackLike ) stack );
223+ }
224+
201225 /**
202226 * Adds an ItemStack to the slot at given index.
203- * Returns a {@link InventoryTransactionResult.Type#SUCCESS} only if the entire {@link ItemStack } fits the slot.
227+ * Returns a {@link InventoryTransactionResult.Type#SUCCESS} only if the entire {@link ItemStackLike } fits the slot.
204228 *
205229 * @param index The slot index
206230 * @param stack The stack to add to this inventory.
207231 *
208232 * @return A SUCCESS transaction-result if the entire stack was added and
209233 * FAILURE when the stack was not or only partially added to the inventory.
210234 */
211- InventoryTransactionResult offer (int index , ItemStack stack );
235+ InventoryTransactionResult offer (int index , ItemStackLike stack );
236+
237+ /**
238+ * @deprecated Use {@link #set(int, ItemStackLike)} instead.
239+ */
240+ @ Deprecated (forRemoval = true )
241+ default InventoryTransactionResult set (int index , ItemStack stack ) {
242+ return this .set (index , (ItemStackLike ) stack );
243+ }
212244
213245 /**
214246 * Adds the ItemStack to the slot at given index overwriting the existing item.
@@ -223,7 +255,7 @@ static Builder builder() {
223255 * @return A SUCCESS transaction-result if the entire stack was added and
224256 * FAILURE when the stack was not or only partially added to the inventory.
225257 */
226- InventoryTransactionResult set (int index , ItemStack stack );
258+ InventoryTransactionResult set (int index , ItemStackLike stack );
227259
228260 /**
229261 * Gets the {@link Slot} at the given index.
@@ -260,15 +292,23 @@ static Builder builder() {
260292 */
261293 int capacity ();
262294
295+ /**
296+ * @deprecated Use {@link #contains(ItemStackLike)} instead.
297+ */
298+ @ Deprecated (forRemoval = true )
299+ default boolean contains (ItemStack stack ) {
300+ return this .contains ((ItemStackLike ) stack );
301+ }
302+
263303 /**
264304 * Checks whether the stacks quantity or more of given stack is contained in this Inventory.
265- * To check if an inventory contains any amount use {@link #containsAny(ItemStack )}.
305+ * To check if an inventory contains any amount use {@link #containsAny(ItemStackLike )}.
266306 *
267307 * @param stack The stack to check for
268308 *
269309 * @return True if there are at least the given stack's amount of items present in this inventory.
270310 */
271- boolean contains (ItemStack stack );
311+ boolean contains (ItemStackLike stack );
272312
273313 /**
274314 * Checks whether the given ItemType is contained in this Inventory
@@ -279,18 +319,26 @@ static Builder builder() {
279319 */
280320 boolean contains (ItemType type );
281321
322+ /**
323+ * @deprecated Use {@link #containsAny(ItemStackLike)} instead.
324+ */
325+ @ Deprecated (forRemoval = true )
326+ default boolean containsAny (ItemStack stack ) {
327+ return this .containsAny ((ItemStackLike ) stack );
328+ }
329+
282330 /**
283331 * Checks whether the given stack is contained in this Inventory.
284332 * The stack size is ignored.
285333 *
286334 * <p>Note this will return true if any amount of the supplied stack is found.
287- * To check if an inventory contains at least a given quantity use {@link #contains(ItemStack )}.</p>
335+ * To check if an inventory contains at least a given quantity use {@link #contains(ItemStackLike )}.</p>
288336 *
289337 * @param stack The stack to check for
290338 *
291339 * @return True if the stack is present in this inventory
292340 */
293- boolean containsAny (ItemStack stack );
341+ boolean containsAny (ItemStackLike stack );
294342
295343 // TODO remove from API? do we need to get a property relative to another parent in API?
296344 /**
0 commit comments