diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp index 087227e7..6b6c4c16 100644 --- a/Minecraft.Client/EntityTracker.cpp +++ b/Minecraft.Client/EntityTracker.cpp @@ -31,7 +31,7 @@ void EntityTracker::addEntity(shared_ptr e) { if (e->instanceof(eTYPE_SERVERPLAYER)) { - addEntity(e, 32 * 16, 2); + addEntity(e, 16 * 32, 2); shared_ptr player = dynamic_pointer_cast(e); for ( auto& it : entities ) { @@ -76,7 +76,12 @@ void EntityTracker::addEntity(shared_ptr e, int range, int updateInterva void EntityTracker::addEntity(shared_ptr e, int range, int updateInterval, bool trackDeltas) { - if (range > maxRange) range = maxRange; +// if (!app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_ClassicEntityRender)) +// range = 16 * maxChunkDistance; + + if (range > maxRange) + range = maxRange; + if (entityMap.find(e->entityId) != entityMap.end()) { assert(false); // Entity already tracked diff --git a/Minecraft.World/Entity.cpp b/Minecraft.World/Entity.cpp index 7f6f4e29..570106c0 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -1324,18 +1324,48 @@ void Entity::awardKillScore(shared_ptr victim, int score) bool Entity::shouldRender(Vec3 *c) { - double xd = x - c->x; - double yd = y - c->y; - double zd = z - c->z; - double distance = xd * xd + yd * yd + zd * zd; - return shouldRenderAtSqrDistance(distance); +/* + if (!app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_ClassicEntityRender)) + { + int entityChunkX = (int)std::floor(x / 16.0); + int entityChunkY = (int)std::floor(y / 16.0); + int entityChunkZ = (int)std::floor(z / 16.0); + + int cameraChunkX = (int)std::floor(c->x / 16.0); + int cameraChunkY = (int)std::floor(c->y / 16.0); + int cameraChunkZ = (int)std::floor(c->z / 16.0); + + int chunkDiffX = std::abs(entityChunkX - cameraChunkX); + int chunkDiffY = std::abs(entityChunkY - cameraChunkY); + int chunkDiffZ = std::abs(entityChunkZ - cameraChunkZ); + + int maxXZ = (chunkDiffX > chunkDiffZ) ? chunkDiffX : chunkDiffZ; + int chunkDistance = (maxXZ > chunkDiffY) ? maxXZ : chunkDiffY; + return shouldRenderAtSqrDistance(chunkDistance); + } + else +*/ + { + double xd = x - c->x; + double yd = y - c->y; + double zd = z - c->z; + double distance = xd * xd + yd * yd + zd * zd; + return shouldRenderAtSqrDistance(distance); + } } bool Entity::shouldRenderAtSqrDistance(double distance) { - double size = bb->getSize(); - size *= 64.0f * viewScale; - return distance < size * size; +/* + if (!app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_ClassicEntityRender)) + return distance <= maxChunkDistance; + else +*/ + { + double size = bb->getSize(); + size *= 64.0f * viewScale; + return distance < size * size; + } } bool Entity::isCreativeModeAllowed()