mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Ensure broken tiles fully remove render data #442
This commit is contained in:
parent
138d92359c
commit
c41c18c8df
|
|
@ -1235,6 +1235,11 @@ void ClientConnection::handleTileUpdate(shared_ptr<TileUpdatePacket> packet)
|
||||||
PIXBeginNamedEvent(0,"Setting data\n");
|
PIXBeginNamedEvent(0,"Setting data\n");
|
||||||
bool tileWasSet = dimensionLevel->doSetTileAndData(packet->x, packet->y, packet->z, packet->block, packet->data);
|
bool tileWasSet = dimensionLevel->doSetTileAndData(packet->x, packet->y, packet->z, packet->block, packet->data);
|
||||||
|
|
||||||
|
if (tileWasSet && packet->block == 0 && minecraft->levelRenderer && minecraft->levelRenderer->destroyedTileManager)
|
||||||
|
{
|
||||||
|
minecraft->levelRenderer->destroyedTileManager->RemoveTileAt(dimensionLevel, packet->x, packet->y, packet->z);
|
||||||
|
}
|
||||||
|
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
// 4J - remove any tite entities in this region which are associated with a tile that is now no longer a tile entity. Without doing this we end up with stray
|
// 4J - remove any tite entities in this region which are associated with a tile that is now no longer a tile entity. Without doing this we end up with stray
|
||||||
|
|
|
||||||
|
|
@ -3584,6 +3584,31 @@ void LevelRenderer::DestroyedTileManager::destroyingTileAt( Level *level, int x,
|
||||||
LeaveCriticalSection(&m_csDestroyedTiles);
|
LeaveCriticalSection(&m_csDestroyedTiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LevelRenderer::DestroyedTileManager::RemoveTileAt(const Level *level, int x, int y, int z)
|
||||||
|
{
|
||||||
|
EnterCriticalSection(&m_csDestroyedTiles);
|
||||||
|
|
||||||
|
// Remove ALL entries matching this position
|
||||||
|
for (auto it = m_destroyedTiles.begin(); it != m_destroyedTiles.end();)
|
||||||
|
{
|
||||||
|
const auto &tile = *it;
|
||||||
|
|
||||||
|
if (tile->level == level &&
|
||||||
|
tile->x == x &&
|
||||||
|
tile->y == y &&
|
||||||
|
tile->z == z)
|
||||||
|
{
|
||||||
|
it = m_destroyedTiles.erase(it);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LeaveCriticalSection(&m_csDestroyedTiles);
|
||||||
|
}
|
||||||
|
|
||||||
// For chunk rebuilding to inform the manager that a chunk (a 16x16x16 tile render chunk) has been updated
|
// For chunk rebuilding to inform the manager that a chunk (a 16x16x16 tile render chunk) has been updated
|
||||||
void LevelRenderer::DestroyedTileManager::updatedChunkAt(Level *level, int x, int y, int z, int veryNearCount)
|
void LevelRenderer::DestroyedTileManager::updatedChunkAt(Level *level, int x, int y, int z, int veryNearCount)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,7 @@ public:
|
||||||
void destroyingTileAt( Level *level, int x, int y, int z ); // For game to let this manager know that a tile is about to be destroyed (must be called before it actually is)
|
void destroyingTileAt( Level *level, int x, int y, int z ); // For game to let this manager know that a tile is about to be destroyed (must be called before it actually is)
|
||||||
void updatedChunkAt( Level * level, int x, int y, int z, int veryNearCount ); // For chunk rebuilding to inform the manager that a chunk (a 16x16x16 tile render chunk) has been updated
|
void updatedChunkAt( Level * level, int x, int y, int z, int veryNearCount ); // For chunk rebuilding to inform the manager that a chunk (a 16x16x16 tile render chunk) has been updated
|
||||||
void addAABBs( Level *level, AABB *box, AABBList *boxes ); // For game to get any AABBs that the user should be colliding with as render data has not yet been updated
|
void addAABBs( Level *level, AABB *box, AABBList *boxes ); // For game to get any AABBs that the user should be colliding with as render data has not yet been updated
|
||||||
|
void RemoveTileAt(const Level* level, int x, int y, int z);
|
||||||
void tick();
|
void tick();
|
||||||
DestroyedTileManager();
|
DestroyedTileManager();
|
||||||
~DestroyedTileManager();
|
~DestroyedTileManager();
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,11 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (minecraft->levelRenderer && minecraft->levelRenderer->destroyedTileManager)
|
||||||
|
{
|
||||||
|
minecraft->levelRenderer->destroyedTileManager->RemoveTileAt(level, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
if (minecraft->levelRenderer && minecraft->levelRenderer->destroyedTileManager)
|
if (minecraft->levelRenderer && minecraft->levelRenderer->destroyedTileManager)
|
||||||
{
|
{
|
||||||
minecraft->levelRenderer->destroyedTileManager->destroyingTileAt(level, x, y, z);
|
minecraft->levelRenderer->destroyedTileManager->destroyingTileAt(level, x, y, z);
|
||||||
|
|
@ -114,6 +119,11 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face)
|
||||||
}
|
}
|
||||||
yDestroyBlock = -1;
|
yDestroyBlock = -1;
|
||||||
|
|
||||||
|
if (minecraft->levelRenderer && minecraft->levelRenderer->destroyedTileManager)
|
||||||
|
{
|
||||||
|
minecraft->levelRenderer->destroyedTileManager->RemoveTileAt(level, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
if (!localPlayerMode->isCreative())
|
if (!localPlayerMode->isCreative())
|
||||||
{
|
{
|
||||||
const shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
const shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue