Search in sources :

Example 1 with GuiAphorismTile

use of pneumaticCraft.client.gui.GuiAphorismTile in project PneumaticCraft by MineMaarten.

the class RenderAphorismTile method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    TileEntityAphorismTile tile = (TileEntityAphorismTile) tileentity;
    // start
    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GL11.glScalef(1.0F, -1F, -1F);
    PneumaticCraftUtils.rotateMatrixByMetadata(tile.getBlockMetadata());
    GL11.glTranslatef(0, 1, 0.5F - BBConstants.APHORISM_TILE_THICKNESS - 0.01F);
    String[] textLines = tile.getTextLines();
    int lineWidth = getMaxLineWidth(textLines);
    int lineHeight = 10 * textLines.length;
    float textScale = Math.min(14 / 16F / lineWidth, 14 / 16F / lineHeight);
    GL11.glScalef(textScale, textScale, textScale);
    GL11.glRotatef(tile.textRotation * 90, 0, 0, 1);
    int editedLine = -1;
    if (FMLClientHandler.instance().getClient().currentScreen instanceof GuiAphorismTile) {
        GuiAphorismTile gui = (GuiAphorismTile) FMLClientHandler.instance().getClient().currentScreen;
        if (gui.tile == tile && gui.updateCounter % 12 < 6) {
            editedLine = gui.cursorY;
        }
    }
    for (int i = 0; i < textLines.length; i++) {
        String textLine = textLines[i];
        if (editedLine == i)
            textLine = ">" + textLine + "<";
        RenderManager.instance.getFontRenderer().drawString(EnumChatFormatting.ITALIC + textLine, -RenderManager.instance.getFontRenderer().getStringWidth(textLine) / 2, -(textLines.length * 10) / 2 + i * 10 + 1, 0xFF000000);
    }
    // end
    GL11.glPopMatrix();
}
Also used : TileEntityAphorismTile(pneumaticCraft.common.tileentity.TileEntityAphorismTile) GuiAphorismTile(pneumaticCraft.client.gui.GuiAphorismTile)

Aggregations

GuiAphorismTile (pneumaticCraft.client.gui.GuiAphorismTile)1 TileEntityAphorismTile (pneumaticCraft.common.tileentity.TileEntityAphorismTile)1