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

项目:CustomWorldGen    文件:ViewFrustum.java   
protected void createRenderChunks(IRenderChunkFactory renderChunkFactory)
{
    int i = this.countChunksX * this.countChunksY * this.countChunksZ;
    this.renderChunks = new RenderChunk[i];
    int j = 0;

    for (int k = 0; k < this.countChunksX; ++k)
    {
        for (int l = 0; l < this.countChunksY; ++l)
        {
            for (int i1 = 0; i1 < this.countChunksZ; ++i1)
            {
                int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k;
                this.renderChunks[j1] = renderChunkFactory.create(this.world, this.renderGlobal, j++);
                this.renderChunks[j1].setPosition(k * 16, l * 16, i1 * 16);
            }
        }
    }
}
项目:ForgeHax    文件:Markers.java   
@Override
public void onBlockRenderInLoop(final RenderChunk renderChunk, final Block block, final IBlockState state, final BlockPos pos) {
    if(renderers != null) try {
        renderers.computeIfPresent(renderChunk, (chk, info) -> info.compute(() -> {
            GeometryTessellator tess = info.getTessellator();
            if (tess != null && FastReflection.Fields.BufferBuilder_isDrawing.get(tess.getBuffer(), false)) {
                BlockEntry blockEntry = options.get(state);
                if(blockEntry != null
                        && blockEntry.getReadableProperty(BoundProperty.class).isWithinBoundaries(pos.getY())) {
                    AxisAlignedBB bb = state.getSelectedBoundingBox(Helper.getWorld(), pos);
                    GeometryTessellator.drawLines(
                            tess.getBuffer(),
                            bb.minX, bb.minY, bb.minZ,
                            bb.maxX, bb.maxY, bb.maxZ,
                            GeometryMasks.Line.ALL,
                            blockEntry.getReadableProperty(ColorProperty.class).getAsBuffer()
                    );
                    info.incrementRenderCount();
                }
            }
        }));
    } catch (Exception e) {
        handleException(renderChunk, e);
    }
}
项目:CustomWorldGen    文件:RenderList.java   
public void renderChunkLayer(BlockRenderLayer layer)
{
    if (this.initialized)
    {
        for (RenderChunk renderchunk : this.renderChunks)
        {
            ListedRenderChunk listedrenderchunk = (ListedRenderChunk)renderchunk;
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            GlStateManager.callList(listedrenderchunk.getDisplayList(layer, listedrenderchunk.getCompiledChunk()));
            GlStateManager.popMatrix();
        }

        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:DecompiledMinecraft    文件:ViewFrustum.java   
protected void createRenderChunks(IRenderChunkFactory renderChunkFactory)
{
    int i = this.countChunksX * this.countChunksY * this.countChunksZ;
    this.renderChunks = new RenderChunk[i];
    int j = 0;

    for (int k = 0; k < this.countChunksX; ++k)
    {
        for (int l = 0; l < this.countChunksY; ++l)
        {
            for (int i1 = 0; i1 < this.countChunksZ; ++i1)
            {
                int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k;
                BlockPos blockpos = new BlockPos(k * 16, l * 16, i1 * 16);
                this.renderChunks[j1] = renderChunkFactory.makeRenderChunk(this.world, this.renderGlobal, blockpos, j++);
            }
        }
    }
}
项目:DecompiledMinecraft    文件:VboRenderList.java   
public void renderChunkLayer(EnumWorldBlockLayer layer)
{
    if (this.initialized)
    {
        for (RenderChunk renderchunk : this.renderChunks)
        {
            VertexBuffer vertexbuffer = renderchunk.getVertexBufferByLayer(layer.ordinal());
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            renderchunk.multModelviewMatrix();
            vertexbuffer.bindBuffer();
            this.setupArrayPointers();
            vertexbuffer.drawArrays(7);
            GlStateManager.popMatrix();
        }

        OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0);
        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:BaseClient    文件:DynamicLight.java   
private void updateChunkLight(RenderChunk p_updateChunkLight_1_, Set<BlockPos> p_updateChunkLight_2_, Set<BlockPos> p_updateChunkLight_3_)
{
    if (p_updateChunkLight_1_ != null)
    {
        CompiledChunk compiledchunk = p_updateChunkLight_1_.getCompiledChunk();

        if (compiledchunk != null && !compiledchunk.isEmpty())
        {
            p_updateChunkLight_1_.setNeedsUpdate(true);
        }

        BlockPos blockpos = p_updateChunkLight_1_.getPosition();

        if (p_updateChunkLight_2_ != null)
        {
            p_updateChunkLight_2_.remove(blockpos);
        }

        if (p_updateChunkLight_3_ != null)
        {
            p_updateChunkLight_3_.add(blockpos);
        }
    }
}
项目:BaseClient    文件:ViewFrustum.java   
protected void createRenderChunks(IRenderChunkFactory renderChunkFactory)
{
    int i = this.countChunksX * this.countChunksY * this.countChunksZ;
    this.renderChunks = new RenderChunk[i];
    int j = 0;

    for (int k = 0; k < this.countChunksX; ++k)
    {
        for (int l = 0; l < this.countChunksY; ++l)
        {
            for (int i1 = 0; i1 < this.countChunksZ; ++i1)
            {
                int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k;
                BlockPos blockpos = new BlockPos(k * 16, l * 16, i1 * 16);
                this.renderChunks[j1] = renderChunkFactory.makeRenderChunk(this.world, this.renderGlobal, blockpos, j++);
            }
        }
    }
}
项目:BaseClient    文件:VboRenderList.java   
public void renderChunkLayer(EnumWorldBlockLayer layer)
{
    if (this.initialized)
    {
        for (RenderChunk renderchunk : this.renderChunks)
        {
            VertexBuffer vertexbuffer = renderchunk.getVertexBufferByLayer(layer.ordinal());
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            renderchunk.multModelviewMatrix();
            vertexbuffer.bindBuffer();
            this.setupArrayPointers();
            vertexbuffer.drawArrays(7);
            GlStateManager.popMatrix();
        }

        OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0);
        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:CustomWorldGen    文件:VboRenderList.java   
public void renderChunkLayer(BlockRenderLayer layer)
{
    if (this.initialized)
    {
        for (RenderChunk renderchunk : this.renderChunks)
        {
            net.minecraft.client.renderer.vertex.VertexBuffer vertexbuffer = renderchunk.getVertexBufferByLayer(layer.ordinal());
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            renderchunk.multModelviewMatrix();
            vertexbuffer.bindBuffer();
            this.setupArrayPointers();
            vertexbuffer.drawArrays(7);
            GlStateManager.popMatrix();
        }

        OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0);
        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:BaseClient    文件:VboRenderList.java   
public void renderChunkLayer(EnumWorldBlockLayer layer)
{
    if (this.initialized)
    {
        for (RenderChunk renderchunk : this.renderChunks)
        {
            VertexBuffer vertexbuffer = renderchunk.getVertexBufferByLayer(layer.ordinal());
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            renderchunk.multModelviewMatrix();
            vertexbuffer.bindBuffer();
            this.setupArrayPointers();
            vertexbuffer.drawArrays(7);
            GlStateManager.popMatrix();
        }

        OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0);
        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:Backmemed    文件:ViewFrustum.java   
protected void createRenderChunks(IRenderChunkFactory renderChunkFactory)
{
    int i = this.countChunksX * this.countChunksY * this.countChunksZ;
    this.renderChunks = new RenderChunk[i];
    int j = 0;

    for (int k = 0; k < this.countChunksX; ++k)
    {
        for (int l = 0; l < this.countChunksY; ++l)
        {
            for (int i1 = 0; i1 < this.countChunksZ; ++i1)
            {
                int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k;
                this.renderChunks[j1] = renderChunkFactory.create(this.world, this.renderGlobal, j++);
                this.renderChunks[j1].setPosition(k * 16, l * 16, i1 * 16);
            }
        }
    }
}
项目:Backmemed    文件:ViewFrustum.java   
public void updateChunkPositions(double viewEntityX, double viewEntityZ)
{
    int i = MathHelper.floor(viewEntityX) - 8;
    int j = MathHelper.floor(viewEntityZ) - 8;
    int k = this.countChunksX * 16;

    for (int l = 0; l < this.countChunksX; ++l)
    {
        int i1 = this.getBaseCoordinate(i, k, l);

        for (int j1 = 0; j1 < this.countChunksZ; ++j1)
        {
            int k1 = this.getBaseCoordinate(j, k, j1);

            for (int l1 = 0; l1 < this.countChunksY; ++l1)
            {
                int i2 = l1 * 16;
                RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
                renderchunk.setPosition(i1, i2, k1);
            }
        }
    }
}
项目:Backmemed    文件:RenderGlobal.java   
private RenderGlobal.ContainerLocalRenderInformation allocateRenderInformation(RenderChunk p_allocateRenderInformation_1_, EnumFacing p_allocateRenderInformation_2_, int p_allocateRenderInformation_3_)
{
    RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation;

    if (renderInfoCache.isEmpty())
    {
        renderglobal$containerlocalrenderinformation = new RenderGlobal.ContainerLocalRenderInformation(p_allocateRenderInformation_1_, p_allocateRenderInformation_2_, p_allocateRenderInformation_3_);
    }
    else
    {
        renderglobal$containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation)renderInfoCache.pollLast();
        renderglobal$containerlocalrenderinformation.initialize(p_allocateRenderInformation_1_, p_allocateRenderInformation_2_, p_allocateRenderInformation_3_);
    }

    renderglobal$containerlocalrenderinformation.cacheable = true;
    return renderglobal$containerlocalrenderinformation;
}
项目:Backmemed    文件:VboRenderList.java   
public void renderChunkLayer(BlockRenderLayer layer)
{
    if (this.initialized)
    {
        for (RenderChunk renderchunk : this.renderChunks)
        {
            net.minecraft.client.renderer.vertex.VertexBuffer vertexbuffer = renderchunk.getVertexBufferByLayer(layer.ordinal());
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            renderchunk.multModelviewMatrix();
            vertexbuffer.bindBuffer();
            this.setupArrayPointers();
            vertexbuffer.drawArrays(7);
            GlStateManager.popMatrix();
        }

        OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0);
        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:CustomWorldGen    文件:ViewFrustum.java   
public void updateChunkPositions(double viewEntityX, double viewEntityZ)
{
    int i = MathHelper.floor_double(viewEntityX) - 8;
    int j = MathHelper.floor_double(viewEntityZ) - 8;
    int k = this.countChunksX * 16;

    for (int l = 0; l < this.countChunksX; ++l)
    {
        int i1 = this.getBaseCoordinate(i, k, l);

        for (int j1 = 0; j1 < this.countChunksZ; ++j1)
        {
            int k1 = this.getBaseCoordinate(j, k, j1);

            for (int l1 = 0; l1 < this.countChunksY; ++l1)
            {
                int i2 = l1 * 16;
                RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
                renderchunk.setPosition(i1, i2, k1);
            }
        }
    }
}
项目:Backmemed    文件:DynamicLight.java   
private void updateChunkLight(RenderChunk p_updateChunkLight_1_, Set<BlockPos> p_updateChunkLight_2_, Set<BlockPos> p_updateChunkLight_3_)
{
    if (p_updateChunkLight_1_ != null)
    {
        CompiledChunk compiledchunk = p_updateChunkLight_1_.getCompiledChunk();

        if (compiledchunk != null && !compiledchunk.isEmpty())
        {
            p_updateChunkLight_1_.setNeedsUpdate(false);
        }

        BlockPos blockpos = p_updateChunkLight_1_.getPosition().toImmutable();

        if (p_updateChunkLight_2_ != null)
        {
            p_updateChunkLight_2_.remove(blockpos);
        }

        if (p_updateChunkLight_3_ != null)
        {
            p_updateChunkLight_3_.add(blockpos);
        }
    }
}
项目:CustomWorldGen    文件:RenderGlobal.java   
public void updateChunks(long finishTimeNano)
{
    this.displayListEntitiesDirty |= this.renderDispatcher.runChunkUploads(finishTimeNano);

    if (!this.chunksToUpdate.isEmpty())
    {
        Iterator<RenderChunk> iterator = this.chunksToUpdate.iterator();

        while (iterator.hasNext())
        {
            RenderChunk renderchunk = (RenderChunk)iterator.next();
            boolean flag;

            if (renderchunk.isNeedsUpdateCustom())
            {
                flag = this.renderDispatcher.updateChunkNow(renderchunk);
            }
            else
            {
                flag = this.renderDispatcher.updateChunkLater(renderchunk);
            }

            if (!flag)
            {
                break;
            }

            renderchunk.clearNeedsUpdate();
            iterator.remove();
            long i = finishTimeNano - System.nanoTime();

            if (i < 0L)
            {
                break;
            }
        }
    }
}
项目:ForgeHax    文件:Markers.java   
@SubscribeEvent
public void onLoadRenderers(LoadRenderersEvent event) {
    try {
        setRenderers(new Renderers());
        setCache(new TesselatorCache(VERTEX_BUFFER_COUNT, VERTEX_BUFFER_SIZE));
        // allocate all space needed
        for (RenderChunk renderChunk : event.getViewFrustum().renderChunks) {
            renderers.register(renderChunk);
        }
    } catch (Exception e) {
        handleException(null, e);
    }
}
项目:DecompiledMinecraft    文件:ViewFrustum.java   
public void deleteGlResources()
{
    for (RenderChunk renderchunk : this.renderChunks)
    {
        renderchunk.deleteGlResources();
    }
}
项目:DecompiledMinecraft    文件:ViewFrustum.java   
public void updateChunkPositions(double viewEntityX, double viewEntityZ)
{
    int i = MathHelper.floor_double(viewEntityX) - 8;
    int j = MathHelper.floor_double(viewEntityZ) - 8;
    int k = this.countChunksX * 16;

    for (int l = 0; l < this.countChunksX; ++l)
    {
        int i1 = this.func_178157_a(i, k, l);

        for (int j1 = 0; j1 < this.countChunksZ; ++j1)
        {
            int k1 = this.func_178157_a(j, k, j1);

            for (int l1 = 0; l1 < this.countChunksY; ++l1)
            {
                int i2 = l1 * 16;
                RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
                BlockPos blockpos = new BlockPos(i1, i2, k1);

                if (!blockpos.equals(renderchunk.getPosition()))
                {
                    renderchunk.setPosition(blockpos);
                }
            }
        }
    }
}
项目:DecompiledMinecraft    文件:ViewFrustum.java   
protected RenderChunk getRenderChunk(BlockPos pos)
{
    int i = MathHelper.bucketInt(pos.getX(), 16);
    int j = MathHelper.bucketInt(pos.getY(), 16);
    int k = MathHelper.bucketInt(pos.getZ(), 16);

    if (j >= 0 && j < this.countChunksY)
    {
        i = i % this.countChunksX;

        if (i < 0)
        {
            i += this.countChunksX;
        }

        k = k % this.countChunksZ;

        if (k < 0)
        {
            k += this.countChunksZ;
        }

        int l = (k * this.countChunksY + j) * this.countChunksX + i;
        return this.renderChunks[l];
    }
    else
    {
        return null;
    }
}
项目:DecompiledMinecraft    文件:RenderGlobal.java   
public void updateChunks(long finishTimeNano)
{
    this.displayListEntitiesDirty |= this.renderDispatcher.runChunkUploads(finishTimeNano);

    if (!this.chunksToUpdate.isEmpty())
    {
        Iterator<RenderChunk> iterator = this.chunksToUpdate.iterator();

        while (iterator.hasNext())
        {
            RenderChunk renderchunk = (RenderChunk)iterator.next();

            if (!this.renderDispatcher.updateChunkLater(renderchunk))
            {
                break;
            }

            renderchunk.setNeedsUpdate(false);
            iterator.remove();
            long i = finishTimeNano - System.nanoTime();

            if (i < 0L)
            {
                break;
            }
        }
    }
}
项目:CustomWorldGen    文件:ViewFrustum.java   
public void deleteGlResources()
{
    for (RenderChunk renderchunk : this.renderChunks)
    {
        renderchunk.deleteGlResources();
    }
}
项目:BaseClient    文件:DynamicLight.java   
public void updateLitChunks(RenderGlobal p_updateLitChunks_1_)
{
    for (BlockPos blockpos : this.setLitChunkPos)
    {
        RenderChunk renderchunk = p_updateLitChunks_1_.getRenderChunk(blockpos);
        this.updateChunkLight(renderchunk, (Set<BlockPos>)null, (Set<BlockPos>)null);
    }
}
项目:BaseClient    文件:RenderList.java   
public void renderChunkLayer(EnumWorldBlockLayer layer)
{
    if (this.initialized)
    {
        if (this.renderChunks.size() == 0)
        {
            return;
        }

        for (RenderChunk renderchunk : this.renderChunks)
        {
            ListedRenderChunk listedrenderchunk = (ListedRenderChunk)renderchunk;
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            GL11.glCallList(listedrenderchunk.getDisplayList(layer, listedrenderchunk.getCompiledChunk()));
            GlStateManager.popMatrix();
        }

        if (Config.isMultiTexture())
        {
            GlStateManager.bindCurrentTexture();
        }

        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:BaseClient    文件:ViewFrustum.java   
public void deleteGlResources()
{
    for (RenderChunk renderchunk : this.renderChunks)
    {
        renderchunk.deleteGlResources();
    }
}
项目:BaseClient    文件:ViewFrustum.java   
public void updateChunkPositions(double viewEntityX, double viewEntityZ)
{
    int i = MathHelper.floor_double(viewEntityX) - 8;
    int j = MathHelper.floor_double(viewEntityZ) - 8;
    int k = this.countChunksX * 16;

    for (int l = 0; l < this.countChunksX; ++l)
    {
        int i1 = this.func_178157_a(i, k, l);

        for (int j1 = 0; j1 < this.countChunksZ; ++j1)
        {
            int k1 = this.func_178157_a(j, k, j1);

            for (int l1 = 0; l1 < this.countChunksY; ++l1)
            {
                int i2 = l1 * 16;
                RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
                BlockPos blockpos = renderchunk.getPosition();

                if (blockpos.getX() != i1 || blockpos.getY() != i2 || blockpos.getZ() != k1)
                {
                    BlockPos blockpos1 = new BlockPos(i1, i2, k1);

                    if (!blockpos1.equals(renderchunk.getPosition()))
                    {
                        renderchunk.setPosition(blockpos1);
                    }
                }
            }
        }
    }
}
项目:BaseClient    文件:ViewFrustum.java   
protected RenderChunk getRenderChunk(BlockPos pos)
{
    int i = MathHelper.bucketInt(pos.getX(), 16);
    int j = MathHelper.bucketInt(pos.getY(), 16);
    int k = MathHelper.bucketInt(pos.getZ(), 16);

    if (j >= 0 && j < this.countChunksY)
    {
        i = i % this.countChunksX;

        if (i < 0)
        {
            i += this.countChunksX;
        }

        k = k % this.countChunksZ;

        if (k < 0)
        {
            k += this.countChunksZ;
        }

        int l = (k * this.countChunksY + j) * this.countChunksX + i;
        return this.renderChunks[l];
    }
    else
    {
        return null;
    }
}
项目:BaseClient    文件:RenderGlobal.java   
private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_)
{
    BlockPos blockpos = p_181562_2_.getPositionOffset16(p_181562_3_);

    if (blockpos.getY() >= 0 && blockpos.getY() < 256)
    {
        int i = MathHelper.abs_int(p_181562_1_.getX() - blockpos.getX());
        int j = MathHelper.abs_int(p_181562_1_.getZ() - blockpos.getZ());

        if (Config.isFogOff())
        {
            if (i > this.renderDistance || j > this.renderDistance)
            {
                return null;
            }
        }
        else
        {
            int k = i * i + j * j;

            if (k > this.renderDistanceSq)
            {
                return null;
            }
        }

        return this.viewFrustum.getRenderChunk(blockpos);
    }
    else
    {
        return null;
    }
}
项目:BaseClient    文件:RenderGlobal.java   
public RenderChunk getRenderChunk(RenderChunk p_getRenderChunk_1_, EnumFacing p_getRenderChunk_2_)
{
    if (p_getRenderChunk_1_ == null)
    {
        return null;
    }
    else
    {
        BlockPos blockpos = p_getRenderChunk_1_.func_181701_a(p_getRenderChunk_2_);
        return this.viewFrustum.getRenderChunk(blockpos);
    }
}
项目:CustomWorldGen    文件:RenderGlobal.java   
/**
 * Returns RenderChunk offset from given RenderChunk in given direction, or null if it can't be seen by player at
 * given BlockPos.
 */
@Nullable
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, EnumFacing facing)
{
    BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
    return MathHelper.abs_int(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= 0 && blockpos.getY() < 256 ? (MathHelper.abs_int(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
}
项目:BaseClient    文件:RenderList.java   
public void renderChunkLayer(EnumWorldBlockLayer layer)
{
    if (this.initialized)
    {
        if (this.renderChunks.size() == 0)
        {
            return;
        }

        for (RenderChunk renderchunk : this.renderChunks)
        {
            ListedRenderChunk listedrenderchunk = (ListedRenderChunk)renderchunk;
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            GL11.glCallList(listedrenderchunk.getDisplayList(layer, listedrenderchunk.getCompiledChunk()));
            GlStateManager.popMatrix();
        }

        if (Config.isMultiTexture())
        {
            GlStateManager.bindCurrentTexture();
        }

        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:BaseClient    文件:ViewFrustum.java   
public void deleteGlResources()
{
    for (RenderChunk renderchunk : this.renderChunks)
    {
        renderchunk.deleteGlResources();
    }
}
项目:BaseClient    文件:ViewFrustum.java   
public void updateChunkPositions(double viewEntityX, double viewEntityZ)
{
    int i = MathHelper.floor_double(viewEntityX) - 8;
    int j = MathHelper.floor_double(viewEntityZ) - 8;
    int k = this.countChunksX * 16;

    for (int l = 0; l < this.countChunksX; ++l)
    {
        int i1 = this.func_178157_a(i, k, l);

        for (int j1 = 0; j1 < this.countChunksZ; ++j1)
        {
            int k1 = this.func_178157_a(j, k, j1);

            for (int l1 = 0; l1 < this.countChunksY; ++l1)
            {
                int i2 = l1 * 16;
                RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
                BlockPos blockpos = new BlockPos(i1, i2, k1);

                if (!blockpos.equals(renderchunk.getPosition()))
                {
                    renderchunk.setPosition(blockpos);
                }
            }
        }
    }
}
项目:BaseClient    文件:RenderGlobal.java   
private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_)
{
    BlockPos blockpos = p_181562_2_.getPositionOffset16(p_181562_3_);

    if (blockpos.getY() >= 0 && blockpos.getY() < 256)
    {
        int i = MathHelper.abs_int(p_181562_1_.getX() - blockpos.getX());
        int j = MathHelper.abs_int(p_181562_1_.getZ() - blockpos.getZ());

        if (Config.isFogOff())
        {
            if (i > this.renderDistance || j > this.renderDistance)
            {
                return null;
            }
        }
        else
        {
            int k = i * i + j * j;

            if (k > this.renderDistanceSq)
            {
                return null;
            }
        }

        return this.viewFrustum.getRenderChunk(blockpos);
    }
    else
    {
        return null;
    }
}
项目:BaseClient    文件:RenderGlobal.java   
private ContainerLocalRenderInformation(RenderChunk renderChunkIn, EnumFacing facingIn, int counterIn)
{
    this.setFacing = EnumSet.noneOf(EnumFacing.class);
    this.renderChunk = renderChunkIn;
    this.facing = facingIn;
    this.counter = counterIn;
}
项目:Backmemed    文件:RenderList.java   
public void renderChunkLayer(BlockRenderLayer layer)
{
    if (this.initialized)
    {
        if (this.renderChunks.size() == 0)
        {
            return;
        }

        for (RenderChunk renderchunk : this.renderChunks)
        {
            ListedRenderChunk listedrenderchunk = (ListedRenderChunk)renderchunk;
            GlStateManager.pushMatrix();
            this.preRenderChunk(renderchunk);
            GlStateManager.callList(listedrenderchunk.getDisplayList(layer, listedrenderchunk.getCompiledChunk()));
            GlStateManager.popMatrix();
        }

        if (Config.isMultiTexture())
        {
            GlStateManager.bindCurrentTexture();
        }

        GlStateManager.resetColor();
        this.renderChunks.clear();
    }
}
项目:Backmemed    文件:ViewFrustum.java   
public void deleteGlResources()
{
    for (RenderChunk renderchunk : this.renderChunks)
    {
        renderchunk.deleteGlResources();
    }
}
项目:Backmemed    文件:ViewFrustum.java   
@Nullable
public RenderChunk getRenderChunk(BlockPos pos)
{
    int i = pos.getX() >> 4;
    int j = pos.getY() >> 4;
    int k = pos.getZ() >> 4;

    if (j >= 0 && j < this.countChunksY)
    {
        i = i % this.countChunksX;

        if (i < 0)
        {
            i += this.countChunksX;
        }

        k = k % this.countChunksZ;

        if (k < 0)
        {
            k += this.countChunksZ;
        }

        int l = (k * this.countChunksY + j) * this.countChunksX + i;
        return this.renderChunks[l];
    }
    else
    {
        return null;
    }
}
项目:Backmemed    文件:RenderGlobal.java   
@Nullable

    /**
     * Returns RenderChunk offset from given RenderChunk in given direction, or null if it can't be seen by player at
     * given BlockPos.
     */
    private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, EnumFacing facing)
    {
        BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);

        if (blockpos.getY() >= 0 && blockpos.getY() < 256)
        {
            int i = playerPos.getX() - blockpos.getX();
            int j = playerPos.getZ() - blockpos.getZ();

            if (Config.isFogOff())
            {
                if (Math.abs(i) > this.renderDistance || Math.abs(j) > this.renderDistance)
                {
                    return null;
                }
            }
            else
            {
                int k = i * i + j * j;

                if (k > this.renderDistanceSq)
                {
                    return null;
                }
            }

            return renderChunkBase.getRenderChunkOffset16(this.viewFrustum, facing);
        }
        else
        {
            return null;
        }
    }