mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-27 23:45:57 +00:00
Full GLStatemanager substitution
This commit is contained in:
1 parent
9cd7a4a0d5
commit
2dae52a9ff
135 files changed
+1629
-1596
No files matched your search
@@ -15,11 +15,10 @@ import java.nio.FloatBuffer;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityEndPortal;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -35,91 +34,105 @@ public class RenderTileStarfield extends TileEntitySpecialRenderer {
|
||||
private static final ResourceLocation field_147526_d = new ResourceLocation("textures/entity/end_portal.png");
|
||||
private static final Random field_147527_e = new Random(31100L);
|
||||
FloatBuffer field_147528_b = GLAllocation.createDirectFloatBuffer(16);
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_, int digProgress) {
|
||||
float f1 = (float)field_147501_a.field_147560_j;
|
||||
float f2 = (float)field_147501_a.field_147561_k;
|
||||
float f3 = (float)field_147501_a.field_147558_l;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
field_147527_e.setSeed(31100L);
|
||||
float f4 = 0.24F;
|
||||
|
||||
for(int i = 0; i < 16; ++i) {
|
||||
GL11.glPushMatrix();
|
||||
float f5 = 16 - i;
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity p_180544_1_, double p_180544_2_, double p_180544_4_, double p_180544_6_, float p_180544_8_, int p_180544_9_) {
|
||||
float f1 = (float)this.rendererDispatcher.entityX;
|
||||
float f2 = (float)this.rendererDispatcher.entityY;
|
||||
float f3 = (float)this.rendererDispatcher.entityZ;
|
||||
GlStateManager.disableLighting();
|
||||
field_147527_e.setSeed(31100L);
|
||||
float f4 = 0.75F;
|
||||
|
||||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
float f5 = (float)(16 - j);
|
||||
float f6 = 0.0625F;
|
||||
float f7 = 1.0F / (f5 + 1.0F);
|
||||
|
||||
if(i == 0) {
|
||||
bindTexture(field_147529_c);
|
||||
if (j == 0)
|
||||
{
|
||||
this.bindTexture(field_147529_c);
|
||||
f7 = 0.1F;
|
||||
f5 = 65.0F;
|
||||
f6 = 0.125F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
}
|
||||
|
||||
if(i == 1) {
|
||||
bindTexture(field_147526_d);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
if (j >= 1)
|
||||
{
|
||||
this.bindTexture(field_147526_d);
|
||||
}
|
||||
|
||||
if (j == 1)
|
||||
{
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(1, 1);
|
||||
f6 = 0.5F;
|
||||
}
|
||||
|
||||
float f8 = (float)-(p_147500_4_ + f4);
|
||||
float f9 = f8 + ActiveRenderInfo.objectY;
|
||||
float f10 = f8 + f5 + ActiveRenderInfo.objectY;
|
||||
float f8 = (float)(-(p_180544_4_ + (double)f4));
|
||||
float f9 = f8 + (float)ActiveRenderInfo.getPosition().yCoord;
|
||||
float f10 = f8 + f5 + (float)ActiveRenderInfo.getPosition().yCoord;
|
||||
float f11 = f9 / f10;
|
||||
f11 += (float)(p_147500_4_ + f4);
|
||||
GL11.glTranslatef(f1, f11, f3);
|
||||
GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
|
||||
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, func_147525_a(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, func_147525_a(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glTranslatef(0.0F, Minecraft.getSystemTime() % 20000L / 20000.0F, 0.0F);
|
||||
GL11.glScalef(f6, f6, f6);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
|
||||
GL11.glRotatef((i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
|
||||
GL11.glTranslatef(-f1, -f3, -f2);
|
||||
f9 = f8 + ActiveRenderInfo.objectY;
|
||||
GL11.glTranslatef(ActiveRenderInfo.objectX * f5 / f9, ActiveRenderInfo.objectZ * f5 / f9, -f2);
|
||||
f11 += (float)(p_180544_4_ + (double)f4);
|
||||
GlStateManager.translate(f1, f11, f3);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, 9217);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, 9217);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, 9217);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, 9216);
|
||||
GlStateManager.func_179105_a(GlStateManager.TexGen.S, 9473, this.func_147525_a(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.func_179105_a(GlStateManager.TexGen.T, 9473, this.func_147525_a(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.func_179105_a(GlStateManager.TexGen.R, 9473, this.func_147525_a(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.func_179105_a(GlStateManager.TexGen.Q, 9474, this.func_147525_a(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.S);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.T);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.R);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.Q);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(5890);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.translate(0.0F, (float)(Minecraft.getSystemTime() % 700000L) / 700000.0F, 0.0F);
|
||||
GlStateManager.scale(f6, f6, f6);
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.0F);
|
||||
GlStateManager.rotate((float)(j * j * 4321 + j * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.translate(-0.5F, -0.5F, 0.0F);
|
||||
GlStateManager.translate(-f1, -f3, -f2);
|
||||
f9 = f8 + (float)ActiveRenderInfo.getPosition().yCoord;
|
||||
GlStateManager.translate((float)ActiveRenderInfo.getPosition().xCoord * f5 / f9, (float)ActiveRenderInfo.getPosition().zCoord * f5 / f9, -f2);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
tessellator.getWorldRenderer().startDrawingQuads();
|
||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||
worldrenderer.startDrawingQuads();
|
||||
float f12 = field_147527_e.nextFloat() * 0.5F + 0.1F;
|
||||
float f13 = field_147527_e.nextFloat() * 0.5F + 0.4F;
|
||||
float f14 = field_147527_e.nextFloat() * 0.5F + 0.5F;
|
||||
|
||||
Color color = Color.getHSBColor(Minecraft.getSystemTime() / 20F % 360 / 360F, 1F, 1F);
|
||||
f11 = color.getRed() / 255F;
|
||||
float f12 = color.getGreen() / 255F;
|
||||
float f13 = color.getBlue() / 255F;
|
||||
if (j == 0)
|
||||
{
|
||||
f14 = 1.0F;
|
||||
f13 = 1.0F;
|
||||
f12 = 1.0F;
|
||||
}
|
||||
|
||||
tessellator.getWorldRenderer().setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
|
||||
tessellator.getWorldRenderer().addVertex(p_147500_2_, p_147500_4_ + f4, p_147500_6_);
|
||||
tessellator.getWorldRenderer().addVertex(p_147500_2_, p_147500_4_ + f4, p_147500_6_ + 1.0D);
|
||||
tessellator.getWorldRenderer().addVertex(p_147500_2_ + 1.0D, p_147500_4_ + f4, p_147500_6_ + 1.0D);
|
||||
tessellator.getWorldRenderer().addVertex(p_147500_2_ + 1.0D, p_147500_4_ + f4, p_147500_6_);
|
||||
worldrenderer.setColorRGBA_F(f12 * f7, f13 * f7, f14 * f7, 1.0F);
|
||||
worldrenderer.addVertex(p_180544_2_, p_180544_4_ + (double)f4, p_180544_6_);
|
||||
worldrenderer.addVertex(p_180544_2_, p_180544_4_ + (double)f4, p_180544_6_ + 1.0D);
|
||||
worldrenderer.addVertex(p_180544_2_ + 1.0D, p_180544_4_ + (double)f4, p_180544_6_ + 1.0D);
|
||||
worldrenderer.addVertex(p_180544_2_ + 1.0D, p_180544_4_ + (double)f4, p_180544_6_);
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(5888);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.S);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.T);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.R);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.Q);
|
||||
GlStateManager.enableLighting();
|
||||
}
|
||||
|
||||
private FloatBuffer func_147525_a(float p_147525_1_, float p_147525_2_, float p_147525_3_, float p_147525_4_) {
|
||||
|
||||
Reference in new issue
Block a user