api: rename Item to TileItem and add Item value class
Item was actually the renderable Item and is being misused for ItemContainer items
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
* Copyright (c) 2019, Adam <Adam@sigterm.info>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -24,23 +24,11 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
/**
|
import lombok.Value;
|
||||||
* Represents an item inside an {@link ItemContainer}.
|
|
||||||
*/
|
|
||||||
public interface Item extends Renderable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Gets the items ID.
|
|
||||||
*
|
|
||||||
* @return the ID of the item
|
|
||||||
* @see ItemID
|
|
||||||
*/
|
|
||||||
int getId();
|
|
||||||
|
|
||||||
/**
|
@Value
|
||||||
* Gets the items quantity.
|
public class Item
|
||||||
*
|
{
|
||||||
* @return the items quantity
|
private final int id;
|
||||||
*/
|
private final int quantity;
|
||||||
int getQuantity();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public interface Tile
|
|||||||
*
|
*
|
||||||
* @return the ground items
|
* @return the ground items
|
||||||
*/
|
*/
|
||||||
List<Item> getGroundItems();
|
List<TileItem> getGroundItems();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the tile under this one, if this tile is a bridge
|
* Return the tile under this one, if this tile is a bridge
|
||||||
|
|||||||
46
runelite-api/src/main/java/net/runelite/api/TileItem.java
Normal file
46
runelite-api/src/main/java/net/runelite/api/TileItem.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an item inside an {@link ItemLayer}.
|
||||||
|
*/
|
||||||
|
public interface TileItem extends Renderable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Gets the items ID.
|
||||||
|
*
|
||||||
|
* @return the ID of the item
|
||||||
|
* @see ItemID
|
||||||
|
*/
|
||||||
|
int getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the items quantity.
|
||||||
|
*
|
||||||
|
* @return the items quantity
|
||||||
|
*/
|
||||||
|
int getQuantity();
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
package net.runelite.api.events;
|
package net.runelite.api.events;
|
||||||
|
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.TileItem;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,5 +36,5 @@ import net.runelite.api.Tile;
|
|||||||
public class ItemDespawned
|
public class ItemDespawned
|
||||||
{
|
{
|
||||||
private final Tile tile;
|
private final Tile tile;
|
||||||
private final Item item;
|
private final TileItem item;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
package net.runelite.api.events;
|
package net.runelite.api.events;
|
||||||
|
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.TileItem;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ import net.runelite.api.Tile;
|
|||||||
@Value
|
@Value
|
||||||
public class ItemQuantityChanged
|
public class ItemQuantityChanged
|
||||||
{
|
{
|
||||||
private final Item item;
|
private final TileItem item;
|
||||||
private final Tile tile;
|
private final Tile tile;
|
||||||
private final int oldQuantity;
|
private final int oldQuantity;
|
||||||
private final int newQuantity;
|
private final int newQuantity;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
package net.runelite.api.events;
|
package net.runelite.api.events;
|
||||||
|
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.TileItem;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,5 +36,5 @@ import net.runelite.api.Tile;
|
|||||||
public class ItemSpawned
|
public class ItemSpawned
|
||||||
{
|
{
|
||||||
private final Tile tile;
|
private final Tile tile;
|
||||||
private final Item item;
|
private final TileItem item;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user