diff options
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java')
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java | 138 |
1 files changed, 19 insertions, 119 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java index f36fa84..18f83b9 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java @@ -3,6 +3,10 @@ package darkknight.jewelrycraft.tileentity.renders; import java.awt.Color;
import java.util.HashMap;
import java.util.List;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.model.ModelDisplayer;
+import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
+import darkknight.jewelrycraft.util.Variables;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -18,10 +22,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
-import org.lwjgl.opengl.GL11;
-import darkknight.jewelrycraft.model.ModelDisplayer;
-import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
-import darkknight.jewelrycraft.util.Variables;
public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
{
@@ -48,13 +48,6 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer }
};
- /**
- * @param te
- * @param x
- * @param y
- * @param z
- * @param scale
- */
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
@@ -132,133 +125,40 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer GL11.glPopMatrix();
}
- /**
- * @param par2Str
- * @param x
- * @param y
- * @param z
- * @param metadata
- * @param te
- * @param color
- */
- protected void renderLabel(String par2Str, double x, double y, double z, int metadata, TileEntity te, int color)
+ protected void renderLabel(String text, double x, double y, double z, int metadata, TileEntity te, int color)
{
FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
- float var14 = 0.01266667F * 1.5F;
- float var17 = 0.015F;
+ float width = 0.015F, height = 1F;
GL11.glRotatef(180F, 0F, 0F, 1F);
- if (metadata == 0) GL11.glRotatef(0F, 0F, 1F, 0F);
- else if (metadata == 1) GL11.glRotatef(270F, 0F, 1F, 0F);
- else if (metadata == 2) GL11.glRotatef(180F, 0F, 1F, 0F);
- else if (metadata == 3) GL11.glRotatef(90F, 0F, 1F, 0F);
+ GL11.glRotatef(360 - metadata * 90F, 0F, 1F, 0F);
GL11.glTranslatef((float)x, (float)y, (float)z + 0.45F);
- GL11.glScalef(-0.015F, -var14, 0.015F);
+ GL11.glScalef(-0.015F, -0.019F, 0.015F);
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
- int j = fontrenderer.getStringWidth(par2Str) / 2;
+ int j = fontrenderer.getStringWidth(text) / 2;
tessellator.startDrawingQuads();
- tessellator.setColorRGBA_F(0.0F, 0.2F, 0.2F, 0.9F);
+ tessellator.setColorRGBA_F(0.275F, 0.145F, 0.431F, 0.5F);
tessellator.addVertex(-33.333 - 0, 0D, 0.1D);
tessellator.addVertex(-33.333 - 0, 9D, 0.1D);
tessellator.addVertex(33.333 + 0, 9D, 0.1D);
tessellator.addVertex(33.333 + 0, 0D, 0.1D);
tessellator.draw();
- if (fontrenderer.getStringWidth(par2Str) / 2 > 20) var17 = 0.9F / fontrenderer.getStringWidth(par2Str);
- else var17 = var14;
- int red = color >> 16 & 0xFF;
- int green = color >> 8 & 0xFF;
- int blue = color & 0xFF;
+ if (fontrenderer.getStringWidth(text) / 2 > 20){
+ width = 0.9F / fontrenderer.getStringWidth(text);
+ height = 1F - fontrenderer.getStringWidth(text)/20*0.06F;
+ }
GL11.glTranslatef((float)x + 1f, (float)y + 1f, (float)z);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glScalef(var17 * 70F, 1F, 0F);
- int i = 15728880;
- int t = i % 65536;
- int k = i / 65536;
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, t / 1.0F, k / 1.0F);
- fontrenderer.drawString(par2Str.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 1973790);
+ GL11.glScalef(width * 70F, height, 0F);
+ fontrenderer.drawString(text.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 1973790);
GL11.glPopMatrix();
- GL11.glTranslatef((float)x - 1f, (float)y - 1f, (float)z - 1F);
- GL11.glScalef(var17 * 70F, 1F, 0F);
- fontrenderer.drawString(par2Str, -j, 0, color);
- GL11.glDisable(GL11.GL_BLEND);
+ GL11.glTranslatef((float)x - 0.5f, (float)y - 0.5f, (float)z - 0.5F);
+ GL11.glScalef(width * 70F, height, 0F);
+ fontrenderer.drawString(text, -j, 0, color);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
-
- /**
- * @param str
- * @param color
- */
- public void replaceEnumEnchValues(String str, int color)
- {
- if (str.contains("§0")){
- color = Color.BLACK.getRGB();
- str.replace("§0", "");
- }
- if (str.contains("§1")){
- color = 85;
- str.replace("§1", "");
- }
- if (str.contains("§2")){
- color = 17920;
- str.replace("§2", "");
- }
- if (str.contains("§3")){
- color = 1336183;
- str.replace("§3", "");
- }
- if (str.contains("§4")){
- color = 4587520;
- str.replace("§4", "");
- }
- if (str.contains("§5")){
- color = 5701759;
- str.replace("§5", "");
- }
- if (str.contains("§6")){
- color = 16762880;
- str.replace("§6", "");
- }
- if (str.contains("§7")){
- color = Color.GRAY.getRGB();
- str.replace("§7", "");
- }
- if (str.contains("§8")){
- color = Color.DARK_GRAY.getRGB();
- str.replace("§8", "");
- }
- if (str.contains("§9")){
- color = Color.BLUE.getRGB();
- str.replace("§9", "");
- }
- if (str.contains("§a")){
- color = Color.GREEN.getRGB();
- str.replace("§a", "");
- }
- if (str.contains("§b")){
- color = Color.CYAN.getRGB();
- str.replace("§b", "");
- }
- if (str.contains("§c")){
- color = Color.RED.getRGB();
- str.replace("§c", "");
- }
- if (str.contains("§d")){
- color = 11665663;
- str.replace("§d", "");
- }
- if (str.contains("§e")){
- color = Color.YELLOW.getRGB();
- str.replace("§e", "");
- }
- if (str.contains("§f")){
- color = Color.WHITE.getRGB();
- str.replace("§f", "");
- }
- }
}
\ No newline at end of file |
