use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class RenderInfectedCrystallizeArrow method doRender.
@Override
public void doRender(EntityInfectedCrystallizeArrow entity, double x, double y, double z, float entityYaw, float partialTicks) {
this.bindEntityTexture(entity);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y, (float) z);
GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
int i = 0;
float f = 0.0F;
float f1 = 0.5F;
float f2 = (0 + i * 10) / 32.0F;
float f3 = (5 + i * 10) / 32.0F;
float f4 = 0.0F;
float f5 = 0.15625F;
float f6 = (5 + i * 10) / 32.0F;
float f7 = (10 + i * 10) / 32.0F;
float f8 = 0.05625F;
GlStateManager.enableRescaleNormal();
float f9 = entity.arrowShake - partialTicks;
if (f9 > 0.0F) {
float f10 = -MathHelper.sin(f9 * 3.0F) * f9;
GlStateManager.rotate(f10, 0.0F, 0.0F, 1.0F);
}
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(f8, f8, f8);
GlStateManager.translate(-4.0F, 0.0F, 0.0F);
GlStateManager.glNormal3f(f8, 0.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex(f4, f6).endVertex();
worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex(f5, f6).endVertex();
worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex(f5, f7).endVertex();
worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex(f4, f7).endVertex();
tessellator.draw();
GlStateManager.glNormal3f(-f8, 0.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex(f4, f6).endVertex();
worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex(f5, f6).endVertex();
worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex(f5, f7).endVertex();
worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex(f4, f7).endVertex();
tessellator.draw();
for (int j = 0; j < 4; ++j) {
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.glNormal3f(0.0F, 0.0F, f8);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex(f, f2).endVertex();
worldrenderer.pos(8.0D, -2.0D, 0.0D).tex(f1, f2).endVertex();
worldrenderer.pos(8.0D, 2.0D, 0.0D).tex(f1, f3).endVertex();
worldrenderer.pos(-8.0D, 2.0D, 0.0D).tex(f, f3).endVertex();
tessellator.draw();
}
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class GuiElementCheckboxMP method drawTexturedModalRect.
@Override
public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) {
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldRenderer = tessellator.getBuffer();
worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldRenderer.pos(x + 0, y + height, this.zLevel).tex((textureX + 0) * f, (textureY + this.texHeight) * f1).endVertex();
worldRenderer.pos(x + width, y + height, this.zLevel).tex((textureX + this.texWidth) * f, (textureY + this.texHeight) * f1).endVertex();
worldRenderer.pos(x + width, y + 0, this.zLevel).tex((textureX + this.texWidth) * f, (textureY + 0) * f1).endVertex();
worldRenderer.pos(x + 0, y + 0, this.zLevel).tex((textureX + 0) * f, (textureY + 0) * f1).endVertex();
tessellator.draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class SkyProviderChalos method renderPlanetInSky.
@Override
protected void renderPlanetInSky(float partialTicks, WorldClient world, Minecraft mc) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
float red;
float green;
float blue;
float scale;
float starBrightness = world.getStarBrightness(partialTicks);
float[] color = new float[4];
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(7425);
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
color[0] = 217 / 255.0F;
color[1] = 123 / 255.0F;
color[2] = 38 / 255.0F;
color[3] = 0.4F;
red = color[0];
green = color[1];
blue = color[2];
starBrightness = 1.0F - starBrightness;
worldrenderer.begin(6, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos(0.0D, 100.0D, 0.0D).color(red * starBrightness, green * starBrightness, blue * starBrightness, color[3] * 2 / starBrightness).endVertex();
// Render sun aura
scale = 14.0F;
worldrenderer.pos(-scale, 100.0D, -scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(0, 100.0D, (double) -scale * 1.5F).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(scale, 100.0D, -scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos((double) scale * 1.5F, 100.0D, 0).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(scale, 100.0D, scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(0, 100.0D, (double) scale * 1.5F).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(-scale, 100.0D, scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos((double) -scale * 1.5F, 100.0D, 0).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(-scale, 100.0D, -scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
tessellator.draw();
worldrenderer.begin(6, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos(0.0D, 100.0D, 0.0D).color(red * starBrightness, green * starBrightness, blue * starBrightness, color[3] * starBrightness).endVertex();
// Render larger sun aura
scale = 30.0F;
worldrenderer.pos(-scale, 100.0D, -scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(0, 100.0D, (double) -scale * 1.5F).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(scale, 100.0D, -scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos((double) scale * 1.5F, 100.0D, 0).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(scale, 100.0D, scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(0, 100.0D, (double) scale * 1.5F).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(-scale, 100.0D, scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos((double) -scale * 1.5F, 100.0D, 0).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
worldrenderer.pos(-scale, 100.0D, -scale).color(color[0] * starBrightness, color[1] * starBrightness, color[2] * starBrightness, 0.0F).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.shadeModel(7424);
GlStateManager.enableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0);
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.0F, 0.0F);
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.blendFunc(770, 771);
GlStateManager.disableTexture2D();
GlStateManager.color(0.0F, 0.0F, 0.0F, 1.0F);
// Render Sirius
GlStateManager.disableTexture2D();
GlStateManager.blendFunc(770, 1);
GlStateManager.color(0.0F, 0.0F, 0.0F, 1.0F);
// Some blanking to conceal the stars
scale = this.sunSize / 3.5F;
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos(-scale, 99.9D, -scale).endVertex();
worldrenderer.pos(scale, 99.9D, -scale).endVertex();
worldrenderer.pos(scale, 99.9D, scale).endVertex();
worldrenderer.pos(-scale, 99.9D, scale).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
scale = this.sunSize + 6.5F;
mc.getTextureManager().bindTexture(this.siriusTexture);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-scale, 100.0D, -scale).tex(0.0D, 0.0D).endVertex();
worldrenderer.pos(scale, 100.0D, -scale).tex(1.0D, 0.0D).endVertex();
worldrenderer.pos(scale, 100.0D, scale).tex(1.0D, 1.0D).endVertex();
worldrenderer.pos(-scale, 100.0D, scale).tex(0.0D, 1.0D).endVertex();
tessellator.draw();
// Render Diona
scale = 0.75F;
GlStateManager.scale(0.6F, 0.6F, 0.6F);
GlStateManager.rotate(0.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(220F, 1.0F, -0.3F, 0.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1F);
mc.getTextureManager().bindTexture(this.dionaTexture);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-scale, 100.0D, -scale).tex(0.0D, 0.0D).endVertex();
worldrenderer.pos(scale, 100.0D, -scale).tex(1.0D, 0.0D).endVertex();
worldrenderer.pos(scale, 100.0D, scale).tex(1.0D, 1.0D).endVertex();
worldrenderer.pos(-scale, 100.0D, scale).tex(0.0D, 1.0D).endVertex();
tessellator.draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class CloudRendererChalos method render.
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
if (!Minecraft.getMinecraft().isGamePaused()) {
this.cloudTickCounter += 2;
}
GlStateManager.disableCull();
float f1 = (float) (mc.getRenderViewEntity().lastTickPosY + (mc.getRenderViewEntity().posY - mc.getRenderViewEntity().lastTickPosY) * partialTicks);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
float f2 = 12.0F;
float f3 = 4.0F;
mc.renderEngine.bindTexture(locationCloudsPng);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
byte b0 = 8;
byte b1 = 4;
float f13 = 9.765625E-4F;
for (int count = 0; count < 2; ++count) {
GlStateManager.pushMatrix();
GlStateManager.scale(f2 + count * 5, 1.0F, f2 + count * 5);
for (int k = 0; k < 2; ++k) {
if (k == 0) {
GlStateManager.colorMask(false, false, false, false);
} else if (mc.gameSettings.anaglyph) {
if (EntityRenderer.anaglyphField == 0) {
GlStateManager.colorMask(false, true, true, true);
} else {
GlStateManager.colorMask(true, false, false, true);
}
} else {
GlStateManager.colorMask(true, true, true, true);
}
double d0 = this.cloudTickCounter * (1.0F - count / 3.0F) + count / 5.0F * partialTicks + count * 300000;
double d1 = (mc.getRenderViewEntity().prevPosX + (mc.getRenderViewEntity().posX - mc.getRenderViewEntity().prevPosX) * partialTicks + d0 * 0.029999999329447746D) / f2;
double d2 = (mc.getRenderViewEntity().prevPosZ + (mc.getRenderViewEntity().posZ - mc.getRenderViewEntity().prevPosZ) * partialTicks) / f2 + 0.33000001311302185D;
float f4 = mc.world.provider.getCloudHeight() - f1 + 0.33F + count * 20.0F;
int i = MathHelper.floor(d1 / 2048.0D);
int j = MathHelper.floor(d2 / 2048.0D);
d1 -= i * 2048;
d2 -= j * 2048;
float f5 = 215.0F / (800.0F + count * 300.0F);
float f6 = 164.0F / (800.0F + count * 300.0F);
float f7 = 20.0F / (800.0F + count * 300.0F);
float f8;
float f9;
float f10;
if (mc.gameSettings.anaglyph) {
f8 = (f5 * 30.0F + f6 * 59.0F + f7 * 11.0F) / 100.0F;
f9 = (f5 * 30.0F + f6 * 70.0F) / 100.0F;
f10 = (f5 * 30.0F + f7 * 70.0F) / 100.0F;
f5 = f8;
f6 = f9;
f7 = f10;
}
f8 = (float) (d1 * 0.0D);
f9 = (float) (d2 * 0.0D);
f10 = 0.00390625F;
f8 = MathHelper.floor(d1) * f10;
f9 = MathHelper.floor(d2) * f10;
float f11 = (float) (d1 - MathHelper.floor(d1));
float f12 = (float) (d2 - MathHelper.floor(d2));
for (int l = -b1 + 1; l <= b1; ++l) {
for (int i1 = -b1 + 1; i1 <= b1; ++i1) {
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
float f14 = l * b0;
float f15 = i1 * b0;
float f16 = f14 - f11;
float f17 = f15 - f12;
if (f4 > -f3 - 1.0F) {
worldrenderer.pos(f16 + 0.0F, f4 + 0.0F, f17 + b0).tex((f14 + 0.0F) * f10 + f8, (f15 + b0) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + b0, f4 + 0.0F, f17 + b0).tex((f14 + b0) * f10 + f8, (f15 + b0) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + b0, f4 + 0.0F, f17 + 0.0F).tex((f14 + b0) * f10 + f8, (f15 + 0.0F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + 0.0F, f4 + 0.0F, f17 + 0.0F).tex((f14 + 0.0F) * f10 + f8, (f15 + 0.0F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, -1.0F, 0.0F).endVertex();
}
if (f4 <= f3 + 1.0F) {
worldrenderer.pos(f16 + 0.0F, f4 + f3 - f13, f17 + b0).tex((f14 + 0.0F) * f10 + f8, (f15 + b0) * f10 + f9).color(f5, f6, f7, 0.9F).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + b0, f4 + f3 - f13, f17 + b0).tex((f14 + b0) * f10 + f8, (f15 + b0) * f10 + f9).color(f5, f6, f7, 0.9F).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + b0, f4 + f3 - f13, f17 + 0.0F).tex((f14 + b0) * f10 + f8, (f15 + 0.0F) * f10 + f9).color(f5, f6, f7, 0.9F).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + 0.0F, f4 + f3 - f13, f17 + 0.0F).tex((f14 + 0.0F) * f10 + f8, (f15 + 0.0F) * f10 + f9).color(f5, f6, f7, 0.9F).normal(0.0F, 1.0F, 0.0F).endVertex();
}
int j1;
if (l > -1) {
for (j1 = 0; j1 < b0; ++j1) {
worldrenderer.pos(f16 + j1 + 0.0F, f4 + 0.0F, f17 + b0).tex((f14 + j1 + 0.5F) * f10 + f8, (f15 + b0) * f10 + f9).color(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.9F).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + j1 + 0.0F, f4 + f3, f17 + b0).tex((f14 + j1 + 0.5F) * f10 + f8, (f15 + b0) * f10 + f9).color(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.9F).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + j1 + 0.0F, f4 + f3, f17 + 0.0F).tex((f14 + j1 + 0.5F) * f10 + f8, (f15 + 0.0F) * f10 + f9).color(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.9F).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + j1 + 0.0F, f4 + 0.0F, f17 + 0.0F).tex((f14 + j1 + 0.5F) * f10 + f8, (f15 + 0.0F) * f10 + f9).color(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.9F).normal(-1.0F, 0.0F, 0.0F).endVertex();
}
}
if (l <= 1) {
for (j1 = 0; j1 < b0; ++j1) {
worldrenderer.pos(f16 + j1 + 1.0F - f13, f4 + 0.0F, f17 + b0).tex((f14 + j1 + 0.5F) * f10 + f8, (f15 + b0) * f10 + f9).color(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.9F).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + j1 + 1.0F - f13, f4 + f3, f17 + b0).tex((f14 + j1 + 0.5F) * f10 + f8, (f15 + b0) * f10 + f9).color(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.9F).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + j1 + 1.0F - f13, f4 + f3, f17 + 0.0F).tex((f14 + j1 + 0.5F) * f10 + f8, (f15 + 0.0F) * f10 + f9).color(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.9F).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(f16 + j1 + 1.0F - f13, f4 + 0.0F, f17 + 0.0F).tex((f14 + j1 + 0.5F) * f10 + f8, (f15 + 0.0F) * f10 + f9).color(f5 * 0.9F, f6 * 0.9F, f7 * 0.9F, 0.9F).normal(1.0F, 0.0F, 0.0F).endVertex();
}
}
if (i1 > -1) {
for (j1 = 0; j1 < b0; ++j1) {
worldrenderer.pos(f16 + 0.0F, f4 + f3, f17 + j1 + 0.0F).tex((f14 + 0.0F) * f10 + f8, (f15 + j1 + 0.5F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos(f16 + b0, f4 + f3, f17 + j1 + 0.0F).tex((f14 + b0) * f10 + f8, (f15 + j1 + 0.5F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos(f16 + b0, f4 + 0.0F, f17 + j1 + 0.0F).tex((f14 + b0) * f10 + f8, (f15 + j1 + 0.5F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos(f16 + 0.0F, f4 + 0.0F, f17 + j1 + 0.0F).tex((f14 + 0.0F) * f10 + f8, (f15 + j1 + 0.5F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, 0.0F, -1.0F).endVertex();
}
}
if (i1 <= 1) {
for (j1 = 0; j1 < b0; ++j1) {
worldrenderer.pos(f16 + 0.0F, f4 + f3, f17 + j1 + 1.0F - f13).tex((f14 + 0.0F) * f10 + f8, (f15 + j1 + 0.5F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos(f16 + b0, f4 + f3, f17 + j1 + 1.0F - f13).tex((f14 + b0) * f10 + f8, (f15 + j1 + 0.5F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos(f16 + b0, f4 + 0.0F, f17 + j1 + 1.0F - f13).tex((f14 + b0) * f10 + f8, (f15 + j1 + 0.5F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos(f16 + 0.0F, f4 + 0.0F, f17 + j1 + 1.0F - f13).tex((f14 + 0.0F) * f10 + f8, (f15 + j1 + 0.5F) * f10 + f9).color(f5 * 0.8F, f6 * 0.8F, f7 * 0.8F, 0.9F).normal(0.0F, 0.0F, 1.0F).endVertex();
}
}
tessellator.draw();
}
}
}
GlStateManager.popMatrix();
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableCull();
}
use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class FakeAlienBeamRenderer method renderBeam.
public void renderBeam(double x, double y, double z, float partialTicks) {
this.prevTime = this.time;
this.time += 0.0125F;
if (this.time >= 1.0F) {
this.time = 0.0F;
}
if (this.time < 0.0F) {
this.time = 0.0F;
}
float beamTime = this.prevTime + (this.time - this.prevTime) * partialTicks;
if (beamTime > 0.0F) {
if (beamTime < 1.0F) {
beamTime = beamTime * beamTime;
beamTime = beamTime * beamTime;
beamTime = beamTime * 0.8F + 0.2F;
}
}
int k = 256;
GlStateManager.alphaFunc(516, 0.1F);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
GlStateManager.disableFog();
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/entity/beacon_beam.png"));
GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
GlStateManager.blendFunc(770, 1);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
double d0 = (double) Minecraft.getMinecraft().world.getTotalWorldTime() + (double) partialTicks;
double d1 = MathHelper.frac(-d0 * 0.2D - MathHelper.floor(-d0 * 0.1D));
float red = 0.4F;
float green = 0.6F;
float blue = 1.0F;
float alpha = beamTime;
double d2 = d0 * 0.025D * -1.5D;
double d4 = 0.5D + Math.cos(d2 + 2.356194490192345D) * 0.2D;
double d5 = 0.5D + Math.sin(d2 + 2.356194490192345D) * 0.2D;
double d6 = 0.5D + Math.cos(d2 + Math.PI / 4D) * 0.2D;
double d7 = 0.5D + Math.sin(d2 + Math.PI / 4D) * 0.2D;
double d8 = 0.5D + Math.cos(d2 + 3.9269908169872414D) * 0.2D;
double d9 = 0.5D + Math.sin(d2 + 3.9269908169872414D) * 0.2D;
double d10 = 0.5D + Math.cos(d2 + 5.497787143782138D) * 0.2D;
double d11 = 0.5D + Math.sin(d2 + 5.497787143782138D) * 0.2D;
double d12 = 0.0D;
double d13 = 1.0D;
double d14 = -1.0D + d1;
double d15 = (float) 512 * 512 * 2.5D + d14;
GlStateManager.enableBlend();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(x + d4, y + k, z + d5).tex(1.0D, d15).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d4, y, z + d5).tex(1.0D, d14).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d6, y, z + d7).tex(0.0D, d14).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d6, y + k, z + d7).tex(0.0D, d15).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d10, y + k, z + d11).tex(1.0D, d15).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d10, y, z + d11).tex(1.0D, d14).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d8, y, z + d9).tex(0.0D, d14).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d8, y + k, z + d9).tex(0.0D, d15).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d6, y + k, z + d7).tex(1.0D, d15).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d6, y, z + d7).tex(1.0D, d14).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d10, y, z + d11).tex(0.0D, d14).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d10, y + k, z + d11).tex(0.0D, d15).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d8, y + k, z + d9).tex(1.0D, d15).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d8, y, z + d9).tex(1.0D, d14).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d4, y, z + d5).tex(0.0D, d14).color(red, green, blue, alpha).endVertex();
worldrenderer.pos(x + d4, y + k, z + d5).tex(0.0D, d15).color(red, green, blue, alpha).endVertex();
tessellator.draw();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.depthMask(false);
d2 = 0.2D;
d4 = 0.8D;
d5 = 0.2D;
d6 = 0.2D;
d7 = 0.8D;
d8 = 0.8D;
d9 = 0.8D;
d10 = 0.0D;
d11 = 1.0D;
d12 = -1.0D + d1;
d13 = (float) 512 * 512 + d12;
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(x + 0.2D, y + k, z + 0.2D).tex(1.0D, d13).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.2D, y, z + 0.2D).tex(1.0D, d12).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.8D, y, z + 0.2D).tex(0.0D, d12).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.8D, y + k, z + 0.2D).tex(0.0D, d13).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.8D, y + k, z + 0.8D).tex(1.0D, d13).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.8D, y, z + 0.8D).tex(1.0D, d12).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.2D, y, z + 0.8D).tex(0.0D, d12).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.2D, y + k, z + 0.8D).tex(0.0D, d13).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.8D, y + k, z + 0.2D).tex(1.0D, d13).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.8D, y, z + 0.2D).tex(1.0D, d12).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.8D, y, z + 0.8D).tex(0.0D, d12).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.8D, y + k, z + 0.8D).tex(0.0D, d13).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.2D, y + k, z + 0.8D).tex(1.0D, d13).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.2D, y, z + 0.8D).tex(1.0D, d12).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.2D, y, z + 0.2D).tex(0.0D, d12).color(red, green, blue, 0.125F).endVertex();
worldrenderer.pos(x + 0.2D, y + k, z + 0.2D).tex(0.0D, d13).color(red, green, blue, 0.125F).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
GlStateManager.enableFog();
}
Aggregations