Add Item#copy

This commit is contained in:
Nassim Jahnke 2022-01-11 17:10:31 +01:00
parent d5a568b3fc
commit d5f2388723
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 12 additions and 0 deletions

View File

@ -92,6 +92,11 @@ public class DataItem implements Item {
this.tag = tag; this.tag = tag;
} }
@Override
public Item copy() {
return new DataItem(identifier, amount, data, tag);
}
@Override @Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (this == o) return true; if (this == o) return true;

View File

@ -87,4 +87,11 @@ public interface Item {
* @param tag item tag * @param tag item tag
*/ */
void setTag(@Nullable CompoundTag tag); void setTag(@Nullable CompoundTag tag);
/**
* Returns a copy of the item.
*
* @return copy of the item
*/
Item copy();
} }