use of com.lying.variousoddities.species.abilities.AbilityNaturalArmour in project VariousOddities by Lyinginbedmon.
the class ScreenCharacterSheet method init.
public void init(Minecraft minecraft, int width, int height) {
super.init(minecraft, width, height);
this.buttons.clear();
PlayerEntity player = Minecraft.getInstance().player;
Types types = EnumCreatureType.getTypes(player);
this.typesHeader = types.toHeader();
this.health = types.getPlayerHealth();
this.armour = 0D;
List<Ability> passives = Lists.newArrayList();
List<Ability> actives = Lists.newArrayList();
for (Ability ability : AbilityRegistry.getCreatureAbilities(player).values()) {
if (ability.getRegistryName().equals(AbilityNaturalArmour.REGISTRY_NAME))
armour += ((AbilityNaturalArmour) ability).amount();
if (ability.getRegistryName().equals(AbilityModifierCon.REGISTRY_NAME))
health += ((AbilityModifier) ability).amount();
if (ability.passive())
passives.add(ability);
else
actives.add(ability);
}
;
this.isDoubleList = !actives.isEmpty();
int listWidth = Math.max((int) (this.width * (actives.isEmpty() ? 0.6D : 0.3D)), 200);
int listSep = (ACTION_ICON_SIZE + ACTION_ICON_SEP * 2) / 2;
this.listPassives = new AbilityList(minecraft, isDoubleList ? (this.width / 2) + listSep : (this.width - listWidth) / 2, listWidth, this.height, 20);
if (!passives.isEmpty()) {
passives.sort(ScreenSelectSpecies.ABILITY_SORT);
this.listPassives.addAbilities(passives);
this.children.add(this.listPassives);
}
this.listActives = new AbilityList(minecraft, (this.width / 2) - listWidth - listSep, listWidth, this.height, 20);
if (this.isDoubleList) {
actives.sort(ScreenSelectSpecies.ABILITY_SORT);
this.listActives.addAbilities(actives);
this.children.add(this.listActives);
}
}
Aggregations