1
0

Use SimulateChunk in redstone simulator

+ Improved performance, reduces bottleneck in chunkmap lookup
* Stop allocating and throwing away lots of small vectors in Update/GetValidSourcePositions return values
- Remove unused GetPowerLevel virtual
This commit is contained in:
Tiger Wang
2020-07-26 14:15:00 +01:00
parent de06ae7add
commit 4e5ab02a58
27 changed files with 785 additions and 847 deletions

View File

@@ -34,10 +34,13 @@ public:
const Vector3i a_CursorPos
) override
{
const auto Meta = a_ChunkInterface.GetBlockMeta(a_BlockPos);
// Toggle the 3rd bit (addition / subtraction):
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockPos);
Meta ^= 0x04;
a_ChunkInterface.SetBlockMeta(a_BlockPos, Meta);
a_ChunkInterface.SetBlockMeta(a_BlockPos, Meta ^ 0x04);
// Update simulators:
a_WorldInterface.WakeUpSimulators(a_BlockPos);
return true;
}
@@ -56,6 +59,7 @@ public:
UNUSED(a_ChunkInterface);
UNUSED(a_BlockFace);
a_WorldInterface.WakeUpSimulators(a_BlockPos);
a_WorldInterface.SendBlockTo(a_BlockPos, a_Player);
}
@@ -120,15 +124,6 @@ public:
inline static bool IsOn(NIBBLETYPE a_Meta)
{
return ((a_Meta & 0x8) == 0x8);
}
inline static Vector3i GetSideCoordinate(Vector3i a_Position, NIBBLETYPE a_Meta, bool a_bInverse)
{
if (!a_bInverse)