tcr/common/src/main/java/common/item/CheatTab.java
2025-06-30 15:00:13 +02:00

132 lines
2.5 KiB
Java
Executable file

package common.item;
import java.util.List;
import common.init.ItemRegistry;
import common.init.Items;
public enum CheatTab {
BLOCKS("Baumaterial", true) {
protected Item getIconItem() {
return Items.glass;
}
},
NATURE("Gestein und Natur", true) {
protected Item getIconItem() {
return Items.grass;
}
},
WOOD("Holz", true) {
protected Item getIconItem() {
return Items.maple_planks;
}
},
PLANTS("Pflanzen", true) {
protected Item getIconItem() {
return Items.oak_leaves_spring;
}
},
DECORATION("Dekoration", true) {
protected Item getIconItem() {
return Items.hay_block;
}
},
TECHNOLOGY("Redstone & Technik", true) {
protected Item getIconItem() {
return Items.tnt;
}
},
GEMS("Erze & Teure Blöcke", true) {
protected Item getIconItem() {
return Items.diamond_block;
}
},
VEHICLES("Fahrzeuge und Fortbewegung", false) {
protected Item getIconItem() {
return Items.minecart;
}
},
SPAWNERS("Mob & Itemspawner", false) {
protected Item getIconItem() {
return Items.wheat;
}
},
NPCS("NPC- und Charakterspawner", false) {
protected Item getIconItem() {
return Items.book;
}
},
TOOLS("Werkzeug", false) {
protected Item getIconItem() {
return Items.flint_and_steel;
}
},
LIQUIDS("Flüssigkeiten", false) {
protected Item getIconItem() {
return Items.water_bucket;
}
},
COMBAT("Kampf", false) {
protected Item getIconItem() {
return Items.bow;
}
},
MAGIC("Tränke & Verzauberungen", false) {
protected Item getIconItem() {
return Items.potion;
}
},
MATERIALS("Werkstoffe", false) {
protected Item getIconItem() {
return Items.leather;
}
},
METALS("Metalle und Juwelen", false) {
protected Item getIconItem() {
return Items.iron_ingot;
}
},
MISC("Verschiedenes & Nahrung", false) {
protected Item getIconItem() {
return Items.charge_crystal;
}
};
private final String name;
private final boolean blocks;
private ItemStack icon;
private CheatTab(String name, boolean blocks) {
this.name = name;
this.blocks = blocks;
}
public int getIndex() {
return this.ordinal();
}
public String getName() {
return this.name;
}
public boolean isBlockTab() {
return this.blocks;
}
public ItemStack getIcon() {
if(this.icon == null)
this.icon = new ItemStack(this.getIconItem());
return this.icon;
}
protected abstract Item getIconItem();
public void filter(List<ItemStack> list) {
for(Item item : ItemRegistry.items()) {
if(item != null && item.getTab() == this) {
item.getSubItems(list);
}
}
}
}