当前位置: 首页>>代码示例>>Java>>正文


Java Tessellator类代码示例

本文整理汇总了Java中net.minecraft.client.renderer.Tessellator的典型用法代码示例。如果您正苦于以下问题:Java Tessellator类的具体用法?Java Tessellator怎么用?Java Tessellator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Tessellator类属于net.minecraft.client.renderer包,在下文中一共展示了Tessellator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawPlusAndMinus

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
private void drawPlusAndMinus() {
    double scale = 0.05D;
    GL11.glPushMatrix();
    GL11.glTranslated(0.26D, 13.95D / 16D, 0);
    GL11.glRotated(90, 1, 0, 0);
    GL11.glScaled(scale, scale, scale);
    GL11.glColor4d(0, 1, 0, 1);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
    bufferBuilder.pos(-1, 0, 0).endVertex();
    bufferBuilder.pos(1, 0, 0).endVertex();
    bufferBuilder.pos(0, -1, 0).endVertex();
    bufferBuilder.pos(0, 1, 0).endVertex();
    tessellator.draw();
    GL11.glTranslated(-0.52D / scale, 0, 0);
    GL11.glColor4d(1, 0, 0, 1);
    bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
    bufferBuilder.pos(-1, 0, 0).endVertex();
    bufferBuilder.pos(1, 0, 0).endVertex();
    tessellator.draw();
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glPopMatrix();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:25,代码来源:ModelVacuumPump.java

示例2: render

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
@Override
public void render() {
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture());
    int width = getWidth() + (getParameters() != null && getParameters().length > 0 ? 10 : 0);
    int height = getHeight() + (hasStepOutput() ? 10 : 0);
    Pair<Double, Double> maxUV = getMaxUV();
    double u = maxUV.getLeft();
    double v = maxUV.getRight();
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    wr.pos(0, 0, 0).tex(0, 0).endVertex();
    wr.pos(0, height, 0).tex(0, v).endVertex();
    wr.pos(width, height, 0).tex(u, v).endVertex();
    wr.pos(width, 0, 0).tex(u, 0).endVertex();
    Tessellator.getInstance().draw();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:ProgWidget.java

示例3: blitIcon

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
private void blitIcon(int p_178051_1_, int p_178051_2_, ResourceLocation p_178051_3_)
{
    int i = p_178051_1_ + 5;
    GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ - 1, -2039584);
    GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ + 32, -6250336);
    GuiScreenCustomizePresets.this.drawVerticalLine(i - 1, p_178051_2_ - 1, p_178051_2_ + 32, -2039584);
    GuiScreenCustomizePresets.this.drawVerticalLine(i + 32, p_178051_2_ - 1, p_178051_2_ + 32, -6250336);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(p_178051_3_);
    int j = 32;
    int k = 32;
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos((double)(i + 0), (double)(p_178051_2_ + 32), 0.0D).tex(0.0D, 1.0D).endVertex();
    vertexbuffer.pos((double)(i + 32), (double)(p_178051_2_ + 32), 0.0D).tex(1.0D, 1.0D).endVertex();
    vertexbuffer.pos((double)(i + 32), (double)(p_178051_2_ + 0), 0.0D).tex(1.0D, 0.0D).endVertex();
    vertexbuffer.pos((double)(i + 0), (double)(p_178051_2_ + 0), 0.0D).tex(0.0D, 0.0D).endVertex();
    tessellator.draw();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:GuiScreenCustomizePresets.java

示例4: renderPathLine

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
public void renderPathLine(float p_190067_1_, Path p_190067_2_)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);

    for (int i = 0; i < p_190067_2_.getCurrentPathLength(); ++i)
    {
        PathPoint pathpoint = p_190067_2_.getPathPointFromIndex(i);

        if (this.addDistanceToPlayer(pathpoint) <= 40.0F)
        {
            float f = (float)i / (float)p_190067_2_.getCurrentPathLength() * 0.33F;
            int j = i == 0 ? 0 : MathHelper.hsvToRGB(f, 0.9F, 0.9F);
            int k = j >> 16 & 255;
            int l = j >> 8 & 255;
            int i1 = j & 255;
            vertexbuffer.pos((double)pathpoint.xCoord - this.xo + 0.5D, (double)pathpoint.yCoord - this.yo + 0.5D, (double)pathpoint.zCoord - this.zo + 0.5D).color(k, l, i1, 255).endVertex();
        }
    }

    tessellator.draw();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:DebugRendererPathfinding.java

示例5: drawSprite

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
/**
 * Draws a sprite from assets/textures/gui/container/stats_icons.png
 */
