@Override public void registerClassification(IClassification branch) { if (classificationMap.containsKey(branch.getUID())) { throw new RuntimeException(String.format("Could not add new classification '%s', because the key is already taken by %s.", branch.getUID(), classificationMap.get(branch.getUID()))); } classificationMap.put(branch.getUID(), branch); for (IAlleleHandler handler : this.alleleHandlers) { handler.onRegisterClassification(branch); } }
ButterflyDefinition(ButterflyBranchDefinition branchDefinition, String speciesName, String binomial, Color serumColor, boolean dominant, float rarity) { this.branch = branchDefinition; String uid = "lepi" + name(); IClassification parent = branch.getBranch().getParent(); String unlocalizedName = "for.butterflies.species." + parent.getUID().substring(parent.getLevel().name().toLowerCase(Locale.ENGLISH).length() + 1) + '.' + speciesName; String unlocalizedDescription = "for.description." + uid; String texture = StringUtil.camelCaseToUnderscores("butterflies/" + uid); IAlleleButterflySpeciesBuilder speciesBuilder = ButterflyManager.butterflyFactory.createSpecies("forestry." + uid, unlocalizedName, "Sengir", unlocalizedDescription, Constants.MOD_ID, texture, dominant, branchDefinition.getBranch(), binomial, serumColor); speciesBuilder.setRarity(rarity); setSpeciesProperties(speciesBuilder); this.species = speciesBuilder.build(); }
MothDefinition(ButterflyBranchDefinition branchDefinition, String speciesName, String binomial, Color serumColor, boolean dominant, float rarity) { branch = branchDefinition; String uid = "moth" + name(); IClassification parent = branch.getBranch().getParent(); String unlocalizedName = "for.butterflies.species." + parent.getUID().substring(parent.getLevel().name().toLowerCase(Locale.ENGLISH).length() + 1) + '.' + speciesName; String unlocalizedDescription = "for.description." + uid; String texture = StringUtil.camelCaseToUnderscores("butterflies/" + uid); IAlleleButterflySpeciesBuilder speciesBuilder = ButterflyManager.butterflyFactory.createSpecies("forestry." + uid, unlocalizedName, "Sengir", unlocalizedDescription, Constants.MOD_ID, texture, dominant, branchDefinition.getBranch(), binomial, serumColor); speciesBuilder.setRarity(rarity); speciesBuilder.setNocturnal(); setSpeciesProperties(speciesBuilder); species = speciesBuilder.build(); }