use of com.lying.variousoddities.species.types.Types in project VariousOddities by Lyinginbedmon.
the class ScreenSelectTemplates method displayBaseStats.
@SuppressWarnings("deprecation")
private void displayBaseStats(MatrixStack matrixStack, int mouseX, int mouseY, int xPos) {
// Describe base creature
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getInstance().getTextureManager().bindTexture(TEXTURES);
int yPos = 20 + this.font.FONT_HEIGHT;
this.blit(matrixStack, xPos - 100, 20 + this.font.FONT_HEIGHT, 0, 65, 100, 120);
xPos -= 8;
yPos += 10;
drawString(matrixStack, this.font, this.baseSpecies.getDisplayName().getString(), xPos - this.font.getStringWidth(this.baseSpecies.getDisplayName().getString()) - 2, yPos, 16777215);
yPos += this.font.FONT_HEIGHT + 8;
int basePower = this.baseSpecies.getPower();
int totalStars = Math.max(1, Math.abs(basePower));
while (totalStars > 0) {
int stars = Math.min(5, totalStars);
ScreenSelectSpecies.drawStars(matrixStack, Math.min(5, basePower), xPos - (stars * 9), yPos);
totalStars -= stars;
yPos += this.font.FONT_HEIGHT;
}
yPos += 1;
Types baseTypes = new Types(getBaseTypes());
ITextComponent baseTypesText = baseTypes.toHeader();
if (baseTypesText.getString().length() > 15)
baseTypesText = new StringTextComponent(baseTypesText.getString().substring(0, 15) + "...");
drawString(matrixStack, this.font, baseTypesText, xPos - this.font.getStringWidth(baseTypesText.getString()), yPos, 16777215);
yPos += this.font.FONT_HEIGHT + 5;
Map<ResourceLocation, Ability> baseAbilities = getBaseAbilities();
double health = baseTypes.getPlayerHealth();
double armour = 0D;
if (!baseAbilities.isEmpty())
for (Ability ability : baseAbilities.values()) {
if (ability.getRegistryName().equals(AbilityNaturalArmour.REGISTRY_NAME))
armour += ((AbilityNaturalArmour) ability).amount();
if (ability.getRegistryName().equals(AbilityModifierCon.REGISTRY_NAME))
health += ((AbilityModifier) ability).amount();
}
;
int hudWidth = 10 + this.font.getStringWidth(String.valueOf((int) health)) + 5 + 10 + this.font.getStringWidth(String.valueOf((int) armour));
drawHealthAndArmour(matrixStack, xPos - hudWidth, yPos, (int) health, (int) armour);
yPos += this.font.FONT_HEIGHT + 5;
ITextComponent abilityCount = new TranslationTextComponent("gui." + Reference.ModInfo.MOD_ID + ".templates_select.ability_tally", baseAbilities.size());
drawString(matrixStack, this.font, abilityCount, xPos - this.font.getStringWidth(abilityCount.getString()), yPos, 16777215);
if (mouseX <= xPos && mouseY <= (yPos + font.FONT_HEIGHT) && mouseY >= 29)
renderCharacterSummary(matrixStack, mouseX, mouseY, baseTypes, baseAbilities);
}
use of com.lying.variousoddities.species.types.Types in project VariousOddities by Lyinginbedmon.
the class ScreenSelectTemplates method removeTemplate.
/**
* Removes the given template from the applied list and updates the available list
*/
public void removeTemplate(Template template) {
List<Template> applied = this.listApplied.getTemplates();
applied.remove(template);
// Quality control
boolean noHits = false;
while (!noHits) {
// Iterate through applied templates, breaking when invalid found
List<Template> tested = Lists.newArrayList();
Template hitFound = null;
for (Template extant : applied) {
Pair<Types, Map<ResourceLocation, Ability>> atStep = processTemplates(tested.toArray(new Template[0]));
if (testTemplate(extant, atStep))
tested.add(extant);
else {
hitFound = extant;
break;
}
}
if (hitFound != null)
applied.remove(hitFound);
else
noHits = true;
}
this.listApplied.setEntries(applied);
this.listAvailable.setEntries(getViableTemplates());
}
use of com.lying.variousoddities.species.types.Types in project VariousOddities by Lyinginbedmon.
the class TypeOperation method translate.
public ITextComponent translate() {
ITextComponent translation = null;
String translationBase = "operation." + Reference.ModInfo.MOD_ID + ".type.";
switch(this.action) {
case ADD:
translation = new TranslationTextComponent(translationBase + "add", typesToString(this.types));
break;
case REMOVE:
translation = new TranslationTextComponent(translationBase + "remove", typesToString(this.types));
break;
case REMOVE_ALL:
translation = new TranslationTextComponent(translationBase + "remove_all." + (removalType ? "supertypes" : "subtypes"));
break;
case SET:
translation = new TranslationTextComponent(translationBase + "set", (new Types(Arrays.asList(this.types)).toHeader()));
break;
}
return condition == null ? translation : condition.translate().append(translation);
}
use of com.lying.variousoddities.species.types.Types 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);
}
}
use of com.lying.variousoddities.species.types.Types in project VariousOddities by Lyinginbedmon.
the class ScreenSelectTemplates method displayTemplatedStats.
/**
* Describe base creature after selected templates are applied
*/
@SuppressWarnings("deprecation")
private void displayTemplatedStats(MatrixStack matrixStack, int mouseX, int mouseY, int xPos) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getInstance().getTextureManager().bindTexture(TEXTURES);
int yPos = 20 + this.font.FONT_HEIGHT;
this.blit(matrixStack, xPos, yPos, 0, 65, 100, 120);
xPos += 8;
yPos += 10;
drawString(matrixStack, this.font, this.baseSpecies.getDisplayName().getString(), xPos + 2, yPos, 16777215);
yPos += this.font.FONT_HEIGHT + 8;
int templatePower = this.baseSpecies.getPower();
for (Template template : this.listApplied.getTemplates()) templatePower += template.getPower();
int totalStars = this.targetPower;
while (Math.max(totalStars, templatePower) > 0) {
if (totalStars > 0) {
ScreenSelectSpecies.drawStars(matrixStack, Math.min(5, totalStars), xPos, yPos, 0.5F, 0.5F, 0.5F);
totalStars -= Math.min(5, totalStars);
}
if (templatePower > 0) {
ScreenSelectSpecies.drawStars(matrixStack, Math.min(5, templatePower), xPos, yPos);
templatePower -= Math.min(5, templatePower);
}
yPos += this.font.FONT_HEIGHT;
}
yPos += 1;
Pair<Types, Map<ResourceLocation, Ability>> selection = getProcessedTemplates();
ITextComponent selectionTypesText = selection.getFirst().toHeader();
if (selectionTypesText.getString().length() > 15)
selectionTypesText = new StringTextComponent(selectionTypesText.getString().substring(0, 15) + "...");
drawString(matrixStack, this.font, selectionTypesText, xPos, yPos, 16777215);
yPos += this.font.FONT_HEIGHT + 5;
// Display health and armour total
double health = selection.getFirst().getPlayerHealth();
double armour = 0D;
Collection<Ability> abilities = selection.getSecond().values();
if (!abilities.isEmpty())
for (Ability ability : abilities) {
if (ability.getRegistryName().equals(AbilityNaturalArmour.REGISTRY_NAME))
armour += ((AbilityNaturalArmour) ability).amount();
if (ability.getRegistryName().equals(AbilityModifierCon.REGISTRY_NAME))
health += ((AbilityModifier) ability).amount();
}
;
drawHealthAndArmour(matrixStack, xPos, yPos, (int) health, (int) armour);
yPos += this.font.FONT_HEIGHT + 5;
ITextComponent abilityCount = new TranslationTextComponent("gui." + Reference.ModInfo.MOD_ID + ".templates_select.ability_tally", selection.getSecond().size());
drawString(matrixStack, this.font, abilityCount, xPos, yPos, 16777215);
if (mouseX >= xPos && mouseY <= (yPos + font.FONT_HEIGHT) && mouseY >= 29)
renderCharacterSummary(matrixStack, mouseX, mouseY, selection.getFirst(), selection.getSecond());
}
Aggregations