private void drawSprite(int p_146527_1_, int p_146527_2_, int p_146527_3_, int p_146527_4_)
{
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(STAT_ICONS);
    float f = 0.0078125F;
    float f1 = 0.0078125F;
    int i = 18;
    int j = 18;
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos((double)(p_146527_1_ + 0), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_146527_1_ + 0), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex();
    tessellator.draw();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:GuiStats.java

示例6: func_148224_c

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
private void func_148224_c(int p_148224_1_, int p_148224_2_, int p_148224_3_, int p_148224_4_)
{
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(Gui.statIcons);
    float f = 0.0078125F;
    float f1 = 0.0078125F;
    int i = 18;
    int j = 18;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    worldrenderer.pos((double)(p_148224_1_ + 0), (double)(p_148224_2_ + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 0) * 0.0078125F), (double)((float)(p_148224_4_ + 18) * 0.0078125F)).endVertex();
    worldrenderer.pos((double)(p_148224_1_ + 18), (double)(p_148224_2_ + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 18) * 0.0078125F), (double)((float)(p_148224_4_ + 18) * 0.0078125F)).endVertex();
    worldrenderer.pos((double)(p_148224_1_ + 18), (double)(p_148224_2_ + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 18) * 0.0078125F), (double)((float)(p_148224_4_ + 0) * 0.0078125F)).endVertex();
    worldrenderer.pos((double)(p_148224_1_ + 0), (double)(p_148224_2_ + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 0) * 0.0078125F), (double)((float)(p_148224_4_ + 0) * 0.0078125F)).endVertex();
    tessellator.draw();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:GuiCreateFlatWorld.java

示例7: func_178051_a

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
private void func_178051_a(int p_178051_1_, int p_178051_2_, ResourceLocation p_178051_3_)
{
    int i = p_178051_1_ + 5;
    GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ - 1, -2039584);
    GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ + 32, -6250336);
    GuiScreenCustomizePresets.this.drawVerticalLine(i - 1, p_178051_2_ - 1, p_178051_2_ + 32, -2039584);
    GuiScreenCustomizePresets.this.drawVerticalLine(i + 32, p_178051_2_ - 1, p_178051_2_ + 32, -6250336);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(p_178051_3_);
    int j = 32;
    int k = 32;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    worldrenderer.pos((double)(i + 0), (double)(p_178051_2_ + 32), 0.0D).tex(0.0D, 1.0D).endVertex();
    worldrenderer.pos((double)(i + 32), (double)(p_178051_2_ + 32), 0.0D).tex(1.0D, 1.0D).endVertex();
    worldrenderer.pos((double)(i + 32), (double)(p_178051_2_ + 0), 0.0D).tex(1.0D, 0.0D).endVertex();
    worldrenderer.pos((double)(i + 0), (double)(p_178051_2_ + 0), 0.0D).tex(0.0D, 0.0D).endVertex();
    tessellator.draw();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:GuiScreenCustomizePresets.java

