/**
* 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);
}
java类net.minecraft.client.renderer.chunk.RenderChunk的实例源码
RenderGlobal.java 文件源码
项目:CustomWorldGen
阅读 21
收藏 0
点赞 0
评论 0
RenderList.java 文件源码
项目:BaseClient
阅读 21
收藏 0
点赞 0
评论 0
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();
}
}
ViewFrustum.java 文件源码
项目:BaseClient
阅读 17
收藏 0
点赞 0
评论 0
public void deleteGlResources()
{
for (RenderChunk renderchunk : this.renderChunks)
{
renderchunk.deleteGlResources();
}
}
ViewFrustum.java 文件源码
项目:BaseClient
阅读 18
收藏 0
点赞 0
评论 0
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);
}
}
}
}
}
RenderGlobal.java 文件源码
项目:BaseClient
阅读 22
收藏 0
点赞 0
评论 0
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;
}
}
RenderGlobal.java 文件源码
项目:BaseClient
阅读 16
收藏 0
点赞 0
评论 0
private ContainerLocalRenderInformation(RenderChunk renderChunkIn, EnumFacing facingIn, int counterIn)
{
this.setFacing = EnumSet.noneOf(EnumFacing.class);
this.renderChunk = renderChunkIn;
this.facing = facingIn;
this.counter = counterIn;
}
RenderList.java 文件源码
项目:Backmemed
阅读 21
收藏 0
点赞 0
评论 0
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();
}
}
ViewFrustum.java 文件源码
项目:Backmemed
阅读 18
收藏 0
点赞 0
评论 0
public void deleteGlResources()
{
for (RenderChunk renderchunk : this.renderChunks)
{
renderchunk.deleteGlResources();
}
}
ViewFrustum.java 文件源码
项目:Backmemed
阅读 19
收藏 0
点赞 0
评论 0
@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;
}
}
RenderGlobal.java 文件源码
项目:Backmemed
阅读 19
收藏 0
点赞 0
评论 0
@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;
}
}