use of net.minecraft.client.renderer.BufferBuilder in project BloodMagic by WayofTime.
the class RenderEntitySentientArrow method doRender.
public void doRender(EntitySentientArrow 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 = (float) (i * 10) / 32.0F;
float f3 = (float) (5 + i * 10) / 32.0F;
float f4 = 0.0F;
float f5 = 0.15625F;
float f6 = (float) (5 + i * 10) / 32.0F;
float f7 = (float) (10 + i * 10) / 32.0F;
float f8 = 0.05625F;
GlStateManager.enableRescaleNormal();
float f9 = (float) 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);
GL11.glNormal3f(f8, 0.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double) f4, (double) f6).endVertex();
worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double) f5, (double) f6).endVertex();
worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double) f5, (double) f7).endVertex();
worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double) f4, (double) f7).endVertex();
tessellator.draw();
GL11.glNormal3f(-f8, 0.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double) f4, (double) f6).endVertex();
worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double) f5, (double) f6).endVertex();
worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double) f5, (double) f7).endVertex();
worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double) f4, (double) f7).endVertex();
tessellator.draw();
for (int j = 0; j < 4; ++j) {
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f8);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex((double) f, (double) f2).endVertex();
worldrenderer.pos(8.0D, -2.0D, 0.0D).tex((double) f1, (double) f2).endVertex();
worldrenderer.pos(8.0D, 2.0D, 0.0D).tex((double) f1, (double) f3).endVertex();
worldrenderer.pos(-8.0D, 2.0D, 0.0D).tex((double) f, (double) f3).endVertex();
tessellator.draw();
}
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
use of net.minecraft.client.renderer.BufferBuilder in project BloodMagic by WayofTime.
the class RenderBloodTank method renderFluid.
public void renderFluid(float maxHeight, Fluid renderFluid, double x, double y, double z) {
maxHeight = maxHeight * 0.575F;
GlStateManager.translate(x, y, z);
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
TextureAtlasSprite fluid = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(renderFluid.getStill().toString());
fluid = fluid == null ? mc.getTextureMapBlocks().getMissingSprite() : fluid;
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
final int rgbaColor = renderFluid.getColor();
final int rColor = rgbaColor >> 16 & 0xFF;
final int gColor = rgbaColor >> 8 & 0xFF;
final int bColor = rgbaColor & 0xFF;
final int aColor = rgbaColor >> 24 & 0xFF;
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(rColor, gColor, bColor, aColor);
float u1 = fluid.getMinU();
float v1 = fluid.getMinV();
float u2 = fluid.getMaxU();
float v2 = fluid.getMaxV();
if (maxHeight > 0) {
float texWidth = u2 - u1;
// TOP
buffer.pos(0.25, maxHeight + 0.05, 0.25).tex(u1 + 0.75 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.25, maxHeight + 0.05, 0.75).tex(u1 + 0.75 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.75, maxHeight + 0.05, 0.75).tex(u1 + 0.25 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.75, maxHeight + 0.05, 0.25).tex(u1 + 0.25 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
// NORTH
buffer.pos(0.75, maxHeight + 0.05, 0.25).tex(u1 + 0.75 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.75, 0, 0.25).tex(u1 + 0.75 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.25, 0, 0.25).tex(u1 + 0.25 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.25, maxHeight + 0.05, 0.25).tex(u1 + 0.25 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
// EAST
buffer.pos(0.25, 0, 0.75).tex(u1 + 0.75 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.25, maxHeight + 0.05, 0.75).tex(u1 + 0.75 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.25, maxHeight + 0.05, 0.25).tex(u1 + 0.25 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.25, 0, 0.25).tex(u1 + 0.25 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
// SOUTH
buffer.pos(0.75, 0, 0.75).tex(u1 + 0.75 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.75, maxHeight + 0.05, 0.75).tex(u1 + 0.75 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.25, maxHeight + 0.05, 0.75).tex(u1 + 0.25 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.25, 0, 0.75).tex(u1 + 0.25 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
// WEST
buffer.pos(0.75, maxHeight + 0.05, 0.75).tex(u1 + 0.75 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.75, 0, 0.75).tex(u1 + 0.75 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.75, 0, 0.25).tex(u1 + 0.25 * texWidth, v1).color(rColor, gColor, bColor, aColor).endVertex();
buffer.pos(0.75, maxHeight + 0.05, 0.25).tex(u1 + 0.25 * texWidth, v1 + (maxHeight + 0.05) * texWidth).color(rColor, gColor, bColor, aColor).endVertex();
}
tessellator.draw();
RenderHelper.enableStandardItemLighting();
}
use of net.minecraft.client.renderer.BufferBuilder in project BloodMagic by WayofTime.
the class LayerAlchemyCircle method doRenderLayer.
@Override
public void doRenderLayer(EntityCorruptedSheep demon, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (demon.getCastTimer() <= 0) {
return;
}
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder wr = tessellator.getBuffer();
GlStateManager.pushMatrix();
float rot = this.rotationspeed * (partialTicks + demon.ticksExisted);
float secondaryRot = 0;
float size = 3.0F;
// Bind the texture to the circle
Minecraft.getMinecraft().renderEngine.bindTexture(ARRAY_TEXTURE);
GlStateManager.disableCull();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 1);
GlStateManager.translate(0, 1.5, 0);
GlStateManager.rotate(90.0f, 1, 0, 0);
GlStateManager.pushMatrix();
// GlStateManager.translate(0, 0.5f, 0);
GlStateManager.pushMatrix();
GlStateManager.rotate(rot, 0, 0, 1);
GlStateManager.rotate(secondaryRot, 1, 0, 0);
GlStateManager.rotate(secondaryRot * 0.45812f, 0, 0, 1);
double var31 = 0.0D;
double var33 = 1.0D;
double var35 = 0;
double var37 = 1;
GlStateManager.color(1f, 1f, 1f, 1f);
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
// wr.setBrightness(200);
wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.disableBlend();
GlStateManager.enableCull();
GlStateManager.popMatrix();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BufferBuilder in project BloodMagic by WayofTime.
the class AlchemyCircleRenderer method renderAt.
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
if (!(tile instanceof TileAlchemyArray)) {
return;
}
TileAlchemyArray tileArray = (TileAlchemyArray) tile;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder wr = tessellator.getBuffer();
GlStateManager.pushMatrix();
// float rot = (float)(this.worldObj.provider.getWorldTime() % (360 /
// this.rotationspeed) * this.rotationspeed) + this.rotationspeed * f;
float rot = getRotation(craftTime);
float secondaryRot = getSecondaryRotation(craftTime);
float size = 1.0F * getSizeModifier(craftTime);
// Bind the texture to the circle
Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
GlStateManager.disableCull();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 1);
GlStateManager.translate(x, y, z);
// Specify which face this "circle" is located on
EnumFacing sideHit = EnumFacing.UP;
EnumFacing rotation = tileArray.getRotation();
GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
switch(sideHit) {
case DOWN:
GlStateManager.translate(0, 0, 1);
GlStateManager.rotate(-90.0f, 1, 0, 0);
break;
case EAST:
GlStateManager.rotate(-90.0f, 0, 1, 0);
GlStateManager.translate(0, 0, -1);
break;
case NORTH:
break;
case SOUTH:
GlStateManager.rotate(180.0f, 0, 1, 0);
GlStateManager.translate(-1, 0, -1);
break;
case UP:
GlStateManager.translate(0, 1, 0);
GlStateManager.rotate(90.0f, 1, 0, 0);
break;
case WEST:
GlStateManager.translate(0, 0, 1);
GlStateManager.rotate(90.0f, 0, 1, 0);
break;
}
GlStateManager.pushMatrix();
GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
GlStateManager.rotate(rotation.getHorizontalAngle() + 180, 0, 0, 1);
GlStateManager.pushMatrix();
GlStateManager.rotate(rot, 0, 0, 1);
GlStateManager.rotate(secondaryRot, 1, 0, 0);
GlStateManager.rotate(secondaryRot * 0.45812f, 0, 0, 1);
double var31 = 0.0D;
double var33 = 1.0D;
double var35 = 0;
double var37 = 1;
GlStateManager.color(1f, 1f, 1f, 1f);
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
// wr.setBrightness(200);
wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
// GlStateManager.depthMask(true);
GlStateManager.disableBlend();
GlStateManager.enableCull();
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.popMatrix();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BufferBuilder in project BloodMagic by WayofTime.
the class Sprite method draw.
public void draw(int x, int y) {
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(7, DefaultVertexFormats.POSITION_TEX);
buffer.pos((double) x, (double) (y + getTextureHeight()), 1.0F).tex((double) ((float) (getTextureX()) * f), (double) ((float) (getTextureY() + getTextureHeight()) * f1)).endVertex();
buffer.pos((double) (x + getTextureWidth()), (double) (y + getTextureHeight()), 1.0F).tex((double) ((float) (getTextureX() + getTextureWidth()) * f), (double) ((float) (getTextureY() + getTextureHeight()) * f1)).endVertex();
buffer.pos((double) (x + getTextureWidth()), (double) (y), 1.0F).tex((double) ((float) (getTextureX() + getTextureWidth()) * f), (double) ((float) (getTextureY()) * f1)).endVertex();
buffer.pos((double) x, (double) (y), 1.0F).tex((double) ((float) (getTextureX()) * f), (double) ((float) (getTextureY()) * f1)).endVertex();
tessellator.draw();
}
Aggregations