示例8: tessellateAllExcept

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames)
{
    boolean exclude;
    for (GroupObject groupObject : groupObjects)
    {
        exclude=false;
        for (String excludedGroupName : excludedGroupNames)
        {
            if (excludedGroupName.equalsIgnoreCase(groupObject.name))
            {
                exclude=true;
            }
        }
        if(!exclude)
        {
            groupObject.render(tessellator.getBuffer());
        }
    }
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:21,代码来源:WavefrontObject.java

示例9: renderBox

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
private void renderBox(Tessellator p_190055_1_, VertexBuffer p_190055_2_, double p_190055_3_, double p_190055_5_, double p_190055_7_, double p_190055_9_, double p_190055_11_, double p_190055_13_, int p_190055_15_, int p_190055_16_, int p_190055_17_)
{
    GlStateManager.glLineWidth(2.0F);
    p_190055_2_.begin(3, DefaultVertexFormats.POSITION_COLOR);
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color((float)p_190055_16_, (float)p_190055_16_, (float)p_190055_16_, 0.0F).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_17_, p_190055_17_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color(p_190055_17_, p_190055_17_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_7_).color(p_190055_17_, p_190055_16_, p_190055_17_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color((float)p_190055_16_, (float)p_190055_16_, (float)p_190055_16_, 0.0F).endVertex();
    p_190055_1_.draw();
    GlStateManager.glLineWidth(1.0F);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:TileEntityStructureRenderer.java

示例10: drawSlot

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
@Override
protected void drawSlot(int idx, int right, int top, int height, Tessellator tess)
{
    if(idx >= 0 && idx < channels.size())
    {
        FontRenderer font = this.parent.getFontRenderer();
        TileEntityGlassMaster channel = channels.get(idx);
        GlStateManager.pushMatrix();
        GlStateManager.scale(0.5F, 0.5F, 1F);
        String info = (channel.setChannel.isEmpty() ? I18n.translateToLocal("glass.gui.notSet")  : channel.setChannel.startsWith("public") ? I18n.translateToLocal("glass.gui.public") : "") + (!channel.setChannel.isEmpty() ? " " + channel.setChannel.substring(channel.setChannel.indexOf(":") + 1) : "");
        info = info + " (" + channel.getPos().getX() + ", " + channel.getPos().getY() + ", " + channel.getPos().getZ() + ")";
        String name = font.trimStringToWidth(info, (listWidth - 10) * 2);
        font.drawString(name, (this.left + 2) * 2, top * 2, idx % 2 == 0 ? 0xFFFFFF : 0xAAAAAA);
        GlStateManager.popMatrix();
    }
}
 
开发者ID:iChun,项目名称:GeneralLaymansAestheticSpyingScreen,代码行数:17,代码来源:GuiProjectorList.java

示例11: drawSlot

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
@Override
protected void drawSlot(int idx, int right, int top, int height, Tessellator tess)
{
    if(idx >= 0 && idx < channels.size())
    {
        FontRenderer font = this.parent.getFontRenderer();
        String channel = channels.get(idx);
        GlStateManager.pushMatrix();
        GlStateManager.scale(0.5F, 0.5F, 1F);
        String name = font.trimStringToWidth(channel.substring(channel.indexOf(":") + 1), (listWidth - 10) * 2);
        if(channel.startsWith("public:"))
        {
            name = I18n.translateToLocal("glass.gui.public") + " " + name;
        }
        font.drawString(name, (this.left + 2) * 2, top * 2, idx % 2 == 0 ? 0xFFFFFF : 0xAAAAAA);
        GlStateManager.popMatrix();
    }
}
 
开发者ID:iChun,项目名称:GeneralLaymansAestheticSpyingScreen,代码行数:19,代码来源:GuiChannelList.java

示例12: drawBackground

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
/**
 * Draws the background (i is always 0 as of 1.2.2)
 */
public void drawBackground(int tint)
{
    GlStateManager.disableLighting();
    GlStateManager.disableFog();
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    this.mc.getTextureManager().bindTexture(OPTIONS_BACKGROUND);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f = 32.0F;
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    vertexbuffer.pos(0.0D, (double)this.height, 0.0D).tex(0.0D, (double)((float)this.height / 32.0F + (float)tint)).color(64, 64, 64, 255).endVertex();
    vertexbuffer.pos((double)this.width, (double)this.height, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)this.height / 32.0F + (float)tint)).color(64, 64, 64, 255).endVertex();
    vertexbuffer.pos((double)this.width, 0.0D, 0.0D).tex((double)((float)this.width / 32.0F), (double)tint).color(64, 64, 64, 255).endVertex();
    vertexbuffer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double)tint).color(64, 64, 64, 255).endVertex();
    tessellator.draw();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:GuiScreen.java

示例13: renderPumpkinOverlay

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
private void renderPumpkinOverlay(ScaledResolution p_180476_1_)
{
    GlStateManager.disableDepth();
    GlStateManager.depthMask(false);
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.disableAlpha();
    this.mc.getTextureManager().bindTexture(pumpkinBlurTexPath);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
    worldrenderer.pos(0.0D, (double)p_180476_1_.getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
    worldrenderer.pos((double)p_180476_1_.getScaledWidth(), (double)p_180476_1_.getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex();
    worldrenderer.pos((double)p_180476_1_.getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex();
    worldrenderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.depthMask(true);
    GlStateManager.enableDepth();
    GlStateManager.enableAlpha();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:GuiIngame.java

示例14: drawTexturedModalRectZ

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
public void drawTexturedModalRectZ(final float i, final float y, final int k, final int i1, final int j1, final int k1, final float zLevel) {
		float f = 0.015625F;
		float f1 = 0.03125F;
		Tessellator tesselator = Tessellator.getInstance();
		VertexBuffer vertexbuffer = tesselator.getBuffer();
		vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
/*
		tesselator.getWorldRenderer().addVertexWithUV(i + 0, y + k1, zLevel, (k + 0) * f, (i1 + k1) * f1);
		tesselator.getWorldRenderer().addVertexWithUV(i + j1, y + k1, zLevel, (k + j1) * f, (i1 + k1) * f1);
		tesselator.getWorldRenderer().addVertexWithUV(i + j1, y + 0, zLevel, (k + j1) * f, (i1 + 0) * f1);
		tesselator.getWorldRenderer().addVertexWithUV(i + 0, y + 0, zLevel, (k + 0) * f, (i1 + 0) * f1);
		*/
		
		vertexbuffer.pos(i + 0, y + k1, zLevel);
		vertexbuffer.pos(i + j1, y + k1, zLevel);
		vertexbuffer.pos(i + j1, y + 0, zLevel);
		vertexbuffer.pos(i + 0, y + 0, zLevel);

		tesselator.draw();
    }
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:SlotAlt.java

示例15: drawTextureWithMasking

import net.minecraft.client.renderer.Tessellator; //导入依赖的package包/类
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();
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:18,代码来源:FluidStackRenderer.java


注:本文中的net.minecraft.client.renderer.Tessellator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。