use of com.lying.variousoddities.species.abilities.Ability in project VariousOddities by Lyinginbedmon.
the class ScreenSelectSpecies method render.
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
renderDirtBackground(0);
this.speciesList.render(matrixStack, mouseX, mouseY, partialTicks);
this.abilityList.render(matrixStack, mouseX, mouseY, partialTicks);
renderBackgroundLayer(matrixStack, partialTicks);
hideListEdge();
drawListBorder(matrixStack, this.speciesList, this.height, 0, 180, 6, TEXTURE);
int yPos = 20;
drawCenteredString(matrixStack, this.font, this.title, this.width / 2, 12, 16777215);
yPos += 15;
if (selectableSpecies.isEmpty())
return;
// Draw species display name
Species currentSpecies = getCurrentSpecies();
this.selectButton.setMessage(currentSpecies.getDisplayName());
yPos += this.font.FONT_HEIGHT + 12;
// Render stars of appropriate colour for power
drawStars(matrixStack, yPos, currentSpecies.getPower());
yPos += this.font.FONT_HEIGHT + 3;
// Display types
int health = 20;
if (currentSpecies.hasTypes()) {
ITextComponent typesHeader = currentSpecies.getTypes().toHeader();
drawCenteredString(matrixStack, this.font, typesHeader, this.width / 2, yPos, -1);
health = (int) currentSpecies.getTypes().getPlayerHealth();
}
// Health and armour
yPos += this.font.FONT_HEIGHT + 3;
double armour = 0;
List<Ability> abilities = currentSpecies.getFullAbilities();
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, this.font, this.width / 2, yPos, health, (int) armour);
// Display abilities
yPos += this.font.FONT_HEIGHT + 3;
this.abilityList.setTop(yPos);
super.render(matrixStack, mouseX, mouseY, partialTicks);
}
use of com.lying.variousoddities.species.abilities.Ability 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.abilities.Ability in project VariousOddities by Lyinginbedmon.
the class CommandAbilities method listAbilities.
private static int listAbilities(Entity entity, CommandSource source) throws CommandSyntaxException {
if (entity instanceof LivingEntity) {
LivingEntity living = (LivingEntity) entity;
Map<ResourceLocation, Ability> abilityMap = AbilityRegistry.getCreatureAbilities(living);
source.sendFeedback(new TranslationTextComponent(translationSlug + "list", living.getDisplayName(), abilityMap.size()), true);
List<Ability> abilities = Lists.newArrayList(abilityMap.values());
Collections.sort(abilities, Ability.SORT_ABILITY);
for (Ability ability : abilities) source.sendFeedback(new StringTextComponent(" ").append(getAbilityWithEdit(ability, living)), false);
} else
throw INVALID_ENTITY_EXCEPTION.create();
return 15;
}
use of com.lying.variousoddities.species.abilities.Ability in project VariousOddities by Lyinginbedmon.
the class ElytraMixin method canElytraFly.
private boolean canElytraFly() {
LivingEntity living = (LivingEntity) (Object) this;
Map<ResourceLocation, Ability> abilityMap = AbilityRegistry.getCreatureAbilities(living);
return abilityMap.containsKey(AbilityFlight.REGISTRY_NAME) && ((AbilityFlight) abilityMap.get(AbilityFlight.REGISTRY_NAME)).isActive();
}
use of com.lying.variousoddities.species.abilities.Ability in project VariousOddities by Lyinginbedmon.
the class VOBusClient method onLivingJump.
@SubscribeEvent
public static void onLivingJump(LivingUpdateEvent event) {
if (event.getEntityLiving() == mc.player) {
ClientPlayerEntity player = (ClientPlayerEntity) event.getEntityLiving();
LivingData data = LivingData.forEntity(event.getEntityLiving());
Abilities abilities = data.getAbilities();
Map<ResourceLocation, Ability> abilityMap = AbilityRegistry.getCreatureAbilities(player);
if (player.movementInput.jump && abilities.canBonusJump) {
if (AbilitySwim.isEntitySwimming(player)) {
if (abilityMap.containsKey(AbilitySwim.REGISTRY_NAME)) {
abilities.doWaterJump();
PacketHandler.sendToServer(new PacketBonusJump(false));
}
} else if (!player.isOnGround()) {
if (abilityMap.containsKey(AbilityFlight.REGISTRY_NAME) && abilityMap.get(AbilityFlight.REGISTRY_NAME).isActive()) {
abilities.doAirJump();
player.connection.sendPacket(new CEntityActionPacket(player, CEntityActionPacket.Action.START_FALL_FLYING));
PacketHandler.sendToServer(new PacketBonusJump());
}
}
}
}
}
Aggregations