use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class RenderNibiruLightningBolt method doRender.
@Override
public void doRender(EntityNibiruLightningBolt entity, double x, double y, double z, float entityYaw, float partialTicks) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
GlStateManager.pushMatrix();
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 1);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
double[] adouble = new double[8];
double[] adouble1 = new double[8];
double d0 = 0.0D;
double d1 = 0.0D;
Random random = new Random(entity.boltVertex);
for (int i = 7; i >= 0; --i) {
adouble[i] = d0;
adouble1[i] = d1;
d0 += random.nextInt(11) - 5;
d1 += random.nextInt(11) - 5;
}
for (int k1 = 0; k1 < 4; ++k1) {
Random random1 = new Random(entity.boltVertex);
for (int j = 0; j < 3; ++j) {
int k = 7;
int l = 0;
if (j > 0) {
k = 7 - j;
}
if (j > 0) {
l = k - 2;
}
double d2 = adouble[k] - d0;
double d3 = adouble1[k] - d1;
for (int i1 = k; i1 >= l; --i1) {
double d4 = d2;
double d5 = d3;
if (j == 0) {
d2 += random1.nextInt(11) - 5;
d3 += random1.nextInt(11) - 5;
} else {
d2 += random1.nextInt(31) - 15;
d3 += random1.nextInt(31) - 15;
}
worldrenderer.begin(5, DefaultVertexFormats.POSITION_COLOR);
double d6 = 0.1D + k1 * 0.2D;
if (j == 0) {
d6 *= i1 * 0.1D + 1.0D;
}
double d7 = 0.1D + k1 * 0.2D;
if (j == 0) {
d7 *= (i1 - 1) * 0.1D + 1.0D;
}
for (int j1 = 0; j1 < 5; ++j1) {
double d8 = x + 0.5D - d6;
double d9 = z + 0.5D - d6;
if (j1 == 1 || j1 == 2) {
d8 += d6 * 2.0D;
}
if (j1 == 2 || j1 == 3) {
d9 += d6 * 2.0D;
}
double d10 = x + 0.5D - d7;
double d11 = z + 0.5D - d7;
if (j1 == 1 || j1 == 2) {
d10 += d7 * 2.0D;
}
if (j1 == 2 || j1 == 3) {
d11 += d7 * 2.0D;
}
worldrenderer.pos(d10 + d2, y + i1 * 16, d11 + d3).color(0.25F, 0.25F, 1.0F, 0.6F).endVertex();
worldrenderer.pos(d8 + d4, y + (i1 + 1) * 16, d9 + d5).color(0.25F, 0.25F, 1.0F, 0.6F).endVertex();
}
tessellator.draw();
}
}
}
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class RenderVeinBall method doRender.
@Override
public void doRender(EntityVeinBall entity, double x, double y, double z, float entityYaw, float partialTicks) {
GlStateManager.pushMatrix();
this.bindEntityTexture(entity);
GlStateManager.translate((float) x, (float) y, (float) z);
GlStateManager.enableRescaleNormal();
GlStateManager.scale(0.5F, 0.5F, 0.5F);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate((this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * -this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
worldrenderer.pos(-0.5D, -0.25D, 0.0D).tex(0.0D, 1.0D).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(0.5D, -0.25D, 0.0D).tex(1.0D, 1.0D).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(0.5D, 0.75D, 0.0D).tex(1.0D, 0.0D).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(-0.5D, 0.75D, 0.0D).tex(0.0D, 0.0D).normal(0.0F, 1.0F, 0.0F).endVertex();
tessellator.draw();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class RenderInfectedElderGuardian method doRender.
@Override
public void doRender(EntityInfectedElderGuardian entity, double x, double y, double z, float entityYaw, float partialTicks) {
super.doRender(entity, x, y, z, entityYaw, partialTicks);
EntityLivingBase entitylivingbase = entity.getTargetedEntity();
if (entitylivingbase != null) {
float f = entity.getAttackAnimationScale(partialTicks);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
this.bindTexture(new ResourceLocation("textures/entity/guardian_beam.png"));
GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
float f1 = 240.0F;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f1, f1);
GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0);
float f2 = entity.world.getTotalWorldTime() + partialTicks;
float f3 = f2 * 0.5F % 1.0F;
float f4 = entity.getEyeHeight();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + f4, (float) z);
Vec3d vec3 = this.getPosition(entitylivingbase, entitylivingbase.height * 0.5D, partialTicks);
Vec3d vec31 = this.getPosition(entity, f4, partialTicks);
Vec3d vec32 = vec3.subtract(vec31);
double d0 = vec32.lengthVector() + 1.0D;
vec32 = vec32.normalize();
float f5 = (float) Math.acos(vec32.y);
float f6 = (float) Math.atan2(vec32.z, vec32.x);
GlStateManager.rotate(((float) Math.PI / 2F + -f6) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f5 * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
int i = 1;
double d1 = f2 * 0.05D * (1.0D - (i & 1) * 2.5D);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
float f7 = f * f;
double d2 = i * 0.2D;
double d3 = d2 * 1.41D;
double d4 = 0.0D + Math.cos(d1 + 2.356194490192345D) * d3;
double d5 = 0.0D + Math.sin(d1 + 2.356194490192345D) * d3;
double d6 = 0.0D + Math.cos(d1 + Math.PI / 4D) * d3;
double d7 = 0.0D + Math.sin(d1 + Math.PI / 4D) * d3;
double d8 = 0.0D + Math.cos(d1 + 3.9269908169872414D) * d3;
double d9 = 0.0D + Math.sin(d1 + 3.9269908169872414D) * d3;
double d10 = 0.0D + Math.cos(d1 + 5.497787143782138D) * d3;
double d11 = 0.0D + Math.sin(d1 + 5.497787143782138D) * d3;
double d12 = 0.0D + Math.cos(d1 + Math.PI) * d2;
double d13 = 0.0D + Math.sin(d1 + Math.PI) * d2;
double d14 = 0.0D + Math.cos(d1 + 0.0D) * d2;
double d15 = 0.0D + Math.sin(d1 + 0.0D) * d2;
double d16 = 0.0D + Math.cos(d1 + Math.PI / 2D) * d2;
double d17 = 0.0D + Math.sin(d1 + Math.PI / 2D) * d2;
double d18 = 0.0D + Math.cos(d1 + Math.PI * 3D / 2D) * d2;
double d19 = 0.0D + Math.sin(d1 + Math.PI * 3D / 2D) * d2;
double d22 = -1.0F + f3;
double d23 = d0 * (0.5D / d2) + d22;
double d24 = 0.0D;
if (entity.ticksExisted % 2 == 0) {
d24 = 0.5D;
}
if (f7 > 0.7F) {
f7 = 0.7F;
}
int red = 144 + (int) (f7 * 27);
int green = 56 + (int) (f7 * 173);
int blue = 34 + (int) (f7 * 228);
worldrenderer.pos(d12, d0, d13).tex(0.4999D, d23).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d12, 0.0D, d13).tex(0.4999D, d22).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d14, 0.0D, d15).tex(0.0D, d22).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d14, d0, d15).tex(0.0D, d23).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d16, d0, d17).tex(0.4999D, d23).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d16, 0.0D, d17).tex(0.4999D, d22).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d18, 0.0D, d19).tex(0.0D, d22).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d18, d0, d19).tex(0.0D, d23).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d4, d0, d5).tex(0.5D, d24 + 0.5D).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d6, d0, d7).tex(1.0D, d24 + 0.5D).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d10, d0, d11).tex(1.0D, d24).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d8, d0, d9).tex(0.5D, d24).color(red, green, blue, 255).endVertex();
tessellator.draw();
GlStateManager.enableLighting();
GlStateManager.enableCull();
GlStateManager.depthMask(false);
GlStateManager.popMatrix();
}
}
use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class RenderInfectedGuardian method doRender.
@Override
public void doRender(EntityInfectedGuardian entity, double x, double y, double z, float entityYaw, float partialTicks) {
super.doRender(entity, x, y, z, entityYaw, partialTicks);
EntityLivingBase entitylivingbase = entity.getTargetedEntity();
if (entitylivingbase != null) {
float f = entity.getAttackAnimationScale(partialTicks);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
this.bindTexture(new ResourceLocation("textures/entity/guardian_beam.png"));
GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
float f1 = 240.0F;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f1, f1);
GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0);
float f2 = entity.world.getTotalWorldTime() + partialTicks;
float f3 = f2 * 0.5F % 1.0F;
float f4 = entity.getEyeHeight();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + f4, (float) z);
Vec3d vec3 = this.getPosition(entitylivingbase, entitylivingbase.height * 0.5D, partialTicks);
Vec3d vec31 = this.getPosition(entity, f4, partialTicks);
Vec3d vec32 = vec3.subtract(vec31);
double d0 = vec32.lengthVector() + 1.0D;
vec32 = vec32.normalize();
float f5 = (float) Math.acos(vec32.y);
float f6 = (float) Math.atan2(vec32.z, vec32.x);
GlStateManager.rotate(((float) Math.PI / 2F + -f6) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f5 * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
int i = 1;
double d1 = f2 * 0.05D * (1.0D - (i & 1) * 2.5D);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
float f7 = f * f;
double d2 = i * 0.2D;
double d3 = d2 * 1.41D;
double d4 = 0.0D + Math.cos(d1 + 2.356194490192345D) * d3;
double d5 = 0.0D + Math.sin(d1 + 2.356194490192345D) * d3;
double d6 = 0.0D + Math.cos(d1 + Math.PI / 4D) * d3;
double d7 = 0.0D + Math.sin(d1 + Math.PI / 4D) * d3;
double d8 = 0.0D + Math.cos(d1 + 3.9269908169872414D) * d3;
double d9 = 0.0D + Math.sin(d1 + 3.9269908169872414D) * d3;
double d10 = 0.0D + Math.cos(d1 + 5.497787143782138D) * d3;
double d11 = 0.0D + Math.sin(d1 + 5.497787143782138D) * d3;
double d12 = 0.0D + Math.cos(d1 + Math.PI) * d2;
double d13 = 0.0D + Math.sin(d1 + Math.PI) * d2;
double d14 = 0.0D + Math.cos(d1 + 0.0D) * d2;
double d15 = 0.0D + Math.sin(d1 + 0.0D) * d2;
double d16 = 0.0D + Math.cos(d1 + Math.PI / 2D) * d2;
double d17 = 0.0D + Math.sin(d1 + Math.PI / 2D) * d2;
double d18 = 0.0D + Math.cos(d1 + Math.PI * 3D / 2D) * d2;
double d19 = 0.0D + Math.sin(d1 + Math.PI * 3D / 2D) * d2;
double d22 = -1.0F + f3;
double d23 = d0 * (0.5D / d2) + d22;
double d24 = 0.0D;
if (entity.ticksExisted % 2 == 0) {
d24 = 0.5D;
}
if (f7 > 0.9F) {
f7 = 0.9F;
}
int red = 144 + (int) (f7 * 60.0F);
int green = 56 + (int) (f7 * 50.0F);
int blue = 34 + (int) (f7 * 50.0F);
worldrenderer.pos(d12, d0, d13).tex(0.4999D, d23).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d12, 0.0D, d13).tex(0.4999D, d22).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d14, 0.0D, d15).tex(0.0D, d22).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d14, d0, d15).tex(0.0D, d23).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d16, d0, d17).tex(0.4999D, d23).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d16, 0.0D, d17).tex(0.4999D, d22).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d18, 0.0D, d19).tex(0.0D, d22).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d18, d0, d19).tex(0.0D, d23).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d4, d0, d5).tex(0.5D, d24 + 0.5D).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d6, d0, d7).tex(1.0D, d24 + 0.5D).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d10, d0, d11).tex(1.0D, d24).color(red, green, blue, 255).endVertex();
worldrenderer.pos(d8, d0, d9).tex(0.5D, d24).color(red, green, blue, 255).endVertex();
tessellator.draw();
GlStateManager.enableLighting();
GlStateManager.enableCull();
GlStateManager.depthMask(false);
GlStateManager.popMatrix();
}
}
use of net.minecraft.client.renderer.BufferBuilder in project MorePlanets by SteveKunG.
the class RenderAlienMiner method doRender.
@Override
public void doRender(EntityAlienMiner entity, double x, double y, double z, float entityYaw, float partialTicks) {
super.doRender(entity, x, y, z, entityYaw, partialTicks);
EntityLivingBase entitylivingbase = entity.getTargetedEntity();
if (entitylivingbase != null && entity.getChargedTime(partialTicks) > 0.925F) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
this.bindTexture(new ResourceLocation("moreplanets:textures/entity/alien_miner_beam.png"));
GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
GlStateManager.enableAlpha();
float f1 = 240.0F;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f1, f1);
GlStateManager.blendFunc(770, 771);
float f2 = entity.world.getTotalWorldTime() + partialTicks;
float f3 = f2 * 0.5F % 1.0F;
float f4 = entity.getEyeHeight() + 0.25F - 0.5F + entity.getHoverTick(partialTicks);
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + f4, (float) z);
Vec3d vec3 = this.getPosition(entitylivingbase, entitylivingbase.height * 0.5D, partialTicks);
Vec3d vec31 = this.getPosition(entity, f4, partialTicks);
Vec3d vec32 = vec3.subtract(vec31);
double d0 = vec32.lengthVector();
vec32 = vec32.normalize();
float f5 = (float) Math.acos(vec32.y);
float f6 = (float) Math.atan2(vec32.z, vec32.x);
GlStateManager.rotate(((float) Math.PI / 2F + -f6) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f5 * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
int i = 1;
double d1 = f2 * 0.05D * (1.0D - (i & 1) * 2.5D);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
int j = 255;
int k = 255;
int l = 255;
double d2 = i * 0.2D;
double d3 = d2 * 1.41D;
double d4 = 0.0D + Math.cos(d1 + 2.356194490192345D) * d3;
double d5 = 0.0D + Math.sin(d1 + 2.356194490192345D) * d3;
double d6 = 0.0D + Math.cos(d1 + Math.PI / 4D) * d3;
double d7 = 0.0D + Math.sin(d1 + Math.PI / 4D) * d3;
double d8 = 0.0D + Math.cos(d1 + 3.9269908169872414D) * d3;
double d9 = 0.0D + Math.sin(d1 + 3.9269908169872414D) * d3;
double d10 = 0.0D + Math.cos(d1 + 5.497787143782138D) * d3;
double d11 = 0.0D + Math.sin(d1 + 5.497787143782138D) * d3;
double d12 = 0.0D + Math.cos(d1 + Math.PI) * d2;
double d13 = 0.0D + Math.sin(d1 + Math.PI) * d2;
double d14 = 0.0D + Math.cos(d1 + 0.0D) * d2;
double d15 = 0.0D + Math.sin(d1 + 0.0D) * d2;
double d16 = 0.0D + Math.cos(d1 + Math.PI / 2D) * d2;
double d17 = 0.0D + Math.sin(d1 + Math.PI / 2D) * d2;
double d18 = 0.0D + Math.cos(d1 + Math.PI * 3D / 2D) * d2;
double d19 = 0.0D + Math.sin(d1 + Math.PI * 3D / 2D) * d2;
double d22 = -1.0F + f3;
double d23 = d0 * (0.5D / d2) + d22;
worldrenderer.pos(d12, d0, d13).tex(0.4999D, d23).color(j, k, l, 100).endVertex();
worldrenderer.pos(d12, 0.0D, d13).tex(0.4999D, d22).color(j, k, l, 100).endVertex();
worldrenderer.pos(d14, 0.0D, d15).tex(0.0D, d22).color(j, k, l, 100).endVertex();
worldrenderer.pos(d14, d0, d15).tex(0.0D, d23).color(j, k, l, 100).endVertex();
worldrenderer.pos(d16, d0, d17).tex(0.4999D, d23).color(j, k, l, 100).endVertex();
worldrenderer.pos(d16, 0.0D, d17).tex(0.4999D, d22).color(j, k, l, 100).endVertex();
worldrenderer.pos(d18, 0.0D, d19).tex(0.0D, d22).color(j, k, l, 100).endVertex();
worldrenderer.pos(d18, d0, d19).tex(0.0D, d23).color(j, k, l, 100).endVertex();
double d24 = 0.0D;
if (entity.ticksExisted % 2 == 0) {
d24 = 0.5D;
}
worldrenderer.pos(d4, d0, d5).tex(0.5D, d24 + 0.5D).color(j, k, l, 100).endVertex();
worldrenderer.pos(d6, d0, d7).tex(1.0D, d24 + 0.5D).color(j, k, l, 100).endVertex();
worldrenderer.pos(d10, d0, d11).tex(1.0D, d24).color(j, k, l, 100).endVertex();
worldrenderer.pos(d8, d0, d9).tex(0.5D, d24).color(j, k, l, 100).endVertex();
tessellator.draw();
GlStateManager.enableLighting();
GlStateManager.enableCull();
GlStateManager.enableBlend();
GlStateManager.popMatrix();
}
}
Aggregations