use of net.minecraft.client.renderer.BufferBuilder in project Random-Things by lumien231.
the class RenderArtificialEndPortal method doRender.
@Override
public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) {
EntityArtificialEndPortal portal = (EntityArtificialEndPortal) entity;
double size = Math.min(3, 3f / 115 * (portal.actionTimer + partialTicks - 85));
if (portal.actionTimer > 85) {
GlStateManager.disableLighting();
RANDOM.setSeed(31100L);
GlStateManager.getFloat(2982, MODELVIEW);
GlStateManager.getFloat(2983, PROJECTION);
double d0 = x * x + y * y + z * z;
int i = this.getPasses(d0);
float f = this.getOffset();
boolean flag = false;
for (int j = 0; j < i; ++j) {
GlStateManager.pushMatrix();
float f1 = 2.0F / (float) (18 - j);
if (j == 0) {
this.bindTexture(END_SKY_TEXTURE);
f1 = 0.15F;
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
}
if (j >= 1) {
this.bindTexture(END_PORTAL_TEXTURE);
flag = true;
Minecraft.getMinecraft().entityRenderer.setupFogColor(true);
}
if (j == 1) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
}
GlStateManager.texGen(GlStateManager.TexGen.S, 9216);
GlStateManager.texGen(GlStateManager.TexGen.T, 9216);
GlStateManager.texGen(GlStateManager.TexGen.R, 9216);
GlStateManager.texGen(GlStateManager.TexGen.S, 9474, this.getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
GlStateManager.texGen(GlStateManager.TexGen.T, 9474, this.getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
GlStateManager.texGen(GlStateManager.TexGen.R, 9474, this.getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.S);
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.T);
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.R);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.translate(0.5F, 0.5F, 0.0F);
GlStateManager.scale(0.5F, 0.5F, 1.0F);
float f2 = (float) (j + 1);
GlStateManager.translate(17.0F / f2, (2.0F + f2 / 1.5F) * ((float) Minecraft.getSystemTime() % 800000.0F / 800000.0F), 0.0F);
GlStateManager.rotate((f2 * f2 * 4321.0F + f2 * 9.0F) * 2.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.scale(4.5F - f2 / 4.0F, 4.5F - f2 / 4.0F, 1.0F);
GlStateManager.multMatrix(PROJECTION);
GlStateManager.multMatrix(MODELVIEW);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
float f3 = (RANDOM.nextFloat() * 0.5F + 0.1F) * f1;
float f4 = (RANDOM.nextFloat() * 0.5F + 0.4F) * f1;
float f5 = (RANDOM.nextFloat() * 0.5F + 0.5F) * f1;
double size_half = size / 2;
bufferbuilder.pos(x - size_half, y + (double) f, z + size_half).color(f3, f4, f5, 1.0F).endVertex();
bufferbuilder.pos(x + size_half, y + (double) f, z + size_half).color(f3, f4, f5, 1.0F).endVertex();
bufferbuilder.pos(x + size_half, y + (double) f, z - size_half).color(f3, f4, f5, 1.0F).endVertex();
bufferbuilder.pos(x - size_half, y + (double) f, z - size_half).color(f3, f4, f5, 1.0F).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
this.bindTexture(END_SKY_TEXTURE);
}
GlStateManager.disableBlend();
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.S);
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.T);
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.R);
GlStateManager.enableLighting();
if (flag) {
Minecraft.getMinecraft().entityRenderer.setupFogColor(false);
}
}
}
use of net.minecraft.client.renderer.BufferBuilder in project Random-Things by lumien231.
the class RenderSoul method doRender.
private void doRender(EntitySoul soul, double posX, double posY, double posZ, float p_76986_8_, float p_76986_9_) {
if (soul.render) {
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
RenderUtils.enableDefaultBlending();
Minecraft.getMinecraft().entityRenderer.disableLightmap();
GlStateManager.translate((float) posX + 0.15f, (float) posY + 0.3F, (float) posZ);
GlStateManager.scale(0.3f, 0.3f, 0.3f);
this.bindEntityTexture(soul);
GlStateManager.translate(-0.5F, -0.5F, 0);
GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.5F, 0.5F, 0);
int i = 1;
float f2 = 1;
float f3 = 0;
float f4 = 0;
float f5 = 1;
float f6 = 1.0F;
float f7 = 1F;
float f8 = 1F;
GlStateManager.color(1, 1, 1);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldRenderer = tessellator.getBuffer();
worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldRenderer.pos(0.0F - f7, 0.0F - f8, 0.0D).tex(f2, f5).endVertex();
worldRenderer.pos(f6 - f7, 0.0F - f8, 0.0D).tex(f3, f5).endVertex();
worldRenderer.pos(f6 - f7, 1.0F - f8, 0.0D).tex(f3, f4).endVertex();
worldRenderer.pos(0.0F - f7, 1.0F - f8, 0.0D).tex(f2, f4).endVertex();
tessellator.draw();
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.disableRescaleNormal();
Minecraft.getMinecraft().entityRenderer.enableLightmap();
GlStateManager.popMatrix();
}
}
use of net.minecraft.client.renderer.BufferBuilder in project FoodCraft-Reloaded by LasmGratel.
the class FluidStackRenderer method drawTextureWithMasking.
private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
double uMin = (double) textureSprite.getMinU();
double uMax = (double) textureSprite.getMaxU();
double vMin = (double) textureSprite.getMinV();
double vMax = (double) textureSprite.getMaxV();
uMax = uMax - (maskRight / 16.0 * (uMax - uMin));
vMax = vMax - (maskTop / 16.0 * (vMax - vMin));
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
bufferBuilder.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
bufferBuilder.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
tessellator.draw();
}
use of net.minecraft.client.renderer.BufferBuilder in project takumicraft by TNTModders.
the class RenderTakumiBlock method render.
@Override
public void render(T te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
if (te.getBlock() != null && te.getBlock() != Blocks.AIR) {
GlStateManager.pushMatrix();
BlockPos pos = new BlockPos(x, y, z);
IBlockState state = te.state != null ? te.state : te.getBlock().getStateFromMeta(te.getMeta());
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
this.draw(te, x, y, z, state, pos, buffer, tessellator);
GlStateManager.popMatrix();
}
if (te.getBlock() == null || Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() == Item.getItemFromBlock(TakumiBlockCore.TAKUMI_BLOCK) || Minecraft.getMinecraft().player.getHeldItemOffhand().getItem() == Item.getItemFromBlock(TakumiBlockCore.TAKUMI_BLOCK)) {
GlStateManager.pushMatrix();
GlStateManager.depthMask(true);
this.bindTexture(TEXTURE_ARMOR);
GlStateManager.matrixMode(GL11.GL_TEXTURE);
GlStateManager.loadIdentity();
float f = Minecraft.getMinecraft().world.getWorldTime();
GlStateManager.translate(f * 0.01F, f * 0.01F, 0.0F);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.enableBlend();
float f4 = 0.5F;
GlStateManager.color(f4, f4, f4, 1.0F);
GlStateManager.enableLighting();
GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
GlStateManager.matrixMode(GL11.GL_TEXTURE);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.translate((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE_ARMOR);
takumiBlocks.get(Minecraft.getMinecraft().player.ticksExisted % 64).render();
GlStateManager.disableLighting();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
}
use of net.minecraft.client.renderer.BufferBuilder in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class RenderEntitySharpshooterBullet method doRender.
@Override
public void doRender(EntitySharpshooterBullet entity, double x, double y, double z, float entityYaw, float partialTicks) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldRenderer = tessellator.getBuffer();
if (entity.ticksExisted < 1)
return;
textureGetter.apply(texture);
bindEntityTexture(entity);
GL11.glPushMatrix();
{
GL11.glTranslatef((float) x, (float) y, (float) z);
// GL11.glRotatef(entityYaw, 0.0F, 1.0F, -1.0F);
GL11.glScalef(0.02f, 0.02f, 0.02f);
// GL11.glRotatef(90F - entity.prevRotationPitch -
// (entity.rotationPitch - entity.prevRotationPitch) * partialTicks,
// 1.0F, 0.0F, 0.0F);
IModel model = null;
try {
model = B3DLoader.INSTANCE.loadModel(this.model);
} catch (Exception e) {
model = ModelLoaderRegistry.getMissingModel();
}
IBakedModel bakedModel = model.bake((TRSRTransformation.identity()), Attributes.DEFAULT_BAKED_FORMAT, textureGetter);
worldRenderer.begin(7, Attributes.DEFAULT_BAKED_FORMAT);
// Get Quads
List<BakedQuad> generalQuads = bakedModel.getQuads(null, null, 1);
for (BakedQuad q : generalQuads) {
int[] vd = q.getVertexData();
worldRenderer.addVertexData(vd);
}
for (EnumFacing face : EnumFacing.values()) {
List<BakedQuad> faceQuads = bakedModel.getQuads(null, null, 1);
for (BakedQuad q : faceQuads) {
int[] vd = q.getVertexData();
worldRenderer.addVertexData(vd);
}
}
tessellator.draw();
}
GL11.glPopMatrix();
}
Aggregations