Java 类net.minecraft.client.renderer.RegionRenderCache 实例源码

项目:BaseClient    文件:RenderChunk.java   
protected RegionRenderCache createRegionRenderCache(World p_createRegionRenderCache_1_, BlockPos p_createRegionRenderCache_2_, BlockPos p_createRegionRenderCache_3_, int p_createRegionRenderCache_4_)
{
    return new RegionRenderCache(p_createRegionRenderCache_1_, p_createRegionRenderCache_2_, p_createRegionRenderCache_3_, p_createRegionRenderCache_4_);
}
项目:Blocksteps    文件:ListedRenderChunkBlocksteps.java   
@Override
public void rebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator)
{
    CompiledChunk compiledchunk = new CompiledChunk();
    BlockPos blockpos = this.position;
    BlockPos blockpos1 = blockpos.add(15, 15, 15);
    generator.getLock().lock();
    RegionRenderCache regionrendercache;

    try
    {
        if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING)
        {
            return;
        }

        regionrendercache = new RegionRenderCacheBlocksteps(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
        generator.setCompiledChunk(compiledchunk);
    }
    finally
    {
        generator.getLock().unlock();
    }

    VisGraph visgraph = new VisGraph();

    Minecraft mc = Minecraft.getMinecraft();

    if (!regionrendercache.extendedLevelsInChunkCache())
    {
        ++renderChunksUpdated;
        Iterator iterator = BlockPos.getAllInBoxMutable(blockpos, blockpos1).iterator();

        while (iterator.hasNext())
        {
            BlockPos.MutableBlockPos mutableblockpos = (BlockPos.MutableBlockPos)iterator.next();
            IBlockState iblockstate = regionrendercache.getBlockState(mutableblockpos);
            Block block = iblockstate.getBlock();

            if(Blocksteps.config.mapType == 2)
            {
                synchronized(Blocksteps.eventHandler.threadCrawlBlocks.surface)
                {
                    renderBlock(mutableblockpos, iblockstate, block, visgraph, regionrendercache, generator, compiledchunk, blockpos, mc);
                }
            }
            else
            {
                renderBlock(mutableblockpos, iblockstate, block, visgraph, regionrendercache, generator, compiledchunk, blockpos, mc);
            }
        }

        BlockRenderLayer[] aenumworldblocklayer = BlockRenderLayer.values();
        int j = aenumworldblocklayer.length;

        for (int k = 0; k < j; ++k)
        {
            BlockRenderLayer enumworldblocklayer = aenumworldblocklayer[k];

            if (compiledchunk.isLayerStarted(enumworldblocklayer))
            {
                this.postRenderBlocks(enumworldblocklayer, x, y, z, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer), compiledchunk);
            }
        }
    }

    compiledchunk.setVisibility(visgraph.computeVisibility());
}
项目:Blocksteps    文件:ListedRenderChunkBlocksteps.java   
public void renderBlock(BlockPos.MutableBlockPos mutableblockpos, IBlockState iblockstate, Block block, VisGraph visgraph, RegionRenderCache regionrendercache, ChunkCompileTaskGenerator generator, CompiledChunk compiledchunk, BlockPos blockpos, Minecraft mc)
{
    boolean hasBlock = ChunkStore.contains(mutableblockpos) || Blocksteps.config.mapType == 3 || Blocksteps.config.mapType == 4;

    if (block.isOpaqueCube())
    {
        visgraph.func_178606_a(mutableblockpos);
    }

    if (hasBlock && block.hasTileEntity(iblockstate))
    {
        TileEntity tileentity = regionrendercache.getTileEntity(new BlockPos(mutableblockpos));

        if (tileentity != null && TileEntityRendererDispatcher.instance.hasSpecialRenderer(tileentity))
        {
            compiledchunk.addTileEntity(tileentity);
        }
    }

    for(BlockRenderLayer enumworldblocklayer1 : BlockRenderLayer.values()) {
        if(!block.canRenderInLayer(enumworldblocklayer1)) continue;
        net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1);
        int i = enumworldblocklayer1.ordinal();

        if (block.getDefaultState().getRenderType() != EnumBlockRenderType.INVISIBLE)
        {
            WorldRenderer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayerId(i);

            if (!compiledchunk.isLayerStarted(enumworldblocklayer1))
            {
                compiledchunk.setLayerStarted(enumworldblocklayer1);
                this.preRenderBlocks(worldrenderer, blockpos);
            }

            if (hasBlock && mc.getBlockRendererDispatcher().renderBlock(iblockstate, mutableblockpos, regionrendercache, worldrenderer))
            {
                compiledchunk.setLayerUsed(enumworldblocklayer1);
            }
        }
    }
}