}
@SubscribeEvent
public void renderTick(TickEvent.RenderTickEvent event)
{
Minecraft mc = Minecraft.getMinecraft();
if(mc.theWorld != null)
{
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);