use of am2.api.math.AMVector2 in project ArsMagica2 by Mithion.
the class AMIngameGUI method RenderMagicXP.
public void RenderMagicXP(int i, int j) {
ExtendedProperties props = ExtendedProperties.For(Minecraft.getMinecraft().thePlayer);
if (props.getMagicLevel() > 0) {
AMVector2 position = getShiftedVector(AMCore.config.getXPBarPosition(), i, j);
AMVector2 dimensions = new AMVector2(182, 5);
Minecraft.getMinecraft().renderEngine.bindTexture(mc_gui);
GL11.glColor4f(0.5f, 0.5f, 1.0f, AMCore.config.showXPAlways() ? 1.0f : AMGuiHelper.instance.getMagicXPBarAlpha());
// base XP bar
drawTexturedModalRect_Classic(position.iX, position.iY, 0, 64, dimensions.iX, dimensions.iY, dimensions.iX, dimensions.iY);
if (props.getMagicXP() > 0) {
float pctXP = props.getMagicXP() / props.getXPToNextLevel();
if (pctXP > 1)
pctXP = 1;
int width = (int) ((dimensions.iX + 1) * pctXP);
drawTexturedModalRect_Classic(position.iX, position.iY, 0, 69, width, dimensions.iY, width, dimensions.iY);
}
if (AMCore.config.getShowNumerics() && (AMCore.config.showXPAlways() || AMGuiHelper.instance.getMagicXPBarAlpha() > 0)) {
String xpStr = StatCollector.translateToLocal("am2.gui.xp") + ": " + +(int) (props.getMagicXP() * 100) + "/" + (int) (props.getXPToNextLevel() * 100);
AMVector2 numericPos = getShiftedVector(AMCore.config.getXPNumericPosition(), i, j);
Minecraft.getMinecraft().fontRenderer.drawString(xpStr, numericPos.iX, numericPos.iY, 0x999999);
}
}
}
use of am2.api.math.AMVector2 in project ArsMagica2 by Mithion.
the class AMIngameGUI method RenderManaBar.
private void RenderManaBar(int i, int j, FontRenderer fontRenderer) {
int barWidth = i / 8;
AMVector2 fatigue_hud = getShiftedVector(AMCore.config.getBurnoutHudPosition(), i, j);
AMVector2 mana_hud = getShiftedVector(AMCore.config.getManaHudPosition(), i, j);
float green = 0.5f;
float blue = 1.0f;
float red = 0.126f;
ExtendedProperties props = ExtendedProperties.For(mc.thePlayer);
// mana bar
float mana = props.getCurrentMana();
float bonusMana = props.getBonusCurrentMana();
float maxMana = props.getMaxMana();
float fatigueBarWidth = barWidth;
float fatigue = props.getCurrentFatigue();
float maxFatigue = props.getMaxFatigue();
if (mana + bonusMana > maxMana)
mana = maxMana;
float progressScaled = (mana / (maxMana + 0.01f));
if (AMCore.config.showHudBars()) {
// handle flashing of mana bar
float flashTimer = AMGuiHelper.instance.getFlashTimer(MANA_BAR_FLASH_SLOT);
if (flashTimer > 0) {
green = 0.0f;
float redShift = 1.0f - red;
float halfFlash = AMGuiHelper.instance.flashDuration / 2;
if (flashTimer > halfFlash) {
float pct = (flashTimer - halfFlash) / halfFlash;
red += redShift - (redShift * pct);
} else {
float pct = flashTimer / halfFlash;
red += (redShift * pct);
}
GL11.glColor3f(red, green, blue);
} else {
if (bonusMana > 0)
GL11.glColor3f(0.2f, 0.9f, 0.6f);
}
ItemStack curItem = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem();
if (curItem != null && (curItem.getItem() == ItemsCommonProxy.spell || curItem.getItem() == ItemsCommonProxy.spellBook || curItem.getItem() == ItemsCommonProxy.arcaneSpellbook)) {
ItemStack spellStack = curItem.getItem() == ItemsCommonProxy.spell ? curItem : ((ItemSpellBook) curItem.getItem()).GetActiveItemStack(curItem);
if (spellStack != null) {
int[] parts = SpellUtils.instance.getShapeGroupParts(spellStack);
int sx = mana_hud.iX - 2 * parts.length / 2;
int sy = mana_hud.iY - 2 * parts.length / 2;
for (int p : parts) {
IIcon icon = SpellIconManager.instance.getIcon(SkillManager.instance.getSkillName(SkillManager.instance.getSkill(p)));
if (icon != null) {
DrawIconAtXY(icon, "items", sx, sy, false);
sx += 3;
sy += 3;
}
}
}
}
DrawPartialIconAtXY(AMGuiIcons.manaLevel, progressScaled, 1, mana_hud.iX + 16, mana_hud.iY + 1f, (int) (barWidth * 0.97f), 40, false);
DrawIconAtXY(AMGuiIcons.manaBar, "items", mana_hud.iX + 15, mana_hud.iY + 3, barWidth, 50, false);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
progressScaled = (fatigue / (maxFatigue + 0.01f));
DrawIconAtXY(AMGuiIcons.fatigueIcon, "items", fatigue_hud.iX + barWidth, fatigue_hud.iY, false);
DrawPartialIconAtXY(AMGuiIcons.fatigueLevel, progressScaled, 1, fatigue_hud.iX, fatigue_hud.iY + 3f, fatigueBarWidth, 40, false);
DrawIconAtXY(AMGuiIcons.fatigueBar, "items", fatigue_hud.iX, fatigue_hud.iY + 4, barWidth, 48, false);
green = 0.5f;
blue = 1.0f;
red = 0.126f;
// magic level
int manaBarColor = Math.round(red * 255);
manaBarColor = (manaBarColor << 8) + Math.round(green * 255);
manaBarColor = (manaBarColor << 8) + Math.round(blue * 255);
String magicLevel = (new StringBuilder()).append("").append(ExtendedProperties.For(mc.thePlayer).getMagicLevel()).toString();
AMVector2 magicLevelPos = getShiftedVector(AMCore.config.getLevelPosition(), i, j);
magicLevelPos.iX -= Minecraft.getMinecraft().fontRenderer.getStringWidth(magicLevel) / 2;
fontRenderer.drawStringWithShadow(magicLevel, magicLevelPos.iX, magicLevelPos.iY, manaBarColor);
if (flashTimer > 0) {
GL11.glColor3f(1.0f, 1.0f, 1.0f);
}
}
if (AMCore.config.getShowNumerics()) {
String manaStr = StatCollector.translateToLocal("am2.gui.mana") + ": " + (int) (mana + bonusMana) + "/" + (int) maxMana;
String burnoutStr = StatCollector.translateToLocal("am2.gui.burnout") + ": " + (int) props.getCurrentFatigue() + "/" + (int) props.getMaxFatigue();
AMVector2 manaNumericPos = getShiftedVector(AMCore.config.getManaNumericPosition(), i, j);
AMVector2 burnoutNumericPos = getShiftedVector(AMCore.config.getBurnoutNumericPosition(), i, j);
fontRenderer.drawString(manaStr, manaNumericPos.iX, manaNumericPos.iY, bonusMana > 0 ? 0xeae31c : 0x2080FF);
fontRenderer.drawString(burnoutStr, burnoutNumericPos.iX + 25 - fontRenderer.getStringWidth(burnoutStr), burnoutNumericPos.iY, 0xFF2020);
}
}
use of am2.api.math.AMVector2 in project ArsMagica2 by Mithion.
the class AMIngameGUI method RenderAffinity.
public void RenderAffinity(int i, int j) {
AMVector2 affinityPos = getShiftedVector(AMCore.config.getAffinityPosition(), i, j);
int x = affinityPos.iX;
int y = affinityPos.iY;
AffinityData ad = AffinityData.For(Minecraft.getMinecraft().thePlayer);
for (Affinity affinity : ad.getHighestAffinities()) {
if (affinity == null || affinity == Affinity.NONE)
continue;
GL11.glColor3f(1.0f, 1.0f, 1.0f);
AMGuiHelper.instance.DrawIconAtXY(affinity.representItem.getIconFromDamage(affinity.representMeta), x, y, j, 12, 12, true);
if (AMCore.config.getShowNumerics()) {
String display = String.format("%.2f%%", AffinityData.For(mc.thePlayer).getAffinityDepth(affinity) * 100);
if (x < i / 2)
Minecraft.getMinecraft().fontRenderer.drawString(display, x + 14, y + 2, affinity.color);
else
Minecraft.getMinecraft().fontRenderer.drawString(display, x - 2 - Minecraft.getMinecraft().fontRenderer.getStringWidth(display), y + 2, affinity.color);
}
y += 15;
}
}
use of am2.api.math.AMVector2 in project ArsMagica2 by Mithion.
the class GuiHudCustomization method mouseClicked.
@Override
protected void mouseClicked(int par1, int par2, int par3) {
super.mouseClicked(par1, par2, par3);
for (Object button : this.buttonList) {
if (button instanceof GuiButtonVariableDims) {
if (((GuiButtonVariableDims) button).mousePressed(mc, par1, par2)) {
if (button == showBuffs) {
doShowBuffs = !doShowBuffs;
showBuffs.displayString = StatCollector.translateToLocal("am2.gui.buffTimers") + ": " + ((doShowBuffs) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
positiveBuffs.enabled = doShowBuffs;
negativeBuffs.enabled = doShowBuffs;
storeGuiPositions();
} else if (button == showNumerics) {
doShowNumerics = !doShowNumerics;
showNumerics.displayString = StatCollector.translateToLocal("am2.gui.numericValues") + ": " + ((doShowNumerics) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
manaNumeric.enabled = doShowNumerics;
burnoutNumeric.enabled = doShowNumerics;
XPNumeric.enabled = doShowNumerics;
storeGuiPositions();
} else if (button == showHudMinimally) {
doShowHudMinimally = !doShowHudMinimally;
showHudMinimally.displayString = StatCollector.translateToLocal("am2.gui.minimalHud") + ": " + ((doShowHudMinimally) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
storeGuiPositions();
} else if (button == options) {
showOptions = !showOptions;
setOptionsVisibility(showOptions);
} else if (button == showXPAlways) {
doShowXPAlways = !doShowXPAlways;
showXPAlways.displayString = StatCollector.translateToLocal("am2.gui.xpAlways") + ": " + ((doShowXPAlways) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
storeGuiPositions();
} else if (button == showHudBars) {
doShowBars = !doShowBars;
showHudBars.displayString = StatCollector.translateToLocal("am2.gui.hudBars") + ": " + ((doShowBars) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
manaButton.enabled = doShowBars;
burnoutButton.enabled = doShowBars;
storeGuiPositions();
} else if (button == showArmorUI) {
doShowArmor = !doShowArmor;
showArmorUI.displayString = StatCollector.translateToLocal("am2.gui.armorUI") + ": " + ((doShowHudMinimally) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
armorHead.enabled = doShowArmor;
armorChest.enabled = doShowArmor;
armorLegs.enabled = doShowArmor;
armorBoots.enabled = doShowArmor;
storeGuiPositions();
} else if (!showOptions) {
dragTarget = (GuiButtonVariableDims) button;
AMVector2 buttonPos = ((GuiButtonVariableDims) button).getPosition();
AMVector2 mousePos = new AMVector2(par1, par2);
dragOffset = mousePos.subtract(buttonPos);
}
}
}
}
}
use of am2.api.math.AMVector2 in project ArsMagica2 by Mithion.
the class GuiHudCustomization method initGui.
@Override
public void initGui() {
super.initGui();
doShowBuffs = AMCore.config.getShowBuffs();
doShowNumerics = AMCore.config.getShowNumerics();
doShowHudMinimally = AMCore.config.showHudMinimally();
doShowArmor = AMCore.config.showArmorUI();
doShowXPAlways = AMCore.config.showXPAlways();
doShowBars = AMCore.config.showHudBars();
int barWidth = (width / 8) + 16;
manaButton = new GuiButtonVariableDims(0, 0, 0, "").setDimensions(barWidth, 14).setBorderOnly(true);
burnoutButton = new GuiButtonVariableDims(1, 0, 0, "").setDimensions(barWidth, 14).setBorderOnly(true);
levelButton = new GuiButtonVariableDims(2, 0, 0, "").setDimensions(10, 10).setBorderOnly(true);
affinityButton = new GuiButtonVariableDims(3, 0, 0, "").setDimensions(10, 20).setBorderOnly(true).setPopupText(StatCollector.translateToLocal("am2.gui.affinity"));
positiveBuffs = new GuiButtonVariableDims(4, 0, 0, "").setPopupText(StatCollector.translateToLocal("am2.gui.positiveBuffs")).setDimensions(10, 10).setBorderOnly(true);
negativeBuffs = new GuiButtonVariableDims(5, 0, 0, "").setPopupText(StatCollector.translateToLocal("am2.gui.negativeBuffs")).setDimensions(10, 10).setBorderOnly(true);
armorHead = new GuiButtonVariableDims(6, 0, 0, "").setDimensions(10, 10).setPopupText(StatCollector.translateToLocal("am2.gui.headwear")).setBorderOnly(true);
armorChest = new GuiButtonVariableDims(7, 0, 0, "").setDimensions(10, 10).setPopupText(StatCollector.translateToLocal("am2.gui.chestplate")).setBorderOnly(true);
armorLegs = new GuiButtonVariableDims(8, 0, 0, "").setDimensions(10, 10).setPopupText(StatCollector.translateToLocal("am2.gui.leggings")).setBorderOnly(true);
armorBoots = new GuiButtonVariableDims(9, 0, 0, "").setDimensions(10, 10).setPopupText(StatCollector.translateToLocal("am2.gui.boots")).setBorderOnly(true);
xpBar = new GuiButtonVariableDims(10, 0, 0, "").setDimensions(182, 5).setPopupText(StatCollector.translateToLocal("am2.gui.xpBar")).setBorderOnly(true);
contingency = new GuiButtonVariableDims(10, 0, 0, "").setDimensions(16, 16).setPopupText(StatCollector.translateToLocal("am2.gui.contingency")).setBorderOnly(true);
showBuffs = new GuiButtonVariableDims(11, width / 2 - 90, height - 88, StatCollector.translateToLocal("am2.gui.buffTimers")).setDimensions(180, 20);
showNumerics = new GuiButtonVariableDims(12, width / 2 - 90, height - 66, StatCollector.translateToLocal("am2.gui.numericValues")).setDimensions(180, 20);
options = new GuiButtonVariableDims(13, width / 2 - 90, height - 22, StatCollector.translateToLocal("am2.gui.options")).setDimensions(180, 20);
showHudMinimally = new GuiButtonVariableDims(14, width / 2 - 90, height - 110, StatCollector.translateToLocal("am2.gui.minimalHud")).setDimensions(180, 20).setPopupText(StatCollector.translateToLocal("am2.gui.minimalHudDesc"));
showArmorUI = new GuiButtonVariableDims(15, width / 2 - 90, height - 132, StatCollector.translateToLocal("am2.gui.armorUI")).setDimensions(180, 20);
showXPAlways = new GuiButtonVariableDims(16, width / 2 - 90, height - 154, StatCollector.translateToLocal("am2.gui.xpAlways")).setDimensions(180, 20);
showHudBars = new GuiButtonVariableDims(17, width / 2 - 90, height - 176, StatCollector.translateToLocal("am2.gui.hudBars")).setDimensions(180, 20);
manaNumeric = new GuiButtonVariableDims(18, 0, 0, "").setDimensions(25, 10).setPopupText(StatCollector.translateToLocal("am2.gui.manaNumeric")).setBorderOnly(true);
burnoutNumeric = new GuiButtonVariableDims(19, 0, 0, "").setDimensions(25, 10).setPopupText(StatCollector.translateToLocal("am2.gui.burnoutNumeric")).setBorderOnly(true);
XPNumeric = new GuiButtonVariableDims(20, 0, 0, "").setDimensions(25, 10).setPopupText(StatCollector.translateToLocal("am2.gui.XPNumeric")).setBorderOnly(true);
spellBook = new GuiButtonVariableDims(21, 0, 0, StatCollector.translateToLocal("item.arsmagica2:spellBook.name")).setBorderOnly(true).setDimensions(106, 15);
showBuffs.displayString = StatCollector.translateToLocal("am2.gui.buffTimers") + ": " + ((doShowBuffs) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
showNumerics.displayString = StatCollector.translateToLocal("am2.gui.numericValues") + ": " + ((doShowNumerics) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
showHudMinimally.displayString = StatCollector.translateToLocal("am2.gui.minimalHud") + ": " + ((doShowHudMinimally) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
showArmorUI.displayString = StatCollector.translateToLocal("am2.gui.armorUI") + ": " + ((doShowArmor) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
showXPAlways.displayString = StatCollector.translateToLocal("am2.gui.xpAlways") + ": " + ((doShowXPAlways) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
showHudBars.displayString = StatCollector.translateToLocal("am2.gui.hudBars") + ": " + ((doShowBars) ? StatCollector.translateToLocal("am2.gui.yes") : StatCollector.translateToLocal("am2.gui.no"));
positiveBuffs.enabled = doShowBuffs;
negativeBuffs.enabled = doShowBuffs;
manaNumeric.enabled = doShowNumerics;
burnoutNumeric.enabled = doShowNumerics;
XPNumeric.enabled = doShowNumerics;
manaButton.enabled = doShowBars;
burnoutButton.enabled = doShowBars;
armorHead.enabled = doShowArmor;
armorChest.enabled = doShowArmor;
armorLegs.enabled = doShowArmor;
armorBoots.enabled = doShowArmor;
initButtonAndSnapData(manaButton, AMCore.config.getManaHudPosition());
// new AMVector2(0.5, 0.5)
initButtonAndSnapData(burnoutButton, AMCore.config.getBurnoutHudPosition());
initButtonAndSnapData(levelButton, AMCore.config.getLevelPosition());
initButtonAndSnapData(affinityButton, AMCore.config.getAffinityPosition());
initButtonAndSnapData(positiveBuffs, AMCore.config.getPositiveBuffsPosition());
initButtonAndSnapData(negativeBuffs, AMCore.config.getNegativeBuffsPosition());
initButtonAndSnapData(armorHead, AMCore.config.getArmorPositionHead());
initButtonAndSnapData(armorChest, AMCore.config.getArmorPositionChest());
initButtonAndSnapData(armorLegs, AMCore.config.getArmorPositionLegs());
initButtonAndSnapData(armorBoots, AMCore.config.getArmorPositionBoots());
initButtonAndSnapData(xpBar, AMCore.config.getXPBarPosition());
initButtonAndSnapData(contingency, AMCore.config.getContingencyPosition());
initButtonAndSnapData(manaNumeric, AMCore.config.getManaNumericPosition());
initButtonAndSnapData(burnoutNumeric, AMCore.config.getBurnoutNumericPosition());
initButtonAndSnapData(XPNumeric, AMCore.config.getXPNumericPosition());
initButtonAndSnapData(spellBook, AMCore.config.getSpellBookPosition());
setOptionsVisibility(false);
this.buttonList.add(showBuffs);
this.buttonList.add(showNumerics);
this.buttonList.add(options);
this.buttonList.add(showHudMinimally);
this.buttonList.add(showArmorUI);
this.buttonList.add(showXPAlways);
this.buttonList.add(showHudBars);
}
Aggregations