Skip to main content

Simple ItemStack creation

DisplayStackGen is a simple util class that is able to generate your own ItemStack in one line.

To create a new ItemStack with this class just create a new DisplayStackGen object, configure it and at the end call .gen(), witch creates the ItemStack. Examples:

new DisplayStackGen().gen();  // RuntimeException, you forgot to define an item.
new DisplayStackGen().item(Items.APPLE).gen(); // An apple.
new DisplayStackGen().block(Blocks.STONE).gen(); // A stone.
new DisplayStackGen(Blocks.STONE).gen(); // Same as above, works for both blocks and items.
new DisplayStackGen(Items.APPLE).ench().count(2).name("APPLE").tooltip("not android").gen(); // Two shiny apples with fitting name and tooltip.



item(Item) set the displayed item
block(Block) set the displayed item corresponding to the block
ench() set the item glowing (enchanted)
name(String) set the name of the item. Color codes accepted
tooltip(String...) set the item tooltip. Multiple strings are allowed for multiple lines for the tooltip
count(int) set the item count displayed
damage(int) set the item damage (metadata)