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


Java BlockDoublePlant.func_149888_a方法代码示例

本文整理汇总了Java中net.minecraft.block.BlockDoublePlant.func_149888_a方法的典型用法代码示例。如果您正苦于以下问题:Java BlockDoublePlant.func_149888_a方法的具体用法?Java BlockDoublePlant.func_149888_a怎么用?Java BlockDoublePlant.func_149888_a使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.BlockDoublePlant的用法示例。


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

示例1: renderBlockDoublePlant

import net.minecraft.block.BlockDoublePlant; //导入方法依赖的package包/类
/**
 * Renders a vanilla double tall plant.
 */
public static boolean renderBlockDoublePlant(TEBase TE, RenderBlocks renderBlocks, ItemStack itemStack, int x, int y, int z, boolean thin)
{
    BlockDoublePlant block = (BlockDoublePlant) FlowerPotProperties.toBlock(itemStack);

    Tessellator tessellator = Tessellator.instance;
    tessellator.setBrightness(block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, z));

    boolean thinPlant = itemStack.getUnlocalizedName().equals("tile.doublePlant.grass");

    int metadata = itemStack.getItemDamage();

    /* Render bottom stem. */

    IIcon icon_bottom = block.func_149888_a(false, metadata);

    if (thinPlant) {
        renderPlantThinCrossedSquares(renderBlocks, block, icon_bottom, x, y, z, false);
    } else {
        renderPlantCrossedSquares(renderBlocks, block, icon_bottom, x, y, z, 0.75F, false);
    }

    tessellator.addTranslation(0.0F, 0.75F, 0.0F);

    /* Render top stem. */

    IIcon icon_top = block.func_149888_a(true, metadata);

    if (thinPlant) {
        renderPlantThinCrossedSquares(renderBlocks, block, icon_top, x, y, z, false);
    } else {
        renderPlantCrossedSquares(renderBlocks, block, icon_top, x, y, z, 0.75F, false);
    }

    /* Render sunflower top. */

    if (metadata == 0) {

        tessellator.addTranslation(0.0F, -0.15F, 0.0F);

        IIcon icon_sunflower_top_front = block.sunflowerIcons[0];
        double angle = FlowerPot.getAngle(TE) / 16.0D * 2 * Math.PI + Math.PI / 2;

        double cos = Math.cos(angle);
        double sin = Math.sin(angle);
        double uMin = icon_sunflower_top_front.getMinU();
        double vMin = icon_sunflower_top_front.getMinV();
        double uMax = icon_sunflower_top_front.getMaxU();
        double vMax = icon_sunflower_top_front.getMaxV();
        double d11 = 0.5D + 0.25D * cos - 0.45D * sin;
        double d12 = 0.5D + 0.45D * cos + 0.25D * sin;
        double d13 = 0.5D + 0.25D * cos + 0.45D * sin;
        double d14 = 0.5D + -0.45D * cos + 0.25D * sin;
        double d15 = 0.5D + -0.05D * cos + 0.45D * sin;
        double d16 = 0.5D + -0.45D * cos + -0.05D * sin;
        double d17 = 0.5D + -0.05D * cos - 0.45D * sin;
        double d18 = 0.5D + 0.45D * cos + -0.05D * sin;
        tessellator.addVertexWithUV(x + d15, y + 1.0D, z + d16, uMin, vMax);
        tessellator.addVertexWithUV(x + d17, y + 1.0D, z + d18, uMax, vMax);
        tessellator.addVertexWithUV(x + d11, y + 0.0D, z + d12, uMax, vMin);
        tessellator.addVertexWithUV(x + d13, y + 0.0D, z + d14, uMin, vMin);
        IIcon icon_sunflower_top_back = block.sunflowerIcons[1];
        uMin = icon_sunflower_top_back.getMinU();
        vMin = icon_sunflower_top_back.getMinV();
        uMax = icon_sunflower_top_back.getMaxU();
        vMax = icon_sunflower_top_back.getMaxV();
        tessellator.addVertexWithUV(x + d17, y + 1.0D, z + d18, uMin, vMax);
        tessellator.addVertexWithUV(x + d15, y + 1.0D, z + d16, uMax, vMax);
        tessellator.addVertexWithUV(x + d13, y + 0.0D, z + d14, uMax, vMin);
        tessellator.addVertexWithUV(x + d11, y + 0.0D, z + d12, uMin, vMin);

        tessellator.addTranslation(0.0F, 0.15F, 0.0F);

    }

    tessellator.addTranslation(0.0F, -0.75F, 0.0F);

    return true;
}
 
开发者ID:Mineshopper,项目名称:carpentersblocks,代码行数:82,代码来源:RenderHelperFlowerPot.java


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