tcr/common/src/main/java/common/item/CheatTab.java

133 lines
2.5 KiB
Java
Raw Normal View History

2025-05-07 18:19:24 +02:00
package common.item;
2025-03-11 00:23:54 +01:00
import java.util.List;
2025-05-07 18:19:24 +02:00
import common.init.ItemRegistry;
import common.init.Items;
2025-03-11 00:23:54 +01:00
2025-05-25 14:45:04 +02:00
public enum CheatTab {
2025-06-30 15:00:13 +02:00
BLOCKS("Baumaterial", true) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
2025-06-22 23:29:33 +02:00
return Items.glass;
2025-05-25 14:45:04 +02:00
}
},
2025-06-30 15:00:13 +02:00
NATURE("Gestein und Natur", true) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
2025-06-22 23:29:33 +02:00
return Items.grass;
2025-05-25 14:45:04 +02:00
}
},
2025-06-30 15:00:13 +02:00
WOOD("Holz", true) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
2025-06-22 23:29:33 +02:00
return Items.maple_planks;
2025-05-25 14:45:04 +02:00
}
},
2025-06-30 15:00:13 +02:00
PLANTS("Pflanzen", true) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
2025-06-22 23:29:33 +02:00
return Items.oak_leaves_spring;
2025-05-25 14:45:04 +02:00
}
},
2025-06-30 15:00:13 +02:00
DECORATION("Dekoration", true) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
2025-06-22 23:29:33 +02:00
return Items.hay_block;
2025-05-25 14:45:04 +02:00
}
},
2025-06-30 15:00:13 +02:00
TECHNOLOGY("Redstone & Technik", true) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
2025-06-22 23:29:33 +02:00
return Items.tnt;
2025-05-25 14:45:04 +02:00
}
},
2025-06-30 15:00:13 +02:00
GEMS("Erze & Teure Blöcke", true) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
2025-06-22 23:29:33 +02:00
return Items.diamond_block;
2025-05-25 14:45:04 +02:00
}
},
2025-06-30 15:00:13 +02:00
VEHICLES("Fahrzeuge und Fortbewegung", false) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
return Items.minecart;
}
},
2025-06-30 15:00:13 +02:00
SPAWNERS("Mob & Itemspawner", false) {
2025-06-26 23:46:39 +02:00
protected Item getIconItem() {
return Items.wheat;
}
},
2025-06-30 15:00:13 +02:00
NPCS("NPC- und Charakterspawner", false) {
2025-06-26 23:46:39 +02:00
protected Item getIconItem() {
return Items.book;
}
},
2025-06-30 15:00:13 +02:00
TOOLS("Werkzeug", false) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
return Items.flint_and_steel;
}
},
2025-06-30 15:00:13 +02:00
LIQUIDS("Flüssigkeiten", false) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
return Items.water_bucket;
}
},
2025-06-30 15:00:13 +02:00
COMBAT("Kampf", false) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
return Items.bow;
}
},
2025-06-30 15:00:13 +02:00
MAGIC("Tränke & Verzauberungen", false) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
return Items.potion;
}
},
2025-06-30 15:00:13 +02:00
MATERIALS("Werkstoffe", false) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
return Items.leather;
}
},
2025-06-30 15:00:13 +02:00
METALS("Metalle und Juwelen", false) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
return Items.iron_ingot;
}
},
2025-06-30 15:00:13 +02:00
MISC("Verschiedenes & Nahrung", false) {
2025-05-25 14:45:04 +02:00
protected Item getIconItem() {
return Items.charge_crystal;
}
};
2025-03-11 00:23:54 +01:00
2025-05-25 14:45:04 +02:00
private final String name;
2025-06-30 15:00:13 +02:00
private final boolean blocks;
2025-03-11 00:23:54 +01:00
2025-05-25 14:45:04 +02:00
private ItemStack icon;
2025-03-11 00:23:54 +01:00
2025-06-30 15:00:13 +02:00
private CheatTab(String name, boolean blocks) {
2025-05-25 14:45:04 +02:00
this.name = name;
2025-06-30 15:00:13 +02:00
this.blocks = blocks;
2025-05-25 14:45:04 +02:00
}
2025-03-11 00:23:54 +01:00
2025-06-30 14:49:20 +02:00
public int getIndex() {
return this.ordinal();
2025-05-25 14:45:04 +02:00
}
2025-03-11 00:23:54 +01:00
2025-05-25 14:45:04 +02:00
public String getName() {
return this.name;
}
2025-03-11 00:23:54 +01:00
2025-06-30 15:00:13 +02:00
public boolean isBlockTab() {
return this.blocks;
}
2025-05-25 14:45:04 +02:00
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) {
2025-06-27 16:27:16 +02:00
for(Item item : ItemRegistry.items()) {
2025-05-25 14:45:04 +02:00
if(item != null && item.getTab() == this) {
2025-06-29 00:16:29 +02:00
item.getSubItems(list);
2025-05-25 14:45:04 +02:00
}
}
}
2025-03-11 00:23:54 +01:00
}