mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
cleaned up robot label renderer a little; bumped version
This commit is contained in:
parent
667287434f
commit
07b4fda9b4
@ -1,6 +1,6 @@
|
||||
minecraft.version=1.6.4
|
||||
forge.version=9.11.1.964
|
||||
oc.version=1.2.2
|
||||
oc.version=1.2.3
|
||||
ccl.version=1.0.0.62
|
||||
fmp.version=1.0.0.250
|
||||
maven.url=file:///var/www/users/fnuecke/maven.cil.li
|
@ -78,6 +78,7 @@ object MonospaceFontRenderer {
|
||||
GL11.glTranslatef(x, y, 0)
|
||||
GL11.glScalef(0.5f, 0.5f, 1)
|
||||
GL11.glDepthMask(false)
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D)
|
||||
|
||||
// Background first. We try to merge adjacent backgrounds of the same
|
||||
// color to reduce the number of quads we have to draw.
|
||||
|
@ -1,10 +1,11 @@
|
||||
package li.cil.oc.client.renderer.tileentity
|
||||
|
||||
import com.google.common.base.Strings
|
||||
import java.util.logging.Level
|
||||
import li.cil.oc.{Settings, OpenComputers}
|
||||
import li.cil.oc.client.TexturePreloader
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.RenderState
|
||||
import li.cil.oc.{Settings, OpenComputers}
|
||||
import net.minecraft.client.renderer.entity.{RendererLivingEntity, RenderManager}
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
||||
import net.minecraft.client.renderer.{Tessellator, GLAllocation}
|
||||
@ -176,7 +177,7 @@ object RobotRenderer extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5)
|
||||
|
||||
val name = robot.name
|
||||
if (Settings.get.robotLabels && name != null && x * x + y * y + z * z < RendererLivingEntity.NAME_TAG_RANGE) {
|
||||
if (Settings.get.robotLabels && !Strings.isNullOrEmpty(name) && x * x + y * y + z * z < RendererLivingEntity.NAME_TAG_RANGE) {
|
||||
GL11.glPushMatrix()
|
||||
|
||||
// This is pretty much copy-pasta from the entity's label renderer.
|
||||
@ -184,6 +185,7 @@ object RobotRenderer extends TileEntitySpecialRenderer {
|
||||
val f = getFontRenderer
|
||||
val scale = 1.6f / 60f
|
||||
val width = f.getStringWidth(name)
|
||||
val halfWidth = width / 2
|
||||
|
||||
GL11.glTranslated(0, 0.7, 0)
|
||||
GL11.glNormal3f(0, 1, 0)
|
||||
@ -192,15 +194,12 @@ object RobotRenderer extends TileEntitySpecialRenderer {
|
||||
GL11.glRotatef(tileEntityRenderer.playerPitch, 1, 0, 0)
|
||||
GL11.glScalef(-scale, -scale, scale)
|
||||
|
||||
RenderState.makeItBlend()
|
||||
GL11.glDisable(GL11.GL_LIGHTING)
|
||||
GL11.glDepthMask(false)
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST)
|
||||
GL11.glEnable(GL11.GL_BLEND)
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA)
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D)
|
||||
|
||||
t.startDrawingQuads()
|
||||
val halfWidth = width / 2
|
||||
t.setColorRGBA_F(0, 0, 0, 0.25f)
|
||||
t.addVertex(-halfWidth - 1, -1, 0)
|
||||
t.addVertex(-halfWidth - 1, 8, 0)
|
||||
@ -208,11 +207,10 @@ object RobotRenderer extends TileEntitySpecialRenderer {
|
||||
t.addVertex(halfWidth + 1, -1, 0)
|
||||
t.draw
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D)
|
||||
f.drawString(name, -halfWidth, 0, 0x20FFFFFF)
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST)
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D) // For the font.
|
||||
f.drawString(name, -halfWidth, 0, 0xFFFFFFFF)
|
||||
|
||||
GL11.glDepthMask(true)
|
||||
f.drawString(name, -halfWidth, 0, -1)
|
||||
GL11.glEnable(GL11.GL_LIGHTING)
|
||||
GL11.glDisable(GL11.GL_BLEND)
|
||||
GL11.glColor4f(1, 1, 1, 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user