{
if(event.phase == TickEvent.Phase.START)
{
this.renderTick = event.renderTickTime;
MorphInfoClient info1 = playerMorphInfo.get(mc.thePlayer.getCommandSenderName());
if(info1 != null )
{
float prog = info1.morphProgress > 10 ? (((float)info1.morphProgress + renderTick) / 60F) : 0.0F;
if(prog > 1.0F)
{
prog = 1.0F;
}
prog = (float)Math.pow(prog, 2);
float prev = info1.prevState != null && !(info1.prevState.entInstance instanceof EntityPlayer) ? info1.prevState.entInstance.getEyeHeight() : mc.thePlayer.yOffset + mc.thePlayer.getDefaultEyeHeight();
float next = info1.nextState != null && !(info1.nextState.entInstance instanceof EntityPlayer) ? info1.nextState.entInstance.getEyeHeight() : mc.thePlayer.yOffset + mc.thePlayer.getDefaultEyeHeight();
ySize = mc.thePlayer.yOffset - (prev + (next - prev) * prog) + mc.thePlayer.getDefaultEyeHeight();
eyeHeight = mc.thePlayer.eyeHeight;
mc.thePlayer.lastTickPosY -= ySize;
mc.thePlayer.prevPosY -= ySize;
mc.thePlayer.posY -= ySize;
mc.thePlayer.eyeHeight = mc.thePlayer.getDefaultEyeHeight();
shiftedPosY = true;
}
if(radialShow)
{
Mouse.getDX();
Mouse.getDY();
mc.mouseHelper.deltaX = mc.mouseHelper.deltaY = 0;
mc.renderViewEntity.prevRotationYawHead = mc.renderViewEntity.rotationYawHead = radialPlayerYaw;
mc.renderViewEntity.prevRotationYaw = mc.renderViewEntity.rotationYaw = radialPlayerYaw;
mc.renderViewEntity.prevRotationPitch = mc.renderViewEntity.rotationPitch = radialPlayerPitch;
}
// ySize = 0.0F;
// for(Entry<String, MorphInfoClient> e : playerMorphInfo.entrySet())
// {
// MorphInfoClient info = e.getValue();
// }
}
else
{
MorphInfoClient info = playerMorphInfo.get(mc.thePlayer.getCommandSenderName());
if(info != null)
{
shiftedPosY = false;
mc.thePlayer.lastTickPosY += ySize;
mc.thePlayer.prevPosY += ySize;
mc.thePlayer.posY += ySize;
mc.thePlayer.eyeHeight = eyeHeight;
}
float bossHealthScale = BossStatus.healthScale;
int bossStatusBarTime = BossStatus.statusBarTime;
String bossName = BossStatus.bossName;
boolean hasColorModifier = BossStatus.hasColorModifier;
if((selectorTimer > 0 || selectorShow) && !mc.gameSettings.hideGUI)
{
GL11.glPushMatrix();
float progress = (11F - ((float)selectorTimer + (1F - renderTick))) / 11F;
if(selectorShow)
{
progress = 1.0F - progress;
}
if(selectorShow && selectorTimer == 0)
{
progress = 0.0F;
}
progress = (float)Math.pow(progress, 2);
GL11.glTranslatef(-52F * progress, 0.0F, 0.0F);
ScaledResolution reso = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int gap = (reso.getScaledHeight() - (42 * 5)) / 2;
double size = 42D;
double width1 = 0.0D;
GL11.glPushMatrix();
int maxShowable = (int)Math.ceil((double)reso.getScaledHeight() / size) + 2;
if(selectorSelected == 0 && selectorSelectedPrev > 0 || selectorSelectedPrev == 0 && selectorSelected > 0)
{
maxShowable = 150;
}
float progressV = (float)(scrollTime - (scrollTimer - renderTick)) / (float)scrollTime;
progressV = (float)Math.pow(progressV, 2);
if(progressV > 1.0F)
{
progressV = 1.0F;
selectorSelectedPrev = selectorSelected;
}
float progressH = (float)(scrollTime - (scrollTimerHori - renderTick)) / (float)scrollTime;
progressH = (float)Math.pow(progressH, 2);
if(progressH > 1.0F)
{
progressH = 1.0F;
selectorSelectedHoriPrev = selectorSelectedHori;
}
GL11.glTranslatef(0.0F, ((selectorSelected - selectorSelectedPrev) * 42F) * (1.0F - progressV), 0.0F);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glColor4f(1f,1f,1f,1f);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 771);
int i = 0;
Iterator<Entry<String, ArrayList<MorphState>>> ite = playerMorphCatMap.entrySet().iterator();
while(ite.hasNext())
{
Entry<String, ArrayList<MorphState>> e = ite.next();
if(i > selectorSelected + maxShowable || i < selectorSelected - maxShowable)
{
i++;
continue;
}
double height1 = gap + size * (i - selectorSelected);
ArrayList<MorphState> states = e.getValue();
if(states == null || states.isEmpty())
{
ite.remove();
i++;
break;
}
Tessellator tessellator = Tessellator.instance;
if(i == selectorSelected)
{
if(selectorSelectedHori < 0)
{
selectorSelectedHori = states.size() - 1;
}
if(selectorSelectedHori >= states.size())
{
selectorSelectedHori = 0;
}
boolean newSlide = false;
if(progressV < 1.0F && selectorSelectedPrev != selectorSelected)
{
selectorSelectedHoriPrev = states.size() - 1;
selectorSelectedHori = 0;
newSlide = true;
}
if(!selectorShow)
{
selectorSelectedHori = states.size() - 1;
newSlide = true;
}
else if(progress > 0.0F)
{
selectorSelectedHoriPrev = states.size() - 1;
newSlide = true;
}
for(int j = 0; j < states.size(); j++)
{
GL11.glPushMatrix();
GL11.glTranslated(newSlide && j == 0 ? 0.0D : ((selectorSelectedHori - selectorSelectedHoriPrev) * 42F) * (1.0F - progressH), 0.0D, 0.0D);
mc.getTextureManager().bindTexture(states.size() == 1 || j == states.size() - 1 ? rlUnselected : rlUnselectedSide);
double dist = size * (j - selectorSelectedHori);
tessellator.startDrawingQuads();
tessellator.setColorOpaque_F(1f,1f,1f);
tessellator.addVertexWithUV(width1 + dist, height1 + size, -90.0D + j, 0.0D, 1.0D);
tessellator.addVertexWithUV(width1 + dist + size, height1 + size, -90.0D + j, 1.0D, 1.0D);
tessellator.addVertexWithUV(width1 + dist + size, height1, -90.0D + j, 1.0D, 0.0D);
tessellator.addVertexWithUV(width1 + dist, height1, -90.0D + j, 0.0D, 0.0D);
tessellator.draw();
GL11.glPopMatrix();
}
}
else
{
mc.getTextureManager().bindTexture(rlUnselected);
tessellator.startDrawingQuads();
tessellator.setColorOpaque_F(1f,1f,1f);
tessellator.addVertexWithUV(width1, height1 + size, -90.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV(width1 + size, height1 + size, -90.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV(width1 + size, height1, -90.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV(width1, height1, -90.0D, 0.0D, 0.0D);
tessellator.draw();
}
i++;
}
GL11.glDisable(GL11.GL_BLEND);
int height1 = gap;
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_ALPHA_TEST);
gap += 36;
i = 0;
ite = playerMorphCatMap.entrySet().iterator();
while(ite.hasNext())
{
Entry<String, ArrayList<MorphState>> e = ite.next();
if(i > selectorSelected + maxShowable || i < selectorSelected - maxShowable)
{
i++;
continue;
}
height1 = gap + (int)size * (i - selectorSelected);
ArrayList<MorphState> states = e.getValue();
if(i == selectorSelected)
{
boolean newSlide = false;
if(progressV < 1.0F && selectorSelectedPrev != selectorSelected)
{
selectorSelectedHoriPrev = states.size() - 1;
selectorSelectedHori = 0;
newSlide = true;
}
if(!selectorShow)
{
selectorSelectedHori = states.size() - 1;
newSlide = true;
}
for(int j = 0; j < states.size(); j++)
{
MorphState state = states.get(j);
GL11.glPushMatrix();
GL11.glTranslated(newSlide && j == 0 ? 0.0D : ((selectorSelectedHori - selectorSelectedHoriPrev) * 42F) * (1.0F - progressH), 0.0D, 0.0D);
double dist = size * (j - selectorSelectedHori);
GL11.glTranslated(dist, 0.0D, 0.0D);
float entSize = state.entInstance.width > state.entInstance.height ? state.entInstance.width : state.entInstance.height;
float prog = j - selectorSelectedHori == 0 ? (!selectorShow ? scrollTimerHori - renderTick : (3F - scrollTimerHori + renderTick)) / 3F : 0.0F;
prog = MathHelper.clamp_float(prog, 0.0F, 1.0F);
float scaleMag = ((2.5F + (entSize - 2.5F) * prog) / entSize) ;
drawEntityOnScreen(state, state.entInstance, 20, height1, entSize > 2.5F ? 16F * scaleMag : 16F, 2, 2, renderTick, true, j == states.size() - 1);
GL11.glPopMatrix();
}
}
else
{
MorphState state = states.get(0);
float entSize = state.entInstance.width > state.entInstance.height ? state.entInstance.width : state.entInstance.height;
float prog = selectorSelected == i ? (!selectorShow ? scrollTimer - renderTick : (3F - scrollTimer + renderTick)) / 3F : 0.0F;
prog = MathHelper.clamp_float(prog, 0.0F, 1.0F);
float scaleMag = (2.5F / entSize) ;
drawEntityOnScreen(state, state.entInstance, 20, height1, entSize > 2.5F ? 16F * scaleMag : 16F, 2, 2, renderTick, selectorSelected == i, true);
}
GL11.glTranslatef(0.0F, 0.0F, 20F);
i++;
}
GL11.glPopMatrix();
if(selectorShow)
{
GL11.glEnable(3042 /*GL_BLEND*/);
GL11.glBlendFunc(770, 771);
gap -= 36;
height1 = gap;
mc.getTextureManager().bindTexture(rlSelected);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorOpaque_F(1f,1f,1f);
tessellator.addVertexWithUV(width1, height1 + size, -90.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV(width1 + size, height1 + size, -90.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV(width1 + size, height1, -90.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV(width1, height1, -90.0D, 0.0D, 0.0D);
tessellator.draw();
GL11.glDisable(3042 /*GL_BLEND*/);
}
GL11.glPopMatrix();
}
//////////////////////
if(radialShow && !mc.gameSettings.hideGUI)
{
double mag = Math.sqrt(Morph.proxy.tickHandlerClient.radialDeltaX * Morph.proxy.tickHandlerClient.radialDeltaX + Morph.proxy.tickHandlerClient.radialDeltaY * Morph.proxy.tickHandlerClient.radialDeltaY);
double magAcceptance = 0.8D;
ScaledResolution reso = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
float prog = (3F - radialTime + renderTick) / 3F;
if(prog > 1.0F)
{
prog = 1.0F;
}
float rad = (mag > magAcceptance ? 0.85F : 0.82F) * prog;
int radius = 80;
radius *= Math.pow(prog, 0.5D);
if(!mc.gameSettings.hideGUI)
{
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
GL11.glLoadIdentity();
int NUM_PIZZA_SLICES = 100;
double zLev = 0.05D;
GL11.glDisable(GL11.GL_TEXTURE_2D);
final int stencilBit = MinecraftForgeClient.reserveStencilBit();
if(stencilBit >= 0)
{
GL11.glEnable(GL11.GL_STENCIL_TEST);
GL11.glDepthMask(false);
GL11.glColorMask(false, false, false, false);
final int stencilMask = 1 << stencilBit;
GL11.glStencilMask(stencilMask);
GL11.glStencilFunc(GL11.GL_ALWAYS, stencilMask, stencilMask);
GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE);
GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT);
rad = (mag > magAcceptance ? 0.85F : 0.82F) * prog * (257F / (float)reso.getScaledHeight());
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
GL11.glVertex3d(0, 0, zLev);
for(int i = 0; i <= NUM_PIZZA_SLICES; i++){ //NUM_PIZZA_SLICES decides how round the circle looks.
double angle = Math.PI * 2 * i / NUM_PIZZA_SLICES;
GL11.glVertex3d(Math.cos(angle) * reso.getScaledHeight_double() / reso.getScaledWidth_double() * rad, Math.sin(angle) * rad, zLev);
}
GL11.glEnd();
GL11.glStencilFunc(GL11.GL_ALWAYS, 0, stencilMask);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
rad = 0.44F * prog * (257F / (float)reso.getScaledHeight());
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
GL11.glVertex3d(0, 0, zLev);
for(int i = 0; i <= NUM_PIZZA_SLICES; i++){ //NUM_PIZZA_SLICES decides how round the circle looks.
double angle = Math.PI * 2 * i / NUM_PIZZA_SLICES;
GL11.glVertex3d(Math.cos(angle) * reso.getScaledHeight_double() / reso.getScaledWidth_double() * rad, Math.sin(angle) * rad, zLev);
}
GL11.glEnd();
GL11.glStencilMask(0x00);
GL11.glStencilFunc(GL11.GL_EQUAL, stencilMask, stencilMask);
GL11.glDepthMask(true);
GL11.glColorMask(true, true, true, true);
}
rad = (mag > magAcceptance ? 0.85F : 0.82F) * prog * (257F / (float)reso.getScaledHeight());
GL11.glColor4f(0.0F, 0.0F, 0.0F, mag > magAcceptance ? 0.6F : 0.4F);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
GL11.glVertex3d(0, 0, zLev);
for(int i = 0; i <= NUM_PIZZA_SLICES; i++){ //NUM_PIZZA_SLICES decides how round the circle looks.
double angle = Math.PI * 2 * i / NUM_PIZZA_SLICES;
GL11.glVertex3d(Math.cos(angle) * reso.getScaledHeight_double() / reso.getScaledWidth_double() * rad, Math.sin(angle) * rad, zLev);
}
GL11.glEnd();
if(stencilBit >= 0)
{
GL11.glDisable(GL11.GL_STENCIL_TEST);
}
MinecraftForgeClient.releaseStencilBit(stencilBit);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPopMatrix();
}
GL11.glPushMatrix();
int showAb = Morph.config.getSessionInt("showAbilitiesInGui");
Morph.config.updateSession("showAbilitiesInGui", 0);
double radialAngle = -720F;
if(mag > magAcceptance)
{
//is on radial menu
double aSin = Math.toDegrees(Math.asin(Morph.proxy.tickHandlerClient.radialDeltaX));
if(Morph.proxy.tickHandlerClient.radialDeltaY >= 0 && Morph.proxy.tickHandlerClient.radialDeltaX >= 0)
{
radialAngle = aSin;
}
else if(Morph.proxy.tickHandlerClient.radialDeltaY < 0 && Morph.proxy.tickHandlerClient.radialDeltaX >= 0)
{
radialAngle = 90D + (90D - aSin);
}
else if(Morph.proxy.tickHandlerClient.radialDeltaY < 0 && Morph.proxy.tickHandlerClient.radialDeltaX < 0)
{
radialAngle = 180D - aSin;
}
else if(Morph.proxy.tickHandlerClient.radialDeltaY >= 0 && Morph.proxy.tickHandlerClient.radialDeltaX < 0)
{
radialAngle = 270D + (90D + aSin);
}
}
if(mag > 0.9999999D)
{
mag = Math.round(mag);
}
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_ALPHA_TEST);
for(int i = 0; i < favouriteStates.size(); i++)
{
double angle = Math.PI * 2 * i / favouriteStates.size();
angle -= Math.toRadians(90D);
float leeway = 360F / favouriteStates.size();
boolean selected = false;
if(mag > magAcceptance * 0.75D && (i == 0 && (radialAngle < (leeway / 2) && radialAngle >= 0F || radialAngle > (360F) - (leeway / 2)) || i != 0 && radialAngle < (leeway * i) + (leeway / 2) && radialAngle > (leeway * i ) - (leeway / 2)))
{
selected = true;
}
favouriteStates.get(i).isFavourite = false;
float entSize = favouriteStates.get(i).entInstance.width > favouriteStates.get(i).entInstance.height ? favouriteStates.get(i).entInstance.width : favouriteStates.get(i).entInstance.height;
float scaleMag = entSize > 2.5F ? (float)((2.5F + (entSize - 2.5F) * (mag > magAcceptance && selected ? ((mag - magAcceptance) / (1.0F - magAcceptance)) : 0.0F)) / entSize) : 1.0F;
drawEntityOnScreen(favouriteStates.get(i), favouriteStates.get(i).entInstance, reso.getScaledWidth() / 2 + (int)(radius * Math.cos(angle)), (reso.getScaledHeight() + 32) / 2 + (int)(radius * Math.sin(angle)), 16 * prog * scaleMag + (float)(selected ? 6 * mag : 0), 2, 2, renderTick, selected, true);
favouriteStates.get(i).isFavourite = true;
}
Morph.config.updateSession("showAbilitiesInGui", showAb);
GL11.glPopMatrix();
}
//////////////////////
BossStatus.healthScale = bossHealthScale;
BossStatus.statusBarTime = bossStatusBarTime;
BossStatus.bossName = bossName;
BossStatus.hasColorModifier = hasColorModifier;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
for(Entry<String, MorphInfoClient> e : playerMorphInfo.entrySet())
{
MorphInfoClient morphInfo = e.getValue();
for(Ability ability : morphInfo.morphAbilities)
{
if(ability.inactive)
{
continue;