1
0

Wake up redstone simulator on slot changes for blockentities (#4348)

Fix #1898
Fix #2194
Fix #3063
This commit is contained in:
Bond-009 2019-08-11 01:11:57 +02:00 committed by peterbell10
parent 528db6eea7
commit 4de232bdae
2 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include "Globals.h"
#include "BlockEntityWithItems.h"
#include "../Simulator/RedstoneSimulator.h"
@ -68,5 +69,12 @@ void cBlockEntityWithItems::OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum)
}
m_World->MarkChunkDirty(GetChunkX(), GetChunkZ());
auto Pos = Vector3i(m_PosX, m_PosY, m_PosZ);
m_World->DoWithChunkAt(Pos, [&](cChunk & a_Chunk)
{
m_World->GetRedstoneSimulator()->WakeUp(Pos, &a_Chunk);
return true;
}
);
}
}

View File

@ -2,6 +2,7 @@
#pragma once
#include "BlockEntityWithItems.h"
#include "../Simulator/RedstoneSimulator.h"
@ -89,6 +90,13 @@ private:
}
m_World->MarkChunkDirty(GetChunkX(), GetChunkZ());
auto Pos = Vector3i(m_PosX, m_PosY, m_PosZ);
m_World->DoWithChunkAt(Pos, [&](cChunk & a_Chunk)
{
m_World->GetRedstoneSimulator()->WakeUp(Pos, &a_Chunk);
return true;
}
);
}
}