package ethanjones.cubes.item;

import ethanjones.cubes.core.localization.Localization;
import ethanjones.cubes.entity.living.player.Player;
import ethanjones.cubes.graphics.assets.Assets;

import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Item {

  public String id;

  protected TextureRegion texture;

  public Item(String id) {
    if (!id.contains(":")) throw new IllegalArgumentException(id + " is not in the correct format");
    this.id = id.toLowerCase();
  }

  public void loadGraphics() {
    this.texture = Assets.getPackedTextureFromID(id, "item");
  }

  public TextureRegion getTextureRegion() {
    return texture;
  }

  public String getName() {
    return Localization.get("item." + id.replaceFirst(":", "."));
  }

  public boolean onButtonPress(int button, ItemStack itemStack, Player player, int stack) {
    return false;
  }

  public int getStackCountMax() {
    return 64;
  }
}

@@ -912,11 +912,72 @@
  64;%0A  %7D
+%0A%0A  @Override%0A  public String toString() %7B%0A    return id;%0A  %7D
 %0A%7D%0A

Item.toString() return item id