package ellpeck.actuallyadditions.blocks.render; import ellpeck.actuallyadditions.gadget.cloud.ISmileyCloudEasterEgg; import ellpeck.actuallyadditions.gadget.cloud.SmileyCloudEasterEggs; import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.tileentity.TileEntity; import org.lwjgl.opengl.GL11; public class RenderSmileyCloud extends RenderTileEntity{ public RenderSmileyCloud(ModelBaseAA model){ super(model); } @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){ if(!(tile instanceof TileEntitySmileyCloud)) return; TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile; GL11.glPushMatrix(); { GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -2.0F, 0.0F); GL11.glPushMatrix(); { if(theModel.doesRotate()){ int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); if(meta == 0) GL11.glRotatef(180F, 0F, 1F, 0F); if(meta == 1) GL11.glRotatef(90F, 0F, 1F, 0F); if(meta == 3) GL11.glRotatef(270F, 0F, 1F, 0F); } this.bindTexture(resLoc); theModel.render(0.0625F); if(theCloud.name != null && !theCloud.name.isEmpty()){ for(ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.cloudStuff){ boolean canBreak = false; for(String triggerName : cloud.getTriggerNames()){ if(StringUtil.equalsToLowerCase(triggerName, theCloud.name)){ cloud.renderExtra(0.0625F); canBreak = true; break; } } if(canBreak) break; } } } GL11.glPopMatrix(); if(theCloud.name != null && !theCloud.name.isEmpty() && !Minecraft.getMinecraft().gameSettings.hideGUI){ GL11.glPushMatrix(); { GL11.glTranslatef(0F, 0.1F, 0F); GL11.glRotatef(180F, 1F, 0F, 0F); GL11.glRotatef(180F, 0F, 1F, 0F); GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F); float f = 1.6F; float f1 = 0.016666668F*f; GL11.glScalef(-f1, -f1, f1); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, 0F/f1, 0.0F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); Tessellator tessellator = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); int i = Minecraft.getMinecraft().fontRenderer.getStringWidth(theCloud.name)/2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i-1, -1.0D, 0.0D); tessellator.addVertex(-i-1, 8.0D, 0.0D); tessellator.addVertex(i+1, 8.0D, 0.0D); tessellator.addVertex(i+1, -1.0D, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); Minecraft.getMinecraft().fontRenderer.drawString(theCloud.name, -Minecraft.getMinecraft().fontRenderer.getStringWidth(theCloud.name)/2, 0, 0xFFFFFF); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glScalef(1F/-f1, 1F/-f1, 1F/f1); } GL11.glPopMatrix(); } } GL11.glPopMatrix(); } }