initial bugfix for taller chunks
This commit is contained in:
parent
caef42dc16
commit
7fd8a49d5c
6 changed files with 67 additions and 55 deletions
|
@ -464,7 +464,7 @@ public class RenderGlobal
|
|||
|
||||
if (entity != null)
|
||||
{
|
||||
this.viewFrustum.updateChunkPositions(entity.posX, entity.posZ);
|
||||
this.viewFrustum.updateChunkPositions(entity.posX, entity.posY, entity.posZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -605,7 +605,7 @@ public class RenderGlobal
|
|||
for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation : this.renderInfos)
|
||||
{
|
||||
Chunk chunk = this.theWorld.getChunk(renderglobal$containerlocalrenderinformation.renderChunk.getPosition());
|
||||
ClassInheritanceMultiMap<Entity> classinheritancemultimap = chunk.getEntities()[renderglobal$containerlocalrenderinformation.renderChunk.getPosition().getY() / 16];
|
||||
ClassInheritanceMultiMap<Entity> classinheritancemultimap = chunk.getEntities()[ExtMath.clampi(renderglobal$containerlocalrenderinformation.renderChunk.getPosition().getY() / 16, 0, 31)];
|
||||
|
||||
if (!classinheritancemultimap.isEmpty())
|
||||
{
|
||||
|
@ -761,7 +761,7 @@ public class RenderGlobal
|
|||
this.frustumUpdatePosChunkX = viewEntity.chunkCoordX;
|
||||
this.frustumUpdatePosChunkY = viewEntity.chunkCoordY;
|
||||
this.frustumUpdatePosChunkZ = viewEntity.chunkCoordZ;
|
||||
this.viewFrustum.updateChunkPositions(viewEntity.posX, viewEntity.posZ);
|
||||
this.viewFrustum.updateChunkPositions(viewEntity.posX, viewEntity.posY, viewEntity.posZ);
|
||||
}
|
||||
double d3 = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
|
||||
double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
|
||||
|
@ -821,18 +821,21 @@ public class RenderGlobal
|
|||
else
|
||||
{
|
||||
// int i = blockpos1.getY() > 0 ? 248 : 8;
|
||||
int i = blockpos1.getY() > 0 ? 504 : 8;
|
||||
// int i = blockpos1.getY() > 0 ? 504 : 8;
|
||||
|
||||
for (int j = -this.renderDistanceChunks; j <= this.renderDistanceChunks; ++j)
|
||||
{
|
||||
for (int k = -this.renderDistanceChunks; k <= this.renderDistanceChunks; ++k)
|
||||
{
|
||||
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, i, (k << 4) + 8));
|
||||
|
||||
if (renderchunk1 != null && Frustum.isInFrustum(renderchunk1.boundingBox))
|
||||
for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i)
|
||||
{
|
||||
renderchunk1.setFrameIndex(frameCount);
|
||||
queue.add(new RenderGlobal.ContainerLocalRenderInformation(renderchunk1, (Facing)null, 0));
|
||||
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
||||
|
||||
if (renderchunk1 != null && Frustum.isInFrustum(renderchunk1.boundingBox))
|
||||
{
|
||||
renderchunk1.setFrameIndex(frameCount);
|
||||
queue.add(new RenderGlobal.ContainerLocalRenderInformation(renderchunk1, (Facing)null, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -932,7 +935,7 @@ public class RenderGlobal
|
|||
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, Facing facing)
|
||||
{
|
||||
BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
|
||||
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= -World.MAX_SIZE_Y && blockpos.getY() < World.MAX_SIZE_Y ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
|
||||
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (ExtMath.absi(playerPos.getY() - blockpos.getY()) <= this.renderDistanceChunks * 16 ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
|
||||
}
|
||||
|
||||
protected Vector3f getViewVector(Entity entityIn, double partialTicks)
|
||||
|
|
|
@ -58,13 +58,14 @@ public class ViewFrustum
|
|||
{
|
||||
int i = renderDistanceChunks * 2 + 1;
|
||||
this.countChunksX = i;
|
||||
this.countChunksY = 32;
|
||||
this.countChunksY = i;
|
||||
this.countChunksZ = i;
|
||||
}
|
||||
|
||||
public void updateChunkPositions(double viewEntityX, double viewEntityZ)
|
||||
public void updateChunkPositions(double viewEntityX, double viewEntityY, double viewEntityZ)
|
||||
{
|
||||
int i = ExtMath.floord(viewEntityX) - 8;
|
||||
int n = ExtMath.floord(viewEntityY) - 8;
|
||||
int j = ExtMath.floord(viewEntityZ) - 8;
|
||||
int k = this.countChunksX * 16;
|
||||
|
||||
|
@ -78,7 +79,7 @@ public class ViewFrustum
|
|||
|
||||
for (int l1 = 0; l1 < this.countChunksY; ++l1)
|
||||
{
|
||||
int i2 = l1 * 16;
|
||||
int i2 = this.func_178157_a(n, k, l1);
|
||||
RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
|
||||
BlockPos blockpos = new BlockPos(i1, i2, k1);
|
||||
|
||||
|
@ -154,28 +155,28 @@ public class ViewFrustum
|
|||
int y = bucketInt(pos.getY());
|
||||
int z = bucketInt(pos.getZ());
|
||||
|
||||
if (y >= 0 && y < this.countChunksY)
|
||||
x = x % this.countChunksX;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
x = x % this.countChunksX;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
x += this.countChunksX;
|
||||
}
|
||||
|
||||
z = z % this.countChunksZ;
|
||||
|
||||
if (z < 0)
|
||||
{
|
||||
z += this.countChunksZ;
|
||||
}
|
||||
|
||||
int p = (z * this.countChunksY + y) * this.countChunksX + x;
|
||||
return this.renderChunks[p];
|
||||
x += this.countChunksX;
|
||||
}
|
||||
else
|
||||
|
||||
y = y % this.countChunksY;
|
||||
|
||||
if (y < 0)
|
||||
{
|
||||
return null;
|
||||
y += this.countChunksY;
|
||||
}
|
||||
|
||||
z = z % this.countChunksZ;
|
||||
|
||||
if (z < 0)
|
||||
{
|
||||
z += this.countChunksZ;
|
||||
}
|
||||
|
||||
int p = (z * this.countChunksY + y) * this.countChunksX + x;
|
||||
return this.renderChunks[p];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue