mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-05 18:10:09 +03:00
* Revert to the old system, don't remove clashing ID entities, prioritize players over other entities.
This commit is contained in:
@@ -279,6 +279,13 @@ Material* Level::getMaterial(int x, int y, int z)
|
||||
|
||||
Entity* Level::getEntity(int id)
|
||||
{
|
||||
// prioritize players first.
|
||||
for (auto it = m_players.begin(); it != m_players.end(); it++)
|
||||
{
|
||||
Player* pEnt = *it;
|
||||
if (pEnt->m_EntityID == id)
|
||||
return pEnt;
|
||||
}
|
||||
for (auto it = m_entities.begin(); it != m_entities.end(); it++)
|
||||
{
|
||||
Entity* pEnt = *it;
|
||||
@@ -1062,7 +1069,15 @@ bool Level::addEntity(Entity* pEnt)
|
||||
{
|
||||
Entity* pOldEnt = getEntity(pEnt->hashCode());
|
||||
if (pOldEnt)
|
||||
removeEntity(pOldEnt);
|
||||
{
|
||||
LogMsg("Warning: entity %d already exists.", pEnt->hashCode());
|
||||
//removeEntity(pOldEnt);
|
||||
}
|
||||
|
||||
if (!pEnt->isPlayer() && field_11)
|
||||
{
|
||||
LogMsg("Hey, why are you trying to add an non-player entity in a multiplayer world?");
|
||||
}
|
||||
|
||||
//@NOTE: useless Mth::floor() calls
|
||||
Mth::floor(pEnt->m_pos.x / 16);
|
||||
|
||||
@@ -81,6 +81,9 @@ bool SandTile::isFree(Level* level, int x, int y, int z)
|
||||
|
||||
void SandTile::tick(Level* level, int x, int y, int z, Random* random)
|
||||
{
|
||||
if (level->field_11)
|
||||
return;
|
||||
|
||||
checkSlide(level, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user