use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class AffinityData method loadNBTData.
@Override
public void loadNBTData(NBTTagCompound compound) {
NBTTagCompound tags = compound.getCompoundTag("AffinityDepthData");
setupAffinityDefaults();
for (Affinity affinity : Affinity.values()) {
if (tags.hasKey(affinity.name())) {
float depth = (float) tags.getDouble(affinity.name());
setAffinityAndDepth(affinity, depth);
}
}
isLocked = compound.getBoolean("AffinityLocked");
}
use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class AffinityData method setupAffinityDefaults.
private void setupAffinityDefaults() {
affinityDepths = new HashMap<Integer, Float>();
for (Affinity affinity : Affinity.values()) {
if (affinity == Affinity.NONE)
continue;
affinityDepths.put(affinity.ordinal(), 0f);
}
updateHighestAffinities();
}
use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class GuiSkillTrees method drawScreen.
@Override
public void drawScreen(int par1, int par2, float par3) {
SkillData sk = SkillData.For(Minecraft.getMinecraft().thePlayer);
int l = (width - xSize) / 2;
int i1 = (height - ySize) / 2;
if (AMCore.config.getSkillTreeSecondaryTierCap() < SkillTreeManager.instance.getHighestTier() && (sk.getPrimaryTree() == null || sk.getPrimaryTree() == SkillTrees.None) && sk.getSpellPoints(SkillPointTypes.BLUE) > 0) {
String s = StatCollector.translateToLocal("am2.gui.lockWarning");
fontRendererObj.drawSplitString(s, l - 120, i1 + 20, 110, 0xbf6325);
}
if (isDragging) {
int dx = lastMouseX - par1;
int dy = lastMouseY - par2;
this.offsetX += dx;
this.offsetY += dy;
if (this.offsetX < 0)
this.offsetX = 0;
if (this.offsetX > 180)
this.offsetX = 180;
if (this.offsetY < 0)
this.offsetY = 0;
if (this.offsetY > 180)
this.offsetY = 180;
}
lastMouseX = par1;
lastMouseY = par2;
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
if (activeTree == SkillTrees.Offense)
Minecraft.getMinecraft().renderEngine.bindTexture(rl_offense);
else if (activeTree == SkillTrees.Defense)
Minecraft.getMinecraft().renderEngine.bindTexture(rl_defense);
else if (activeTree == SkillTrees.Utility)
Minecraft.getMinecraft().renderEngine.bindTexture(rl_utility);
else if (activeTree == SkillTrees.Talents || activeTree == SkillTrees.Affinity)
Minecraft.getMinecraft().renderEngine.bindTexture(rl_talents);
else
return;
drawTexturedModalRect_Classic(l + 5, i1 + GuiButtonSkillTreeTab.buttonHeight + 5, offsetX, offsetY, 200, 200, 75, 75);
if (activeTree == SkillTrees.Affinity) {
drawAffinity();
} else {
drawSkillTree();
}
GL11.glColor3f(1.0f, 1.0f, 1.0f);
Minecraft.getMinecraft().renderEngine.bindTexture(rl_background);
drawTexturedModalRect(l, i1 + GuiButtonSkillTreeTab.buttonHeight, 0, 0, 210, 210);
drawTexturedModalRect(l + xSize - 29, i1, 210, 0, 37, 37);
String quantity = String.format("%d", sk.getSpellPoints(SkillPointTypes.BLUE));
Minecraft.getMinecraft().fontRenderer.drawString(quantity, l + xSize - 24 - (Minecraft.getMinecraft().fontRenderer.getStringWidth(quantity) / 2), i1 + 5, 0x0000FF);
quantity = String.format("%d", sk.getSpellPoints(SkillPointTypes.GREEN));
Minecraft.getMinecraft().fontRenderer.drawString(quantity, l + xSize - 12 - (Minecraft.getMinecraft().fontRenderer.getStringWidth(quantity) / 2), i1 + 5, 0x00FF00);
quantity = String.format("%d", sk.getSpellPoints(SkillPointTypes.RED));
Minecraft.getMinecraft().fontRenderer.drawString(quantity, l + xSize - 18 - (Minecraft.getMinecraft().fontRenderer.getStringWidth(quantity) / 2), i1 + 15, 0xFF0000);
super.drawScreen(par1, par2, par3);
if (hoveredItem != null) {
ArrayList<String> text = new ArrayList<String>();
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
String s = SkillManager.instance.getDisplayName(hoveredItem.registeredItem);
LearnStates state = sk.getLearnState(hoveredItem, Minecraft.getMinecraft().thePlayer);
if (state == LearnStates.LEARNED)
s += " (" + StatCollector.translateToLocal("am2.gui.known") + ")";
else if (state == LearnStates.CAN_LEARN)
s += " (" + StatCollector.translateToLocal("am2.gui.notLearned") + ")";
else if (state == LearnStates.DISABLED)
s = StatCollector.translateToLocal("am2.gui.cfgDisabled");
// else fr = Minecraft.getMinecraft().standardGalacticFontRenderer;
text.add(s);
SkillPointTypes type = SkillTreeManager.instance.getSkillPointTypeForPart(hoveredItem.registeredItem);
if (hoveredItem.registeredItem instanceof ISpellComponent) {
EnumSet<Affinity> aff = ((ISpellComponent) hoveredItem.registeredItem).getAffinity();
int affX = lastMouseX + 14;
int affY = lastMouseY - 34;
drawGradientAround(affX - 2, affY - 2, 18 * aff.size() + 2, 18);
for (Affinity a : aff) {
if (a == Affinity.NONE)
continue;
DrawIconAtXY(a.representItem.getIconFromDamage(a.representMeta), "item", affX, affY, 16, 16, false);
affX += 18;
}
}
if (!AMCore.config.colourblindMode()) {
drawHoveringText(text, lastMouseX, lastMouseY, fr, state == LearnStates.LEARNED ? 0xFFFFFF : type == SkillPointTypes.SILVER ? 0x888888 : type == SkillPointTypes.BLUE ? 0x4444FF : type == SkillPointTypes.GREEN ? 0x44FF44 : 0xFF4444);
} else {
text.add(StatCollector.translateToLocal("am2.gui." + type.toString().toLowerCase() + "Point"));
drawHoveringText(text, lastMouseX, lastMouseY, fr, 0xFFFFFF);
}
}
if (hoveredAffinity != null) {
List list = AffinityData.For(Minecraft.getMinecraft().thePlayer).getColoredAffinityEffects(hoveredAffinity);
// list.add(0, "\247f" + hoveredAffinity.name());
drawHoveringText(list, lastMouseX, lastMouseY, fontRendererObj, 0xFFFFFF);
}
}
use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class GuiSkillTrees method drawAffinity.
private void drawAffinity() {
hoveredAffinity = null;
int l = (width - xSize) / 2;
int i1 = (height - ySize) / 2;
int IIconsize = 16;
int halfIconSize = IIconsize / 2;
int cx = l + xSize / 2 - halfIconSize;
int cy = i1 + ySize / 2 - halfIconSize;
int angle = -90;
int distance = 85;
int smallDist = 15;
float angleOffset = 17.5f;
AffinityData ad = AffinityData.For(Minecraft.getMinecraft().thePlayer);
for (Affinity aff : Affinity.getOrderedAffinities()) {
IIcon IIcon = aff.representItem.getIconFromDamage(aff.representMeta);
int newX = (int) (cx + Math.cos(Math.toRadians(angle)) * distance);
int newY = (int) (cy + Math.sin(Math.toRadians(angle)) * distance);
int cx1 = (int) (cx + Math.cos(Math.toRadians(angle + angleOffset)) * smallDist);
int cx2 = (int) (cx + Math.cos(Math.toRadians(angle - angleOffset)) * smallDist);
int cy1 = (int) (cy + Math.sin(Math.toRadians(angle + angleOffset)) * smallDist);
int cy2 = (int) (cy + Math.sin(Math.toRadians(angle - angleOffset)) * smallDist);
float depthDist = ((distance - smallDist) * ad.getAffinityDepth(aff)) + smallDist;
int lx = (int) (cx + Math.cos(Math.toRadians(angle)) * depthDist);
int ly = (int) (cy + Math.sin(Math.toRadians(angle)) * depthDist);
int displace = (int) ((Math.max(cx1, cx2) - Math.min(cx1, cx2) + Math.max(cy1, cy2) - Math.min(cy1, cy2)) / 3f);
if (ad.getAffinityDepth(aff) > 0.01f) {
AMGuiHelper.instance.fractalLine2d(lx + halfIconSize, ly + halfIconSize, cx1 + halfIconSize, cy1 + halfIconSize, this.zLevel, aff.color, displace, 1.1f);
AMGuiHelper.instance.fractalLine2d(lx + halfIconSize, ly + halfIconSize, cx2 + halfIconSize, cy2 + halfIconSize, this.zLevel, aff.color, displace, 1.1f);
AMGuiHelper.instance.fractalLine2d(cx1 + halfIconSize, cy1 + halfIconSize, lx + halfIconSize, ly + halfIconSize, this.zLevel, aff.color, displace, 0.8f);
AMGuiHelper.instance.fractalLine2d(cx2 + halfIconSize, cy2 + halfIconSize, lx + halfIconSize, ly + halfIconSize, this.zLevel, aff.color, displace, 0.8f);
} else {
AMGuiHelper.instance.line2d(lx + halfIconSize, ly + halfIconSize, cx1 + halfIconSize, cy1 + halfIconSize, this.zLevel, aff.color);
AMGuiHelper.instance.line2d(lx + halfIconSize, ly + halfIconSize, cx2 + halfIconSize, cy2 + halfIconSize, this.zLevel, aff.color);
}
DrawIconAtXY(IIcon, "items", newX, newY, IIconsize, IIconsize, false);
String depthString = String.format("%.2f", ad.getAffinityDepth(aff) * 100);
fontRendererObj.drawString(depthString, newX + halfIconSize - fontRendererObj.getStringWidth(depthString) / 2, newY + IIconsize, aff.color, false);
angle += 36;
// if (lastMouseX > l && lastMouseX < l + xSize && lastMouseY > i1 && lastMouseY < i1 + ySize){
if (lastMouseX > newX && lastMouseX < newX + IIconsize) {
if (lastMouseY > newY && lastMouseY < newY + IIconsize) {
hoveredAffinity = aff;
}
}
// }
}
}
use of am2.api.spell.enums.Affinity in project ArsMagica2 by Mithion.
the class ModelFlicker method render.
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
Affinity aff = ((EntityFlicker) entity).getFlickerAffinity();
GL11.glPushMatrix();
GL11.glColor3f(((aff.color >> 16) & 0xFF) / 255.0f, ((aff.color >> 8) & 0xFF) / 255.0f, (aff.color & 0xFF) / 255.0f);
GL11.glTranslatef(-0.05f, 1.3f, -0.05f);
GL11.glRotatef(-entity.rotationPitch, 1, 0, 0);
GL11.glScalef(0.5f, 0.5f, 0.5f);
Body.render(f5);
Head.render(f5);
RightArm.render(f5);
LeftArm.render(f5);
LegBase.render(f5);
RightHorn.render(f5);
LeftHorn.render(f5);
GL11.glPopMatrix();
}
Aggregations