if(this.level == null) {
this.generateLevel(1);
}
}
this.particleManager = new ParticleManager(this.level, this.textureManager);
if(this.levelLoaded) {
try {
var1.cursor = new Cursor(16, 16, 0, 0, 1, var9, (IntBuffer)null);
} catch (LWJGLException var53) {
var53.printStackTrace();
}
}
try {
var1.soundPlayer = new SoundPlayer(var1.settings);
SoundPlayer var4 = var1.soundPlayer;
try {
AudioFormat var67 = new AudioFormat(44100.0F, 16, 2, true, true);
var4.dataLine = AudioSystem.getSourceDataLine(var67);
var4.dataLine.open(var67, 4410);
var4.dataLine.start();
var4.running = true;
Thread var72;
(var72 = new Thread(var4)).setDaemon(true);
var72.setPriority(10);
var72.start();
} catch (Exception var51) {
var51.printStackTrace();
var4.running = false;
}
var1.resourceThread = new ResourceDownloadThread(var2, var1);
var1.resourceThread.start();
} catch (Exception var52) {
;
}
checkGLError("Post startup");
this.hud = new HUDScreen(this, this.width, this.height);
(new SkinDownloadThread(this)).start();
if(this.server != null && this.session != null) {
this.networkManager = new NetworkManager(this, this.server, this.port, this.session.username, this.session.mppass);
}
} catch (Exception var62) {
var62.printStackTrace();
JOptionPane.showMessageDialog((Component)null, var62.toString(), "Failed to start Minecraft", 0);
return;
}
long var13 = System.currentTimeMillis();
int var15 = 0;
try {
while(this.running) {
if(this.waiting) {
Thread.sleep(100L);
} else {
if(this.canvas == null && Display.isCloseRequested()) {
this.running = false;
}
try {
Timer var63 = this.timer;
long var16;
long var18 = (var16 = System.currentTimeMillis()) - var63.lastSysClock;
long var20 = System.nanoTime() / 1000000L;
double var24;
if(var18 > 1000L) {
long var22 = var20 - var63.lastHRClock;
var24 = (double)var18 / (double)var22;
var63.adjustment += (var24 - var63.adjustment) * 0.20000000298023224D;
var63.lastSysClock = var16;
var63.lastHRClock = var20;
}
if(var18 < 0L) {
var63.lastSysClock = var16;
var63.lastHRClock = var20;
}
double var95;
var24 = ((var95 = (double)var20 / 1000.0D) - var63.lastHR) * var63.adjustment;
var63.lastHR = var95;
if(var24 < 0.0D) {
var24 = 0.0D;
}
if(var24 > 1.0D) {
var24 = 1.0D;
}
var63.elapsedDelta = (float)((double)var63.elapsedDelta + var24 * (double)var63.speed * (double)var63.tps);
var63.elapsedTicks = (int)var63.elapsedDelta;
if(var63.elapsedTicks > 100) {
var63.elapsedTicks = 100;
}
var63.elapsedDelta -= (float)var63.elapsedTicks;
var63.delta = var63.elapsedDelta;
for(int var64 = 0; var64 < this.timer.elapsedTicks; ++var64) {
++this.ticks;
this.tick();
}
checkGLError("Pre render");
GL11.glEnable(3553);
if(!this.online) {
this.gamemode.applyCracks(this.timer.delta);
float var65 = this.timer.delta;
Renderer var66 = this.renderer;
if(this.renderer.displayActive && !Display.isActive()) {
var66.minecraft.pause();
}
var66.displayActive = Display.isActive();
int var68;
int var70;
int var86;
int var81;
if(var66.minecraft.hasMouse) {
var81 = 0;
var86 = 0;
if(var66.minecraft.levelLoaded) {
if(var66.minecraft.canvas != null) {
Point var90;
var70 = (var90 = var66.minecraft.canvas.getLocationOnScreen()).x + var66.minecraft.width / 2;
var68 = var90.y + var66.minecraft.height / 2;
Point var75;
var81 = (var75 = MouseInfo.getPointerInfo().getLocation()).x - var70;
var86 = -(var75.y - var68);
var66.minecraft.robot.mouseMove(var70, var68);
} else {
Mouse.setCursorPosition(var66.minecraft.width / 2, var66.minecraft.height / 2);
}
} else {
var81 = Mouse.getDX();
var86 = Mouse.getDY();
}
byte var91 = 1;
if(var66.minecraft.settings.invertMouse) {
var91 = -1;
}
var66.minecraft.player.turn((float)var81, (float)(var86 * var91));
}
if(!var66.minecraft.online) {
var81 = var66.minecraft.width * 240 / var66.minecraft.height;
var86 = var66.minecraft.height * 240 / var66.minecraft.height;
int var94 = Mouse.getX() * var81 / var66.minecraft.width;
var70 = var86 - Mouse.getY() * var86 / var66.minecraft.height - 1;
if(var66.minecraft.level != null) {
float var80 = var65;
Renderer var82 = var66;
Renderer var27 = var66;
Player var28;
float var29 = (var28 = var66.minecraft.player).xRotO + (var28.xRot - var28.xRotO) * var65;
float var30 = var28.yRotO + (var28.yRot - var28.yRotO) * var65;
Vec3D var31 = var66.getPlayerVector(var65);
float var32 = MathHelper.cos(-var30 * 0.017453292F - 3.1415927F);
float var69 = MathHelper.sin(-var30 * 0.017453292F - 3.1415927F);
float var74 = MathHelper.cos(-var29 * 0.017453292F);
float var33 = MathHelper.sin(-var29 * 0.017453292F);
float var34 = var69 * var74;
float var87 = var32 * var74;
float var36 = var66.minecraft.gamemode.getReachDistance();
Vec3D var71 = var31.add(var34 * var36, var33 * var36, var87 * var36);
var66.minecraft.selected = var66.minecraft.level.clip(var31, var71);
var74 = var36;
if(var66.minecraft.selected != null) {
var74 = var66.minecraft.selected.vec.distance(var66.getPlayerVector(var65));
}
var31 = var66.getPlayerVector(var65);
if(var66.minecraft.gamemode instanceof CreativeGameMode) {
var36 = 32.0F;
} else {
var36 = var74;
}
var71 = var31.add(var34 * var36, var33 * var36, var87 * var36);
var66.entity = null;
List var37 = var66.minecraft.level.blockMap.getEntities(var28, var28.bb.expand(var34 * var36, var33 * var36, var87 * var36));
float var35 = 0.0F;
for(var81 = 0; var81 < var37.size(); ++var81) {
Entity var88;
if((var88 = (Entity)var37.get(var81)).isPickable()) {
var74 = 0.1F;
MovingObjectPosition var78;
if((var78 = var88.bb.grow(var74, var74, var74).clip(var31, var71)) != null && ((var74 = var31.distance(var78.vec)) < var35 || var35 == 0.0F)) {
var27.entity = var88;
var35 = var74;
}
}
}
if(var27.entity != null && !(var27.minecraft.gamemode instanceof CreativeGameMode)) {
var27.minecraft.selected = new MovingObjectPosition(var27.entity);
}
int var77 = 0;
while(true) {
if(var77 >= 2) {
GL11.glColorMask(true, true, true, false);
break;
}
if(var82.minecraft.settings.anaglyph) {
if(var77 == 0) {
GL11.glColorMask(false, true, true, false);
} else {
GL11.glColorMask(true, false, false, false);
}
}
Player var126 = var82.minecraft.player;
Level var119 = var82.minecraft.level;
LevelRenderer var89 = var82.minecraft.levelRenderer;
ParticleManager var93 = var82.minecraft.particleManager;
GL11.glViewport(0, 0, var82.minecraft.width, var82.minecraft.height);
Level var26 = var82.minecraft.level;
var28 = var82.minecraft.player;
var29 = 1.0F / (float)(4 - var82.minecraft.settings.viewDistance);
var29 = 1.0F - (float)Math.pow((double)var29, 0.25D);
var30 = (float)(var26.skyColor >> 16 & 255) / 255.0F;
float var117 = (float)(var26.skyColor >> 8 & 255) / 255.0F;
var32 = (float)(var26.skyColor & 255) / 255.0F;
var82.fogRed = (float)(var26.fogColor >> 16 & 255) / 255.0F;
var82.fogBlue = (float)(var26.fogColor >> 8 & 255) / 255.0F;
var82.fogGreen = (float)(var26.fogColor & 255) / 255.0F;
var82.fogRed += (var30 - var82.fogRed) * var29;
var82.fogBlue += (var117 - var82.fogBlue) * var29;
var82.fogGreen += (var32 - var82.fogGreen) * var29;
var82.fogRed *= var82.fogColorMultiplier;
var82.fogBlue *= var82.fogColorMultiplier;
var82.fogGreen *= var82.fogColorMultiplier;
Block var73;
if((var73 = Block.blocks[var26.getTile((int)var28.x, (int)(var28.y + 0.12F), (int)var28.z)]) != null && var73.getLiquidType() != LiquidType.NOT_LIQUID) {
LiquidType var79;
if((var79 = var73.getLiquidType()) == LiquidType.WATER) {
var82.fogRed = 0.02F;
var82.fogBlue = 0.02F;
var82.fogGreen = 0.2F;
} else if(var79 == LiquidType.LAVA) {
var82.fogRed = 0.6F;
var82.fogBlue = 0.1F;
var82.fogGreen = 0.0F;
}
}
if(var82.minecraft.settings.anaglyph) {
var74 = (var82.fogRed * 30.0F + var82.fogBlue * 59.0F + var82.fogGreen * 11.0F) / 100.0F;
var33 = (var82.fogRed * 30.0F + var82.fogBlue * 70.0F) / 100.0F;
var34 = (var82.fogRed * 30.0F + var82.fogGreen * 70.0F) / 100.0F;
var82.fogRed = var74;
var82.fogBlue = var33;
var82.fogGreen = var34;
}
GL11.glClearColor(var82.fogRed, var82.fogBlue, var82.fogGreen, 0.0F);
GL11.glClear(16640);
var82.fogColorMultiplier = 1.0F;
GL11.glEnable(2884);
var82.fogEnd = (float)(512 >> (var82.minecraft.settings.viewDistance << 1));
GL11.glMatrixMode(5889);
GL11.glLoadIdentity();
var29 = 0.07F;
if(var82.minecraft.settings.anaglyph) {
GL11.glTranslatef((float)(-((var77 << 1) - 1)) * var29, 0.0F, 0.0F);
}
Player var116 = var82.minecraft.player;
var69 = 70.0F;
if(var116.health <= 0) {
var74 = (float)var116.deathTime + var80;
var69 /= (1.0F - 500.0F / (var74 + 500.0F)) * 2.0F + 1.0F;
}
GLU.gluPerspective(var69, (float)var82.minecraft.width / (float)var82.minecraft.height, 0.05F, var82.fogEnd);
GL11.glMatrixMode(5888);
GL11.glLoadIdentity();
if(var82.minecraft.settings.anaglyph) {
GL11.glTranslatef((float)((var77 << 1) - 1) * 0.1F, 0.0F, 0.0F);
}
var82.hurtEffect(var80);
if(var82.minecraft.settings.viewBobbing) {
var82.applyBobbing(var80);
}
var116 = var82.minecraft.player;
GL11.glTranslatef(0.0F, 0.0F, -0.1F);
GL11.glRotatef(var116.xRotO + (var116.xRot - var116.xRotO) * var80, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(var116.yRotO + (var116.yRot - var116.yRotO) * var80, 0.0F, 1.0F, 0.0F);
var69 = var116.xo + (var116.x - var116.xo) * var80;
var74 = var116.yo + (var116.y - var116.yo) * var80;
var33 = var116.zo + (var116.z - var116.zo) * var80;
GL11.glTranslatef(-var69, -var74, -var33);
Frustrum var76 = FrustrumImpl.update();
Frustrum var100 = var76;
LevelRenderer var101 = var82.minecraft.levelRenderer;
int var98;
for(var98 = 0; var98 < var101.chunkCache.length; ++var98) {
var101.chunkCache[var98].clip(var100);
}
var101 = var82.minecraft.levelRenderer;
Collections.sort(var82.minecraft.levelRenderer.chunks, new ChunkDirtyDistanceComparator(var126));
var98 = var101.chunks.size() - 1;
int var105;
if((var105 = var101.chunks.size()) > 3) {
var105 = 3;
}
int var104;
for(var104 = 0; var104 < var105; ++var104) {
Chunk var118;
(var118 = (Chunk)var101.chunks.remove(var98 - var104)).update();
var118.loaded = false;
}
var82.updateFog();
GL11.glEnable(2912);
var89.sortChunks(var126, 0);
int var83;
int var110;
ShapeRenderer var115;
int var114;
int var125;
int var122;
int var120;
if(var119.isSolid(var126.x, var126.y, var126.z, 0.1F)) {
var120 = (int)var126.x;
var83 = (int)var126.y;
var110 = (int)var126.z;
for(var122 = var120 - 1; var122 <= var120 + 1; ++var122) {
for(var125 = var83 - 1; var125 <= var83 + 1; ++var125) {
for(int var38 = var110 - 1; var38 <= var110 + 1; ++var38) {
var105 = var38;
var98 = var125;
int var99 = var122;
if((var104 = var89.level.getTile(var122, var125, var38)) != 0 && Block.blocks[var104].isSolid()) {
GL11.glColor4f(0.2F, 0.2F, 0.2F, 1.0F);
GL11.glDepthFunc(513);
var115 = ShapeRenderer.instance;
ShapeRenderer.instance.begin();
for(var114 = 0; var114 < 6; ++var114) {
Block.blocks[var104].renderInside(var115, var99, var98, var105, var114);
}
var115.end();
GL11.glCullFace(1028);
var115.begin();
for(var114 = 0; var114 < 6; ++var114) {
Block.blocks[var104].renderInside(var115, var99, var98, var105, var114);
}
var115.end();
GL11.glCullFace(1029);
GL11.glDepthFunc(515);
}
}
}
}
}
var82.setLighting(true);
Vec3D var103 = var82.getPlayerVector(var80);
var89.level.blockMap.render(var103, var76, var89.textureManager, var80);
var82.setLighting(false);
var82.updateFog();
float var107 = var80;
ParticleManager var96 = var93;
var29 = -MathHelper.cos(var126.yRot * 3.1415927F / 180.0F);
var117 = -(var30 = -MathHelper.sin(var126.yRot * 3.1415927F / 180.0F)) * MathHelper.sin(var126.xRot * 3.1415927F / 180.0F);
var32 = var29 * MathHelper.sin(var126.xRot * 3.1415927F / 180.0F);
var69 = MathHelper.cos(var126.xRot * 3.1415927F / 180.0F);