Ok (désolé pour la réponse un peu tardive) et merci 🙂
EDIT :
Alors j’ai réussi à faire rendre la barre vide ou pleine mais pas autrement. Je cherche toujours…
DOUBLE EDIT :
C’est bon tout marche, un simple cast en float a tout solutionné.
Code mis à jour :
if(event.isCancelable() || event.type != ElementType.EXPERIENCE)
{
}
else
{
int mX = event.resolution.getScaledWidth();
int mY = event.resolution.getScaledHeight();
float pixel = 1/64F;
byte mbar_length = 94, mbar_height = 9;
byte bar_length = 100, bar_height = 15;
byte tex_mana_length = 60;
PlayerData dat = PlayerData.get(this.mc.thePlayer);
double charge = ((float)dat.getMana()/dat.getPlayerMaxMana()) * mbar_length;
double tex_charge = ((float)dat.getMana()/dat.getPlayerMaxMana()) * tex_mana_length;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
this.mc.renderEngine.bindTexture(gui_mana);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
{
// Bar
tess.addVertexWithUV(mX - 110, mY - 25, -1, 0*pixel, 0*pixel);
tess.addVertexWithUV(mX - 110, mY - 10, -1, 0*pixel, 9*pixel);
tess.addVertexWithUV(mX - 10, mY - 10, -1, 64*pixel, 9*pixel);
tess.addVertexWithUV(mX - 10, mY - 25, -1, 64*pixel, 0*pixel);
// Mana
tess.addVertexWithUV(mX - 107, mY - 22, 0, 0*pixel, 9*pixel);
tess.addVertexWithUV(mX - 107, mY - 13, 0, 0*pixel, 14*pixel);
tess.addVertexWithUV((mX - 107) + charge, mY - 13, 0, tex_charge*pixel, 14*pixel);
tess.addVertexWithUV((mX - 107) + charge, mY - 22, 0, tex_charge*pixel, 9*pixel);
}
tess.draw();
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
mc.fontRenderer.drawStringWithShadow("Lvl :", mX - 50, 5, new Color(255, 255, 255).getRGB());
mc.fontRenderer.drawStringWithShadow("XP :", mX - 107, 15, new Color(255, 255, 255).getRGB());
mc.fontRenderer.drawStringWithShadow("100", mX - 25, 5, new Color(255, 255, 255).getRGB());
mc.fontRenderer.drawStringWithShadow("500000/500000", mX - 85, 15, new Color(255, 255, 255).getRGB());
}