Migrate uses of color4ub to glstatemanager (4 years late but..)

This commit is contained in:
Vincent Lee committed 2019-11-10 23:57:59 -06:00
1 parent e35fbac245
commit 45b3dd3bab
5 files changed
+17 -17

No files matched your search

@@ -117,7 +117,7 @@ public final class BlockHighlightRenderHandler {
if(color == null)
color = Color.getHSBColor(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), alpha);
GlStateManager.color4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, alpha / 255F);
double f = 1F / 16F;
double x = aabb.maxX - aabb.minX - f;
@@ -135,7 +135,7 @@ public final class BlockHighlightRenderHandler {
x += f;
z += f;
double f1 = f + f / 4F;
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) (alpha * 2));
GlStateManager.color4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (alpha * 2) / 255F);
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
tessellator.getBuffer().pos(x, f1, 0).endVertex();
tessellator.getBuffer().pos(0, f1, 0).endVertex();
@@ -144,7 +144,7 @@ public final class BlockHighlightRenderHandler {
tessellator.draw();
}
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) 255);
GlStateManager.color4f(1, 1, 1, 1);
GlStateManager.popMatrix();
}
@@ -161,7 +161,7 @@ public final class BlockHighlightRenderHandler {
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
Color colorRGB = new Color(color);
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 32);
GlStateManager.color4f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F, 0.125F);
double f = 1F / 16F;
@@ -184,7 +184,7 @@ public final class BlockHighlightRenderHandler {
radius += f;
double f1 = f + f / 4F;
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 64);
GlStateManager.color4f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F, 0.25F);
tessellator.getBuffer().begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION);
tessellator.getBuffer().pos(0, f1, 0).endVertex();
for(int i = 0; i < totalAngles + 1; i += step) {
@@ -195,7 +195,7 @@ public final class BlockHighlightRenderHandler {
}
tessellator.getBuffer().pos(0, f1, 0).endVertex();
tessellator.draw();
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) 255);
GlStateManager.color4f(1, 1, 1, 1);
GlStateManager.popMatrix();
}
@@ -109,7 +109,7 @@ public final class BoundTileRenderer {
GlStateManager.pushMatrix();
GlStateManager.translated(pos.getX() - renderPosX, pos.getY() - renderPosY, pos.getZ() - renderPosZ + 1);
Color colorRGB = new Color(color);
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 255);
GlStateManager.color4f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F, 1);
World world = Minecraft.getInstance().world;
BlockState state = world.getBlockState(pos);
@@ -131,21 +131,21 @@ public final class BoundTileRenderer {
GlStateManager.scalef(1F, 1F, 1F);
GL11.glLineWidth(thickness);
GlStateManager.lineWidth(thickness);
for(AxisAlignedBB axis : list) {
axis = axis.offset(-pos.getX(), -pos.getY(), -(pos.getZ() + 1));
renderBlockOutline(axis);
}
GL11.glLineWidth(thickness + 3F);
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 64);
GlStateManager.lineWidth(thickness + 3F);
GlStateManager.color4f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F, 0.25F);
for(AxisAlignedBB axis : list) {
axis = axis.offset(-pos.getX(), -pos.getY(), -(pos.getZ() + 1));
renderBlockOutline(axis);
}
}
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) 255);
GlStateManager.color4f(1, 1, 1, 1);
GlStateManager.popMatrix();
}
@@ -287,14 +287,14 @@ public final class HUDHandler {
}
Color color = new Color(Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(Util.milliTime() / 200D) * 0.5 + 1F), 1F));
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) (255 - color.getRed()));
GlStateManager.color4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1 - (color.getRed() / 255F));
mc.textureManager.bindTexture(manaBar);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.drawTexturedModalRect(x, y, 0, 0, 251, width, 5);
GlStateManager.disableBlend();
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) 255);
GlStateManager.color4f(1, 1, 1, 1);
}
private static void renderPoolRecipeHUD(TilePool tile, ItemStack stack) {
@@ -443,8 +443,8 @@ public final class HUDHandler {
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, 100, 3);
Color color_ = new Color(color);
GL11.glColor4ub((byte) color_.getRed(), (byte) color_.getGreen(),(byte) color_.getBlue(), (byte) (255F * alpha));
GlStateManager.color4f(color_.getRed() / 255F, color_.getGreen() / 255F, color_.getBlue() / 255F, alpha);
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, Math.min(100, manaPercentage), 3);
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) 255);
GlStateManager.color4f(1, 1, 1, 1);
}
}
@@ -82,7 +82,7 @@ public final class RedStringRenderer {
int stages = (int) (vecOrig.mag() / vecMag.mag());
Tessellator tessellator = Tessellator.getInstance();
GL11.glLineWidth(1F);
GlStateManager.lineWidth(1F);
tessellator.getBuffer().begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
double len = (double) -ClientTickHandler.ticksInGame / 100F + new Random(dir.ordinal() ^ tile.getPos().hashCode()).nextInt(10000);
@@ -163,7 +163,7 @@ public class ItemSextant extends ItemMod {
if(inRange) {
radius += 4;
GlStateManager.disableTexture();
GL11.glLineWidth(3F);
GlStateManager.lineWidth(3F);
GL11.glBegin(GL11.GL_LINE_STRIP);
GlStateManager.color4f(0F, 1F, 1F, 1F);
for(int i = 0; i < 361; i++) {