Files
Mindustry/core/src/mindustry/ui/ItemDisplay.java
2020-10-02 19:51:30 -04:00

27 lines
628 B
Java

package mindustry.ui;
import arc.scene.ui.layout.*;
import mindustry.type.*;
/** An item image with text. */
public class ItemDisplay extends Table{
public final Item item;
public final int amount;
public ItemDisplay(Item item){
this(item, 0);
}
public ItemDisplay(Item item, int amount, boolean showName){
add(new ItemImage(new ItemStack(item, amount)));
if(showName) add(item.localizedName).padLeft(4 + amount > 99 ? 4 : 0);
this.item = item;
this.amount = amount;
}
public ItemDisplay(Item item, int amount){
this(item, amount, true);
}
}