Fix chunk loading at one chunk render distance
This commit is contained in:
parent
d19de81370
commit
b88e61c52f
64086
javascript/classes.js
64086
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -190,6 +190,8 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
private double prevRenderSortZ;
|
||||
boolean displayListEntitiesDirty = true;
|
||||
private RenderEnv renderEnv = new RenderEnv(Blocks.air.getDefaultState(), new BlockPos(0, 0, 0));
|
||||
private int renderDistance = 0;
|
||||
private int renderDistanceSq = 0;
|
||||
|
||||
public RenderGlobal(Minecraft mcIn) {
|
||||
this.mc = mcIn;
|
||||
|
@ -411,6 +413,8 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
}
|
||||
|
||||
this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks;
|
||||
this.renderDistance = this.renderDistanceChunks * 16;
|
||||
this.renderDistanceSq = this.renderDistance * this.renderDistance;
|
||||
|
||||
if (this.viewFrustum != null) {
|
||||
this.viewFrustum.deleteGlResources();
|
||||
|
@ -1056,28 +1060,33 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
}
|
||||
|
||||
private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_) {
|
||||
BlockPos blockpos = p_181562_2_.func_181701_a(p_181562_3_);
|
||||
if(this.mc.gameSettings.renderDistanceChunks >= 2) { //Breaks at one chunk render distance...
|
||||
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 (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.renderDistanceChunks * 16 || j > this.renderDistanceChunks * 16) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
int k = i * i + j * j;
|
||||
if (Config.isFogOff()) {
|
||||
if (i > this.renderDistance || j > this.renderDistance) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
int k = i * i + j * j;
|
||||
|
||||
if (k > ((this.renderDistanceChunks * 16) * (this.renderDistanceChunks * 16))) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (k > this.renderDistanceSq) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return this.viewFrustum.getRenderChunk(blockpos);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return this.viewFrustum.getRenderChunk(blockpos);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
BlockPos blockpos = p_181562_2_.getPositionOffset16(p_181562_3_);
|
||||
return MathHelper .abs_int(p_181562_1_.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= 0 && blockpos.getY() < 256 ? (MathHelper.abs_int(p_181562_1_.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
|
||||
}
|
||||
}
|
||||
|
||||
private void fixTerrainFrustum(double x, double y, double z) {
|
||||
|
@ -2709,7 +2718,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
if (p_getRenderChunk_1_ == null) {
|
||||
return null;
|
||||
} else {
|
||||
BlockPos blockpos = p_getRenderChunk_1_.func_181701_a(p_getRenderChunk_2_);
|
||||
BlockPos blockpos = p_getRenderChunk_1_.getPositionOffset16(p_getRenderChunk_2_);
|
||||
return this.viewFrustum.getRenderChunk(blockpos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class RenderChunk {
|
|||
public ShadowFrustumState shadowLOD0InFrustum = ShadowFrustumState.OUTSIDE;
|
||||
public ShadowFrustumState shadowLOD1InFrustum = ShadowFrustumState.OUTSIDE;
|
||||
public ShadowFrustumState shadowLOD2InFrustum = ShadowFrustumState.OUTSIDE;
|
||||
private EnumMap<EnumFacing, BlockPos> field_181702_p = Maps.newEnumMap(EnumFacing.class);
|
||||
private BlockPos[] positionOffsets16 = new BlockPos[EnumFacing.VALUES.length];
|
||||
|
||||
public RenderChunk(World worldIn, RenderGlobal renderGlobalIn, BlockPos blockPosIn, int indexIn) {
|
||||
this.world = worldIn;
|
||||
|
@ -98,13 +98,11 @@ public class RenderChunk {
|
|||
this.stopCompileTask();
|
||||
this.position = pos;
|
||||
this.boundingBox = new AxisAlignedBB(pos, pos.add(16, 16, 16));
|
||||
|
||||
EnumFacing[] facings = EnumFacing._VALUES;
|
||||
for (int i = 0; i < facings.length; ++i) {
|
||||
this.field_181702_p.put(facings[i], pos.offset(facings[i], 16));
|
||||
}
|
||||
|
||||
this.initModelviewMatrix();
|
||||
|
||||
for (int i = 0; i < this.positionOffsets16.length; ++i) {
|
||||
this.positionOffsets16[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void resortTransparency(float x, float y, float z, ChunkCompileTaskGenerator generator) {
|
||||
|
@ -321,7 +319,15 @@ public class RenderChunk {
|
|||
return this.needsUpdate;
|
||||
}
|
||||
|
||||
public BlockPos func_181701_a(EnumFacing parEnumFacing) {
|
||||
return (BlockPos) this.field_181702_p.get(parEnumFacing);
|
||||
}
|
||||
public BlockPos getPositionOffset16(EnumFacing p_getPositionOffset16_1_) {
|
||||
int i = p_getPositionOffset16_1_.getIndex();
|
||||
BlockPos blockpos = this.positionOffsets16[i];
|
||||
|
||||
if (blockpos == null) {
|
||||
blockpos = this.getPosition().offset(p_getPositionOffset16_1_, 16);
|
||||
this.positionOffsets16[i] = blockpos;
|
||||
}
|
||||
|
||||
return blockpos;
|
||||
}
|
||||
}
|
|
@ -585,12 +585,6 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
|
|||
public void startServerThread() {
|
||||
this.serverThread = new Thread(this, "Server thread");
|
||||
this.serverThread.start();
|
||||
|
||||
//Lmao ¯\_(ツ)_/¯
|
||||
Thread.currentThread().setPriority(10);
|
||||
|
||||
//Possible TPS fix!?!?
|
||||
this.serverThread.setPriority(10);
|
||||
}
|
||||
|
||||
/**+
|
||||
|
|
Loading…
Reference in New Issue
Block a user