Java 类net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator 实例源码

项目:iChunUtil    文件:ListedRenderChunkWorldPortal.java   
@Override
protected void finishCompileTask()
{
    if(!FMLClientHandler.instance().hasOptifine()) { super.finishCompileTask(); return; }

    this.lockCompileTask.lock();

    try
    {
        if (this.optiCompileTask != null && this.optiCompileTask.getStatus() != ChunkCompileTaskGenerator.Status.DONE)
        {
            this.optiCompileTask.finish();
            this.optiCompileTask = null;
        }
    }
    finally
    {
        this.lockCompileTask.unlock();
    }
}
项目:iChunUtil    文件:ListedRenderChunkWorldPortal.java   
@Override
public ChunkCompileTaskGenerator makeCompileTaskChunk()
{
    if(!FMLClientHandler.instance().hasOptifine()) { return super.makeCompileTaskChunk(); }

    this.lockCompileTask.lock();
    ChunkCompileTaskGenerator chunkcompiletaskgenerator;

    try
    {
        this.finishCompileTask();
        this.optiCompileTask = new ChunkCompileTaskGenerator(this, ChunkCompileTaskGenerator.Type.REBUILD_CHUNK, this.getDistanceSq());
        this.rebuildWorldView();
        chunkcompiletaskgenerator = this.optiCompileTask;
    }
    finally
    {
        this.lockCompileTask.unlock();
    }

    return chunkcompiletaskgenerator;
}
项目:iChunUtil    文件:RenderChunkWorldPortal.java   
@Override
protected void finishCompileTask()
{
    if(!FMLClientHandler.instance().hasOptifine()) { super.finishCompileTask(); return; }

    this.lockCompileTask.lock();

    try
    {
        if (this.optiCompileTask != null && this.optiCompileTask.getStatus() != ChunkCompileTaskGenerator.Status.DONE)
        {
            this.optiCompileTask.finish();
            this.optiCompileTask = null;
        }
    }
    finally
    {
        this.lockCompileTask.unlock();
    }
}
项目:iChunUtil    文件:RenderChunkWorldPortal.java   
@Override
public ChunkCompileTaskGenerator makeCompileTaskChunk()
{
    if(!FMLClientHandler.instance().hasOptifine()) { return super.makeCompileTaskChunk(); }

    this.lockCompileTask.lock();
    ChunkCompileTaskGenerator chunkcompiletaskgenerator;

    try
    {
        this.finishCompileTask();
        this.optiCompileTask = new ChunkCompileTaskGenerator(this, ChunkCompileTaskGenerator.Type.REBUILD_CHUNK, this.getDistanceSq());
        this.rebuildWorldView();
        chunkcompiletaskgenerator = this.optiCompileTask;
    }
    finally
    {
        this.lockCompileTask.unlock();
    }

    return chunkcompiletaskgenerator;
}
项目:BlockSystems    文件:BlockSystemHooks.java   
public static BlockPos chunkWorkerGetPosition(ChunkCompileTaskGenerator generator, BlockPos pos) {
    World world = generator.getRenderChunk().getWorld();
    if (world instanceof BlockSystem) {
        BlockSystem blockSystem = (BlockSystem) world;
        return blockSystem.getUntransformedPosition(pos);
    }
    return pos;
}
项目:BlockSystems    文件:ChunkRenderWorkerTransformer.java   
@Override
public boolean transform(ClassNode classNode, String transformedName) {
    boolean transformed = false;
    MethodNode processTask = this.getMethod(classNode, "processTask", ChunkCompileTaskGenerator.class, void.class);
    if (processTask != null) {
        Instruction instruction = this.instruction()
                .var(ALOAD, 1)
                .var(ALOAD, 2)
                .method(INVOKESTATIC, BlockSystemHooks.class, "chunkWorkerGetPosition", ChunkCompileTaskGenerator.class, BlockPos.class, BlockPos.class)
                .var(ASTORE, 2);
        this.insertAfter(processTask, node -> node.getOpcode() == ASTORE && ((VarInsnNode) node).var == 2, instruction.build(), false);
        transformed = true;
    }
    return transformed;
}
项目:iChunUtil    文件:ListedRenderChunkWorldPortal.java   
@Nullable
@Override
public ChunkCompileTaskGenerator makeCompileTaskTransparency()
{
    if(!FMLClientHandler.instance().hasOptifine()) { return super.makeCompileTaskTransparency(); }

    this.lockCompileTask.lock();
    ChunkCompileTaskGenerator chunkcompiletaskgenerator;

    try
    {
        if (this.optiCompileTask == null || this.optiCompileTask.getStatus() != ChunkCompileTaskGenerator.Status.PENDING)
        {
            if (this.optiCompileTask != null && this.optiCompileTask.getStatus() != ChunkCompileTaskGenerator.Status.DONE)
            {
                this.optiCompileTask.finish();
                this.optiCompileTask = null;
            }

            this.optiCompileTask = new ChunkCompileTaskGenerator(this, ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY, this.getDistanceSq());
            this.optiCompileTask.setCompiledChunk(this.compiledChunk);
            chunkcompiletaskgenerator = this.optiCompileTask;
            return chunkcompiletaskgenerator;
        }

        chunkcompiletaskgenerator = null;
    }
    finally
    {
        this.lockCompileTask.unlock();
    }

    return chunkcompiletaskgenerator;
}
项目:iChunUtil    文件:RenderChunkWorldPortal.java   
@Nullable
@Override
public ChunkCompileTaskGenerator makeCompileTaskTransparency()
{
    if(!FMLClientHandler.instance().hasOptifine()) { return super.makeCompileTaskTransparency(); }

    this.lockCompileTask.lock();
    ChunkCompileTaskGenerator chunkcompiletaskgenerator;

    try
    {
        if (this.optiCompileTask == null || this.optiCompileTask.getStatus() != ChunkCompileTaskGenerator.Status.PENDING)
        {
            if (this.optiCompileTask != null && this.optiCompileTask.getStatus() != ChunkCompileTaskGenerator.Status.DONE)
            {
                this.optiCompileTask.finish();
                this.optiCompileTask = null;
            }

            this.optiCompileTask = new ChunkCompileTaskGenerator(this, ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY, this.getDistanceSq());
            this.optiCompileTask.setCompiledChunk(this.compiledChunk);
            chunkcompiletaskgenerator = this.optiCompileTask;
            return chunkcompiletaskgenerator;
        }

        chunkcompiletaskgenerator = null;
    }
    finally
    {
        this.lockCompileTask.unlock();
    }

    return chunkcompiletaskgenerator;
}
项目:ForgeHax    文件:WorldRendererDeallocatedEvent.java   
public WorldRendererDeallocatedEvent(ChunkCompileTaskGenerator generator, RenderChunk renderChunk) {
    this.generator = generator;
    this.renderChunk = renderChunk;
}
项目:ForgeHax    文件:WorldRendererDeallocatedEvent.java   
public ChunkCompileTaskGenerator getGenerator() {
    return generator;
}
项目:ForgeHax    文件:WorldRendererAllocatedEvent.java   
public WorldRendererAllocatedEvent(ChunkCompileTaskGenerator generator, RenderChunk renderChunk) {
    this.generator = generator;
    this.renderChunk = renderChunk;
}
项目:ForgeHax    文件:WorldRendererAllocatedEvent.java   
public ChunkCompileTaskGenerator getGenerator() {
    return generator;
}
项目: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);
            }
        }
    }
}