Star star = solarSystem.getMainStar();
if (star != null && star.getBodyIcon() != null)
{
GL11.glPushMatrix();
Matrix4f worldMatrix0 = new Matrix4f(worldMatrix);
Matrix4f.translate(this.getCelestialBodyPosition(star), worldMatrix0, worldMatrix0);
Matrix4f worldMatrix1 = new Matrix4f();
Matrix4f.rotate((float) Math.toRadians(45), new Vector3f(0, 0, 1), worldMatrix1, worldMatrix1);
Matrix4f.rotate((float) Math.toRadians(-55), new Vector3f(1, 0, 0), worldMatrix1, worldMatrix1);
worldMatrix1 = Matrix4f.mul(worldMatrix0, worldMatrix1, worldMatrix1);
fb.rewind();
worldMatrix1.store(fb);
fb.flip();
GL11.glMultMatrix(fb);
float alpha = 1.0F;
if (this.selectedBody != null && this.selectedBody != star && this.selectionCount >= 2)
{
alpha = 1.0F - Math.min(this.ticksSinceSelection / 25.0F, 1.0F);
}
if (this.selectedBody != null && this.selectionCount >= 2)
{
if (star != this.selectedBody)
{
alpha = 1.0F - Math.min(this.ticksSinceSelection / 25.0F, 1.0F);
if (!(this.lastSelectedBody instanceof Star) && this.lastSelectedBody != null)
{
alpha = 0.0F;
}
}
}
if (alpha != 0)
{
CelestialBodyRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.Pre(star, star.getBodyIcon(), 8);
MinecraftForge.EVENT_BUS.post(preEvent);
GL11.glColor4f(1, 1, 1, alpha);
if (preEvent.celestialBodyTexture != null)
{
this.mc.renderEngine.bindTexture(preEvent.celestialBodyTexture);
}
if (!preEvent.isCanceled())
{
int size = this.getWidthForCelestialBody(star);
this.drawTexturedModalRect(-size / 2, -size / 2, size, size, 0, 0, preEvent.textureSize, preEvent.textureSize, false, false, preEvent.textureSize);
matrixMap.put(star, worldMatrix1);
}
CelestialBodyRenderEvent.Post postEvent = new CelestialBodyRenderEvent.Post(star);
MinecraftForge.EVENT_BUS.post(postEvent);
}
fb.clear();
GL11.glPopMatrix();
}
}
for (Planet planet : GalaxyRegistry.getRegisteredPlanets().values())
{
if (planet.getBodyIcon() != null)
{
GL11.glPushMatrix();
Matrix4f worldMatrix0 = new Matrix4f(worldMatrix);
Matrix4f.translate(this.getCelestialBodyPosition(planet), worldMatrix0, worldMatrix0);
Matrix4f worldMatrix1 = new Matrix4f();
Matrix4f.rotate((float) Math.toRadians(45), new Vector3f(0, 0, 1), worldMatrix1, worldMatrix1);
Matrix4f.rotate((float) Math.toRadians(-55), new Vector3f(1, 0, 0), worldMatrix1, worldMatrix1);
worldMatrix1 = Matrix4f.mul(worldMatrix0, worldMatrix1, worldMatrix1);
fb.rewind();
worldMatrix1.store(fb);
fb.flip();
GL11.glMultMatrix(fb);
float alpha = 1.0F;
if ((this.selectedBody instanceof IChildBody && ((IChildBody) this.selectedBody).getParentPlanet() != planet) || (this.selectedBody instanceof Planet && this.selectedBody != planet && this.selectionCount >= 2))
{
if (this.lastSelectedBody == null && !(this.selectedBody instanceof IChildBody))
{
alpha = 1.0F - Math.min(this.ticksSinceSelection / 25.0F, 1.0F);
}
else
{
alpha = 0.0F;
}
}
if (alpha != 0)
{
CelestialBodyRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.Pre(planet, planet.getBodyIcon(), 12);
MinecraftForge.EVENT_BUS.post(preEvent);
GL11.glColor4f(1, 1, 1, alpha);
if (preEvent.celestialBodyTexture != null)
{
this.mc.renderEngine.bindTexture(preEvent.celestialBodyTexture);
}
if (!preEvent.isCanceled())
{
int size = this.getWidthForCelestialBody(planet);
this.drawTexturedModalRect(-size / 2, -size / 2, size, size, 0, 0, preEvent.textureSize, preEvent.textureSize, false, false, preEvent.textureSize);
matrixMap.put(planet, worldMatrix1);
}
CelestialBodyRenderEvent.Post postEvent = new CelestialBodyRenderEvent.Post(planet);
MinecraftForge.EVENT_BUS.post(postEvent);
}
fb.clear();
GL11.glPopMatrix();
}
}
if (this.selectedBody != null)
{
Matrix4f worldMatrix0 = new Matrix4f(worldMatrix);
for (Moon moon : GalaxyRegistry.getRegisteredMoons().values())
{
if ((moon == this.selectedBody || (moon.getParentPlanet() == this.selectedBody && this.selectionCount != 1)) && (this.ticksSinceSelection > 35 || this.selectedBody == moon || (this.lastSelectedBody instanceof Moon && GalaxyRegistry.getMoonsForPlanet(((Moon) this.lastSelectedBody).getParentPlanet()).contains(moon))))
{
GL11.glPushMatrix();
Matrix4f worldMatrix1 = new Matrix4f(worldMatrix0);
Matrix4f.translate(this.getCelestialBodyPosition(moon), worldMatrix1, worldMatrix1);
Matrix4f worldMatrix2 = new Matrix4f();
Matrix4f.rotate((float) Math.toRadians(45), new Vector3f(0, 0, 1), worldMatrix2, worldMatrix2);
Matrix4f.rotate((float) Math.toRadians(-55), new Vector3f(1, 0, 0), worldMatrix2, worldMatrix2);
Matrix4f.scale(new Vector3f(0.25F, 0.25F, 1.0F), worldMatrix2, worldMatrix2);
worldMatrix2 = Matrix4f.mul(worldMatrix1, worldMatrix2, worldMatrix2);
fb.rewind();
worldMatrix2.store(fb);
fb.flip();
GL11.glMultMatrix(fb);
CelestialBodyRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.Pre(moon, moon.getBodyIcon(), 8);
MinecraftForge.EVENT_BUS.post(preEvent);
GL11.glColor4f(1, 1, 1, 1);
if (preEvent.celestialBodyTexture != null)
{
this.mc.renderEngine.bindTexture(preEvent.celestialBodyTexture);
}
if (!preEvent.isCanceled())
{
int size = this.getWidthForCelestialBody(moon);
this.drawTexturedModalRect(-size / 2, -size / 2, size, size, 0, 0, preEvent.textureSize, preEvent.textureSize, false, false, preEvent.textureSize);
matrixMap.put(moon, worldMatrix1);
}
CelestialBodyRenderEvent.Post postEvent = new CelestialBodyRenderEvent.Post(moon);
MinecraftForge.EVENT_BUS.post(postEvent);
fb.clear();
GL11.glPopMatrix();
}
}
}
if (this.selectedBody != null)
{
Matrix4f worldMatrix0 = new Matrix4f(worldMatrix);
for (Satellite satellite : GalaxyRegistry.getRegisteredSatellites().values())
{
if (this.possibleBodies != null && this.possibleBodies.contains(satellite))
{
if ((satellite == this.selectedBody || (satellite.getParentPlanet() == this.selectedBody && this.selectionCount != 1)) && (this.ticksSinceSelection > 35 || this.selectedBody == satellite || (this.lastSelectedBody instanceof Satellite && GalaxyRegistry.getSatellitesForCelestialBody(((Satellite) this.lastSelectedBody).getParentPlanet()).contains(satellite))))
{
GL11.glPushMatrix();
Matrix4f worldMatrix1 = new Matrix4f(worldMatrix0);
Matrix4f.translate(this.getCelestialBodyPosition(satellite), worldMatrix1, worldMatrix1);
Matrix4f worldMatrix2 = new Matrix4f();
Matrix4f.rotate((float) Math.toRadians(45), new Vector3f(0, 0, 1), worldMatrix2, worldMatrix2);
Matrix4f.rotate((float) Math.toRadians(-55), new Vector3f(1, 0, 0), worldMatrix2, worldMatrix2);
Matrix4f.scale(new Vector3f(0.25F, 0.25F, 1.0F), worldMatrix2, worldMatrix2);
worldMatrix2 = Matrix4f.mul(worldMatrix1, worldMatrix2, worldMatrix2);
fb.rewind();
worldMatrix2.store(fb);
fb.flip();
GL11.glMultMatrix(fb);
CelestialBodyRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.Pre(satellite, satellite.getBodyIcon(), 8);
MinecraftForge.EVENT_BUS.post(preEvent);