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


Java TileEntity.canRenderBreaking方法代码示例

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


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

示例1: drawBlockDamageTexture

import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public void drawBlockDamageTexture(Tessellator tessellatorIn, VertexBuffer worldRendererIn, Entity entityIn, float partialTicks)
{
    double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;

    if (!this.damagedBlocks.isEmpty())
    {
        this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        this.preRenderDamagedBlocks();
        worldRendererIn.begin(7, DefaultVertexFormats.BLOCK);
        worldRendererIn.setTranslation(-d0, -d1, -d2);
        worldRendererIn.noColor();
        Iterator<DestroyBlockProgress> iterator = this.damagedBlocks.values().iterator();

        while (iterator.hasNext())
        {
            DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next();
            BlockPos blockpos = destroyblockprogress.getPosition();
            double d3 = (double)blockpos.getX() - d0;
            double d4 = (double)blockpos.getY() - d1;
            double d5 = (double)blockpos.getZ() - d2;
            Block block = this.theWorld.getBlockState(blockpos).getBlock();
            TileEntity te = this.theWorld.getTileEntity(blockpos);
            boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;
            if (!hasBreak) hasBreak = te != null && te.canRenderBreaking();

            if (!hasBreak)
            {
                if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
                {
                    iterator.remove();
                }
                else
                {
                    IBlockState iblockstate = this.theWorld.getBlockState(blockpos);

                    if (iblockstate.getMaterial() != Material.AIR)
                    {
                        int i = destroyblockprogress.getPartialBlockDamage();
                        TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
                        BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
                        blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld);
                    }
                }
            }
        }

        tessellatorIn.draw();
        worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D);
        this.postRenderDamagedBlocks();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:54,代码来源:RenderGlobal.java


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