tcr/java/src/game/init/SpeciesRegistry.java
2025-03-16 17:40:47 +01:00

191 lines
10 KiB
Java
Executable file

package game.init;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import game.entity.npc.EntityArachnoid;
import game.entity.npc.EntityBloodElf;
import game.entity.npc.EntityChaosMarine;
import game.entity.npc.EntityCpu;
import game.entity.npc.EntityCultivator;
import game.entity.npc.EntityDarkMage;
import game.entity.npc.EntityDwarf;
import game.entity.npc.EntityElf;
import game.entity.npc.EntityFireDemon;
import game.entity.npc.EntityGargoyle;
import game.entity.npc.EntityGoblin;
import game.entity.npc.EntityHaunter;
import game.entity.npc.EntityHuman;
import game.entity.npc.EntityMage;
import game.entity.npc.EntityMagma;
import game.entity.npc.EntityMetalhead;
import game.entity.npc.EntityNPC;
import game.entity.npc.EntityOrc;
import game.entity.npc.EntityPrimarch;
import game.entity.npc.EntitySlime;
import game.entity.npc.EntitySpaceMarine;
import game.entity.npc.EntitySpirit;
import game.entity.npc.EntityTiefling;
import game.entity.npc.EntityUndead;
import game.entity.npc.EntityVampire;
import game.entity.npc.EntityWoodElf;
import game.entity.npc.EntityZombie;
import game.entity.npc.SpeciesInfo;
public abstract class SpeciesRegistry {
public static enum ModelType {
HUMANOID("humanoid", 0.6f, 1.8f, 64, 64, "Humanoid"),
ARACHNOID("arachnoid", 1.4f, 1.6f, 128, 64, "Arachnoidea"),
SLIME("slime", 1.0f, 1.0f, 64, 32, "Schleim"),
DWARF("dwarf", 0.58f, 1.56f, 64, 58, "Zwerg"),
HALFLING("halfling", 0.62f, 1.40f, 64, 52, "Winzling"),
SPACE_MARINE("spacemarine", 1.3f, 3.1f, 128, 106, "Space Marine");
private static final Map<String, ModelType> LOOKUP = Maps.newHashMap();
public final float width;
public final float height;
public final int texWidth;
public final int texHeight;
public final String name;
public final String display;
private ModelType(String name, float width, float height, int texWidth, int texHeight, String display) {
this.name = name;
this.width = width;
this.height = height;
this.texWidth = texWidth;
this.texHeight = texHeight;
this.display = display;
}
// public String getIdString() {
// return "modelType." + this.name;
// }
public static ModelType getByName(String name) {
ModelType type = LOOKUP.get(name.toLowerCase());
return type == null ? HUMANOID : type;
}
static {
for(ModelType type : values()) {
LOOKUP.put(type.name, type);
}
}
}
public static final Map<String, ModelType> SKINS = Maps.newTreeMap();
public static final Set<String> CAPES = Sets.newTreeSet();
// public static final Map<String, SpeciesInfo> SPECIES = Maps.newHashMap();
public static final Map<Class<? extends EntityNPC>, SpeciesInfo> CLASSES = Maps.newHashMap();
// public static final List<CharacterInfo> CHARACTERS = Lists.<CharacterInfo>newArrayList();
// public static final List<ClassInfo> SPCLASSES = Lists.<ClassInfo>newArrayList();
public static final List<SpeciesInfo> SPECIMEN = Lists.<SpeciesInfo>newArrayList();
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, String origin, String name, float size,
int color1, int color2, Object ... names) {
SPECIMEN.add(new SpeciesInfo(id, clazz, null, false, origin, name, ModelType.HUMANOID, size, color1, color2, names));
}
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, String origin, String name, ModelType renderer,
int color1, int color2) {
SPECIMEN.add(new SpeciesInfo(id, clazz, null, false, origin, name, renderer, renderer.height, color1, color2, ""));
}
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, String origin, String name, ModelType renderer,
float size, int color1, int color2) {
SPECIMEN.add(new SpeciesInfo(id, clazz, null, false, origin, name, renderer, size, color1, color2, ""));
}
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, String origin, String name, float size, int color1,
int color2) {
SPECIMEN.add(new SpeciesInfo(id, clazz, null, false, origin, name, ModelType.HUMANOID, size, color1, color2, ""));
}
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, Class<? extends Enum> classEnum, String origin,
String name, float size, int color1, int color2, Object ... names) {
SPECIMEN.add(new SpeciesInfo(id, clazz, classEnum, true, origin, name, ModelType.HUMANOID, size, color1, color2, names));
}
private static void registerSpecies(String id, Class<? extends EntityNPC> clazz, Class<? extends Enum> classEnum, boolean prefix,
String origin, String name, ModelType renderer, float size, int color1, int color2, Object ... names) {
SPECIMEN.add(new SpeciesInfo(id, clazz, classEnum, prefix, origin, name, renderer, size, color1, color2, names));
}
private static void registerItems(Class<? extends EntityNPC> clazz, Object ... items) {
CLASSES.get(clazz).addItems(items);
}
static void register() {
registerSpecies("Cpu", EntityCpu.class, null, "Test-NSC", 1.8f, 0x202020, 0x8000ff, "Sen", "Troll:trollface", "Hacker", "Herobrine");
registerSpecies("Cultivator", EntityCultivator.class, "nienrath", "Kultivator", 1.85f, 0x000000, 0xff0000, "Wei Wuxian", 0x000000, 0xff0000,
"Lan Wangji", 0xffffff, 0x80e0ff, "Jiang Cheng", 0x200000, 0xaf00ff, "Shen Qingqiu", 0xffffff, 0x80ff80,
"Luo Binghe", 0x600000, 0x000000);
registerSpecies("Metalhead", EntityMetalhead.class, "thedric", "Metalhead", 1.8f, 0x606060, 0xf0f0f0,
":metalhead_1", ":metalhead_2", ":metalhead_3",
":metalhead_4", ":metalhead_5", ":metalhead_6", ":metalhead_7", ":metalhead_8", ":metalhead_9", ":metalhead_10",
":metalhead_11", ":metalhead_12", ":metalhead_13", ":metalhead_14");
registerSpecies("Elf", EntityElf.class, "gharoth", "Elbe", 1.95f, 0x054100, 0xd2d2d2, ":highelf", "Thranduil", 0x82888b, 0xeae7bd);
registerSpecies("WoodElf", EntityWoodElf.class, "gharoth", "Waldelbe", 1.75f, 0x054100, 0x00bb00);
registerSpecies("BloodElf", EntityBloodElf.class, "kyroth", "Blutelbe", 1.9f, 0x054100, 0x960000, "::bloodelf");
registerSpecies("Human", EntityHuman.class, EntityHuman.ClassType.class, "terra", "NSC", 1.8f, 0x4f7d9a, 0x034c7a,
EntityHuman.ClassType.KNIGHT,
":knight_1", ":knight_2", ":knight_3",
":knight_4", ":knight_5", ":knight_6", ":knight_7", ":knight_8", EntityHuman.ClassType.PEASANT,
":peasant_1", ":peasant_2", ":peasant_3",
":peasant_4", ":~peasant_5", ":peasant_6");
registerSpecies("Spirit", EntitySpirit.class, "yrdinath", "Geist", 1.65f, 0xdfdfff, 0xbfbfff);
registerSpecies("Haunter", EntityHaunter.class, "warp", "Verfolger", 1.55f, 0xffdfdf, 0xffbfbf);
registerSpecies("FireDemon", EntityFireDemon.class, "ahrd", "Feuerdämon", 2.55f, 0xff0000, 0xff7f00);
registerSpecies("DarkMage", EntityDarkMage.class, "kyroth", "Dunkler Magier", 1.85f, 0xf6b201, 0xfff87e);
registerSpecies("Tiefling", EntityTiefling.class, "thedric", "Tiefling", 2.0f, 0xb01515, 0xb0736f);
registerSpecies("Zombie", EntityZombie.class, "terra", "Zombie", 1.8f, 0x00afaf, 0x799c65, ":zombie_1", ":zombie_2", ":zombie_3",
":zombie_4", ":zombie_5", ":zombie_6");
registerSpecies("Undead", EntityUndead.class, "terra", "Untoter", 1.8f, 0xc1c1c1, 0x494949, ":undead_1", ":undead_2", ":undead_3",
":undead_4");
registerSpecies("Arachnoid", EntityArachnoid.class, "tbd", "Arachnoidea", ModelType.ARACHNOID, 0x342d27, 0xa80e0e);
registerSpecies("Mage", EntityMage.class, "terra", "Magier", 1.85f, 0x340000, 0x51a03e, ":mage_1", ":mage_2", ":mage_3",
":mage_4", ":mage_5", ":mage_6");
registerSpecies("Gargoyle", EntityGargoyle.class, "tbd", "Gargoyle", 2.2f, 0x401010, 0x534437);
registerSpecies("Slime", EntitySlime.class, "tbd", "Schleim", ModelType.SLIME, 0x51a03e, 0x7ebf6e);
registerSpecies("Magma", EntityMagma.class, "thedric", "Magmaschleim", ModelType.SLIME, 0x340000, 0xfcfc00);
registerSpecies("Orc", EntityOrc.class, "tbd", "Ork", 1.9f, 0x00af00, 0x004000, ":orc_1", ":orc_2", ":orc_3",
":orc_4", ":orc_5", ":orc_6", ":orc_7", ":orc_8", ":orc_9", ":orc_10", ":orc_11", ":orc_12");
registerSpecies("Vampire", EntityVampire.class, "transylvania", "Vampir", 1.8f, 0x7f0000, 0xff0000, ":vampire_1", ":vampire_2", ":vampire_3",
":vampire_4", ":vampire_5", ":vampire_6", ":vampire_7", ":vampire_8", "Alucard:alucard_1", "Alucard:alucard_2",
"Dracula:dracula_1", "Dracula:dracula_2", "Dracula:dracula_3", "Dracula:dracula_4", "Dracula:dracula_5",
"Dracula:dracula_6");
registerSpecies("Dwarf", EntityDwarf.class, "tbd", "Zwerg", ModelType.DWARF, 0x523925, 0x975b2b);
registerSpecies("Primarch", EntityPrimarch.class, EntityPrimarch.Founding.class, false, "terra", "Primarch", ModelType.HUMANOID, 2.65f,
0xaf0000, 0x400000, EntityPrimarch.Founding.PRIMARCHS);
registerSpecies("SpaceMarine", EntitySpaceMarine.class, EntitySpaceMarine.Legion.class, true, "terra", "Space Marine", ModelType.SPACE_MARINE,
2.15f, 0x000000, 0xffffff, EntitySpaceMarine.Legion.MARINES);
registerSpecies("ChaosMarine", EntityChaosMarine.class, EntityChaosMarine.Legion.class, true, "warp", "Chaos Marine", ModelType.SPACE_MARINE,
2.15f, 0x000000, 0xff0000, EntityChaosMarine.Legion.MARINES);
registerSpecies("Goblin", EntityGoblin.class, "luna", "Goblin", ModelType.HALFLING, 0x50af50, 0x504050);
}
static void registerItems() {
registerItems(EntityMetalhead.class,
Blocks.iron_block, 5, Items.iron_ingot,
Blocks.tin_block, 5, Items.tin_ingot,
Blocks.aluminium_block, 5, Items.aluminium_ingot,
Blocks.copper_block, 5, Items.copper_ingot,
Blocks.lead_block, 5, Items.lead_ingot
);
registerItems(EntityElf.class, 3, Items.bow, 1, Items.iron_sword);
registerItems(EntityWoodElf.class, 1, Items.bow, 2, null);
registerItems(EntityBloodElf.class, 1, Items.bow, 3, Items.iron_sword, 1, Items.stone_sword);
registerItems(EntityUndead.class, 9, Items.bow, 1, null);
registerItems(EntitySpirit.class, 4, Items.snowball, 1, null);
registerItems(EntitySpaceMarine.class, 2, Items.boltgun, 1, null);
registerItems(EntityChaosMarine.class, 2, Items.boltgun, 1, null);
}
}