本文整理匯總了Java中net.minecraft.client.renderer.BufferBuilder.begin方法的典型用法代碼示例。如果您正苦於以下問題:Java BufferBuilder.begin方法的具體用法?Java BufferBuilder.begin怎麽用?Java BufferBuilder.begin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.renderer.BufferBuilder
的用法示例。
在下文中一共展示了BufferBuilder.begin方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: render
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public void render(BufferBuilder renderer) {
int numVertices = vertices.length;
if(faceNormal == null)
faceNormal = calculateFaceNormal();
renderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
for (int i = 0; i < numVertices; ++i) {
Vertex v = vertices[i];
TextureCoordinate tc = textureCoordinates[i];
renderer.pos(v.x, v.y, v.z).tex(tc.u, tc.v).normal(faceNormal.x, faceNormal.y, faceNormal.z).endVertex();
}
//Renderer works with four vertices so add start point again if face is only three vertices.
if(numVertices == 3)
renderer.pos(vertices[0].x, vertices[0].y, vertices[0].z).tex(textureCoordinates[0].u, textureCoordinates[0].v).normal(faceNormal.x, faceNormal.y, faceNormal.z).endVertex();
Tessellator.getInstance().draw();
}
示例2: drawCircle
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
public static void drawCircle(double radius, double innerWidth, double x, double y, double z, Color color,
int segments)
{
Tessellator tes = Tessellator.getInstance();
BufferBuilder vb = tes.getBuffer();
GlStateManager.disableCull();
vb.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR);
for (int deg = 0; deg <= segments; deg++)
{
double radius1 = deg % 2 == 0 ? radius : innerWidth;
vb.pos(x + Math.cos(Math.toRadians(deg)) * (radius1), y, z + Math.sin(Math.toRadians(deg)) * radius1)
.color(color.getRed(), color.getGreen(), color.getBlue(), 1).endVertex();
vb.pos(x + Math.cos(Math.toRadians(deg + 1)) * (radius), y, z + Math.sin(Math.toRadians(deg + 1)) * radius)
.color(color.getRed(), color.getGreen(), color.getBlue(), 1).endVertex();
vb.pos(x + Math.cos(Math.toRadians(deg + 2)) * (radius1), y,
z + Math.sin(Math.toRadians(deg + 2)) * radius1)
.color(color.getRed(), color.getGreen(), color.getBlue(), 1).endVertex();
}
tes.draw();
}
示例3: render
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
@Override
public void render(Vector3 cameraPos) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
double off = 0.03 - cameraPos.getY();
for (LineStyle line : this.style.getLines()) {
if (!line.prepare(this.style.getRenderType())) {
continue;
}
buf.begin(GL_LINES, DefaultVertexFormats.POSITION);
line.applyColour();
for (PointRectangle point : this.points) {
if (point != null) {
Vector2 pos = point.getPoint();
double x = pos.getX() - cameraPos.getX();
double z = pos.getY() - cameraPos.getZ();
buf.pos(x + 0.5, this.min + off, z + 0.5).endVertex();
buf.pos(x + 0.5, this.max + 1 + off, z + 0.5).endVertex();
}
}
tessellator.draw();
}
}
示例4: renderTick
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
@Override
public void renderTick(float partialTicks)
{
Minecraft.getMinecraft().mcProfiler.startSection("expParticleDraw");
Minecraft.getMinecraft().renderEngine.bindTexture(ExPTextures.PARTICLES);
BufferBuilder bb = Tessellator.getInstance().getBuffer();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
bb.begin(GL11.GL_QUADS, this.getDrawFormat());
particles.get(BlockRenderLayer.SOLID).forEach(p -> p.draw(bb, partialTicks, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationYZ(), ActiveRenderInfo.getRotationXY()));
Tessellator.getInstance().draw();
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
bb.begin(GL11.GL_QUADS, this.getDrawFormat());
particles.get(BlockRenderLayer.CUTOUT).forEach(p -> p.draw(bb, partialTicks, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationYZ(), ActiveRenderInfo.getRotationXY()));
Tessellator.getInstance().draw();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
bb.begin(GL11.GL_QUADS, this.getDrawFormat());
particles.get(BlockRenderLayer.TRANSLUCENT).forEach(p -> p.draw(bb, partialTicks, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationYZ(), ActiveRenderInfo.getRotationXY()));
Tessellator.getInstance().draw();
Minecraft.getMinecraft().mcProfiler.endSection();
}
示例5: render
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
@Override
public void render(int mouseX, int mouseY, float partialTick) {
drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? 0xFFA0A0A0 : 0xFF999999);
drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? 0xFF202020 : 0xFFAAAAAA);
if (checked) {
GlStateManager.disableTexture2D();
if (enabled) {
GlStateManager.color(1, 1, 1, 1);
} else {
GlStateManager.color(0.8f, 0.8f, 0.8f, 1);
}
BufferBuilder wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
wr.pos(x + 2, y + 5, zLevel).endVertex();
wr.pos(x + 5, y + 7, zLevel).endVertex();
wr.pos(x + 8, y + 3, zLevel).endVertex();
Tessellator.getInstance().draw();
GlStateManager.enableTexture2D();
GlStateManager.color(0.25f, 0.25f, 0.25f, 1);
}
fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888);
}
示例6: renderQuadBright
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
public static void renderQuadBright(double angle, Face face, Face rface) {
int brightness = 240;
int b1 = brightness >> 16 & 65535;
int b2 = brightness & 65535;
GlStateManager.pushMatrix();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(7, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
double f = 1.75;
renderFace(face, angle, b1, b2, buffer, f, 200);
renderFace(face, -angle, b1, b2, buffer, f, 60);
renderFace(rface, angle, b1, b2, buffer, f, 200);
renderFace(rface, -angle, b1, b2, buffer, f, 60);
tessellator.draw();
GlStateManager.popMatrix();
}
示例7: render
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
@Override
public void render(Vector3 cameraPos) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
double xPos = this.centreX - cameraPos.getX();
double zPos = this.centreZ - cameraPos.getZ();
for (LineStyle line : this.style.getLines()) {
if (!line.prepare(this.style.getRenderType())) {
continue;
}
double twoPi = Math.PI * 2;
for (int yBlock = this.minY + 1; yBlock <= this.maxY; yBlock++) {
buf.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
line.applyColour();
for (int i = 0; i <= 75; i++) {
double tempTheta = i * twoPi / 75;
double tempX = this.radX * Math.cos(tempTheta);
double tempZ = this.radZ * Math.sin(tempTheta);
buf.pos(xPos + tempX, yBlock - cameraPos.getY(), zPos + tempZ).endVertex();
}
tessellator.draw();
}
}
}
示例8: renderChunkBorder
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
private void renderChunkBorder(double yMin, double yMax, double xBase, double zBase) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buf = tessellator.getBuffer();
int spacing = 16;
for (LineStyle line : this.style.getLines()) {
if (line.prepare(this.style.getRenderType())) {
buf.begin(GL_LINES, DefaultVertexFormats.POSITION);
line.applyColour();
for (int x = -16; x <= 32; x += spacing) {
for (int z = -16; z <= 32; z += spacing) {
buf.pos(xBase + x, yMin, zBase - z).endVertex();
buf.pos(xBase + x, yMax, zBase - z).endVertex();
}
}
for (double y = yMin; y <= yMax; y += yMax) {
buf.pos(xBase, y, zBase).endVertex();
buf.pos(xBase, y, zBase - 16).endVertex();
buf.pos(xBase, y, zBase - 16).endVertex();
buf.pos(xBase + 16, y, zBase - 16).endVertex();
buf.pos(xBase + 16, y, zBase - 16).endVertex();
buf.pos(xBase + 16, y, zBase).endVertex();
buf.pos(xBase + 16, y, zBase).endVertex();
buf.pos(xBase, y, zBase).endVertex();
}
tessellator.draw();
}
}
}
示例9: renderHUD
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(int x, int y, Minecraft mc, int amplifier) {
mc.renderEngine.bindTexture(ResourceLocations.BREW_TEXTURES);
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder buf = tessellator.getBuffer();
GlStateManager.color(1F, 1F, 1F, 1F);
final float f = 0.00390625F;
buf.begin(7, DefaultVertexFormats.POSITION_TEX);
buf.pos(x, y + 20, 0).tex(236 * f, (236 + 20) * f).endVertex();
buf.pos(x + 20, y + 20, 0).tex((236 + 20) * f, (236 + 20) * f).endVertex();
buf.pos(x + 20, y, 0).tex((236 + 20) * f, 236 * f).endVertex();
buf.pos(x, y, 0).tex(236 * f, 236 * f).endVertex();
tessellator.draw();
int textureX = 9 % 14 * 18;
int textureY = 0;
x += 1;
y += 1;
GlStateManager.pushMatrix();
EnumDyeColor dye = EnumDyeColor.byDyeDamage(Math.min(amplifier, EnumDyeColor.values().length - 1));
int rgb = dye.getColorValue();
float r = (rgb >>> 16 & 0xFF) / 256.0F;
float g = (rgb >>> 8 & 0xFF) / 256.0F;
float b = (rgb & 0xFF) / 256.0F;
GlStateManager.color(r, g, b);
buf.begin(7, DefaultVertexFormats.POSITION_TEX);
buf.pos(x, y + 18, 0).tex(textureX * f, (textureY + 18) * f).endVertex();
buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * f, (textureY + 18) * f).endVertex();
buf.pos(x + 18, y, 0).tex((textureX + 18) * f, textureY * f).endVertex();
buf.pos(x, y, 0).tex(textureX * f, textureY * f).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
}
示例10: renderModel
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
private static void renderModel(IBakedModel model, VertexFormat fmt, int color)
{
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, fmt);
for (BakedQuad bakedquad : model.getQuads(null, null, 0))
{
LightUtil.renderQuadColor(worldrenderer, bakedquad, color);
}
tessellator.draw();
}
示例11: drawCustomGui
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
private void drawCustomGui(double x, double y, double width, double height, double zLevel)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
bufferbuilder.begin(7, DefaultVertexFormats.POSITION);
bufferbuilder.pos(x + 0, y + height, zLevel).endVertex();
bufferbuilder.pos(x + width, y + height, zLevel).endVertex();
bufferbuilder.pos(x + width, y + 0, zLevel).endVertex();
bufferbuilder.pos(x + 0, y + 0, zLevel).endVertex();
tessellator.draw();
}
示例12: prepLineRender
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
public static BufferBuilder prepLineRender(float partialTicks)
{
GlStateManager.disableTexture2D();
GlStateManager.disableBlend();
GlStateManager.glLineWidth(line);
BufferBuilder bufferbuilder = prepRender(partialTicks, true);
bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
return bufferbuilder;
}
示例13: render
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
public static void render(double minX, double minY, double maxX, double maxY, double zLevel, int progress) {
//float red = 0.5F;
// float green = 0.5F;
// float blue = 0.5F;
//float alpha = 0.3F;
BufferBuilder wr = Tessellator.getInstance().getBuffer();
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
// GL11.glEnable(GL11.GL_BLEND);
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glLineWidth(2.0F);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
double caseDistance = 0D;
// draw the bar
// GL11.glLineWidth((float)(maxY - minY) * 1.95F);
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
// tessellator.setColorRGBA_F(red, green, blue, alpha);
wr.pos(minX + (maxX - minX) * caseDistance, minY + (maxY - minY) * caseDistance, zLevel).endVertex();
wr.pos(minX + (maxX - minX) * caseDistance, minY + (maxY - minY) * (1D - caseDistance), zLevel).endVertex();
wr.pos(minX + (maxX - minX) * caseDistance + (maxX - minX) * (1D - 2 * caseDistance) * progress / 100D, minY + (maxY - minY) * (1D - caseDistance), zLevel).endVertex();
wr.pos(minX + (maxX - minX) * caseDistance + (maxX - minX) * (1D - 2 * caseDistance) * progress / 100D, minY + (maxY - minY) * caseDistance, zLevel).endVertex();
Tessellator.getInstance().draw();
GL11.glColor4f(0, 0, 0, 1);
// draw the casing.
wr.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION);
// tessellator.setColorRGBA_F(red, green, blue, alpha);
wr.pos(minX, minY, zLevel).endVertex();
wr.pos(minX, maxY, zLevel).endVertex();
wr.pos(maxX, maxY, zLevel).endVertex();
wr.pos(maxX, minY, zLevel).endVertex();
Tessellator.getInstance().draw();
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
示例14: renderPlayer
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderPlayer(RenderPlayerEvent.Post event) {
ItemStack stack=event.getEntityPlayer().getHeldItemMainhand();
if(event.getEntity().getDataManager().get(SPIN_TIME)){
GlStateManager.popMatrix();
if(!stack.isEmpty()&&!event.getEntity().isInvisible()){
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuffer();
GlStateManager.pushMatrix();
GlStateManager.translate((float) 0, (float) 0 + 0.1D, (float) 0);
// GL11.glRotatef((living.prevRotationYawHead +
// (living.rotationYawHead - living.prevRotationYawHead) *
// p_76986_9_)*-1, 0.0F, 1.0F, 0.0F);
// GL11.glRotatef((living.prevRotationPitch + (living.rotationPitch
// - living.prevRotationPitch) * p_76986_9_), 1.0F, 0.0F, 0.0F);
// GlStateManager.disableTexture2D();
int cooldown=getSpinCooldown(stack,event.getEntityPlayer());
double range=SpinToWin.range + EnchantmentHelper.getEnchantmentLevel(ench, stack)*0.36+0.1;
float alpha= 0.3f + (float)((this.getDuration(stack, event.getEntityPlayer())-event.getEntityPlayer().getEntityData().getInteger("SpinTime"))%cooldown)/(float)cooldown*0.5f;
Minecraft.getMinecraft().getTextureManager().bindTexture(SPIN_TEXTURE);
GlStateManager.disableLighting();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
if(isSword(stack.getItem()))
GlStateManager.color(0.8F, 0.65F, 0.4F, alpha);
else
GlStateManager.color(0.6F, 0.18F, 0.1F, alpha);
/*
* if(TF2weapons.getTeamForDisplay(living)==0){ GL11.glColor4f(1.0F,
* 0.0F, 0.0F, 0.28F); } else{ GL11.glColor4f(0.0F, 0.0F, 1.0F,
* 0.28F); }
*/
renderer.begin(7, DefaultVertexFormats.POSITION_TEX);
renderer.pos(-range, 0.0D, range).tex(0D, 1D).endVertex();
renderer.pos(range, 0.0D, range).tex(1D, 1D).endVertex();
renderer.pos(range, 0.0D, -range).tex(1D, 0.0D).endVertex();
renderer.pos(-range, 0.0D, -range).tex(0D, 0.0D).endVertex();
tessellator.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
GL11.glDisable(GL11.GL_BLEND);
// GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
}
}
示例15: renderGuiFluid
import net.minecraft.client.renderer.BufferBuilder; //導入方法依賴的package包/類
public static void renderGuiFluid(FluidStack fluid, float fill, int x, int y, int width, int maxHeight)
{
if (fluid != null && fluid.getFluid() != null && fluid.amount > 0)
{
TextureAtlasSprite sprite = getStillTexture(fluid);
if (sprite != null)
{
int rendHeight = (int) Math.max(Math.min((float) maxHeight, (float) maxHeight * fill), 1.0F);
int yPos = y + maxHeight - rendHeight;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
int fluidColor = fluid.getFluid().getColor(fluid);
GL11.glColor3ub((byte) (fluidColor >> 16 & 255), (byte) (fluidColor >> 8 & 255), (byte) (fluidColor & 255));
GlStateManager.enableBlend();
for (int i = 0; i < width; i += 16)
{
for (int j = 0; j < rendHeight; j += 16)
{
int dwt = Math.min(width - i, 16);
int dht = Math.min(rendHeight - j, 16);
int dx = x + i;
int dy = yPos + j;
double minU = (double) sprite.getMinU();
double maxU = (double) sprite.getMaxU();
double minV = (double) sprite.getMinV();
double maxV = (double) sprite.getMaxV();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder tes = tessellator.getBuffer();
tes.begin(7, DefaultVertexFormats.POSITION_TEX);
tes.pos((double) dx, (double) (dy + dht), 0.0D).tex(minU, minV + (maxV - minV) * (double) dht / 16.0D).endVertex();
tes.pos((double) (dx + dwt), (double) (dy + dht), 0.0D).tex(minU + (maxU - minU) * (double) dwt / 16.0D, minV + (maxV - minV) * (double) dht / 16.0D).endVertex();
tes.pos((double) (dx + dwt), (double) dy, 0.0D).tex(minU + (maxU - minU) * (double) dwt / 16.0D, minV).endVertex();
tes.pos((double) dx, (double) dy, 0.0D).tex(minU, minV).endVertex();
tessellator.draw();
}
}
GlStateManager.disableBlend();
}
}
}