summaryrefslogtreecommitdiffstats
path: root/src/Simulator/FluidSimulator.cpp
diff options
context:
space:
mode:
authorx12xx12x <44411062+12xx12@users.noreply.github.com>2022-04-20 00:10:35 +0200
committerAlexander Harkness <me@bearbin.net>2022-04-20 09:41:02 +0200
commitfe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6 (patch)
treea5c9f00728af0f2ca841bb5d881b8d0d785b24ae /src/Simulator/FluidSimulator.cpp
parentUpdated protocol functions to Vector3x (diff)
downloadcuberite-fe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6.tar
cuberite-fe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6.tar.gz
cuberite-fe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6.tar.bz2
cuberite-fe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6.tar.lz
cuberite-fe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6.tar.xz
cuberite-fe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6.tar.zst
cuberite-fe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6.zip
Diffstat (limited to 'src/Simulator/FluidSimulator.cpp')
-rw-r--r--src/Simulator/FluidSimulator.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp
index 0c4dc791d..968b8bd6e 100644
--- a/src/Simulator/FluidSimulator.cpp
+++ b/src/Simulator/FluidSimulator.cpp
@@ -130,14 +130,14 @@ bool cFluidSimulator::IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2)
-Vector3f cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z)
+Vector3f cFluidSimulator::GetFlowingDirection(Vector3i a_Pos)
{
- if (!cChunkDef::IsValidHeight(a_Y))
+ if (!cChunkDef::IsValidHeight(a_Pos))
{
return {};
}
- if (!IsAllowedBlock(m_World.GetBlock({ a_X, a_Y, a_Z }))) // No Fluid -> No Flowing direction :D
+ if (!IsAllowedBlock(m_World.GetBlock(a_Pos))) // No Fluid -> No Flowing direction :D
{
return {};
}
@@ -148,24 +148,24 @@ Vector3f cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z)
return ((a_BlockMeta & 0x08) != 0) ? 0 : a_BlockMeta;
};
- auto BlockMeta = m_World.GetBlockMeta({ a_X, a_Y, a_Z });
+ auto BlockMeta = m_World.GetBlockMeta(a_Pos);
NIBBLETYPE CentralPoint = HeightFromMeta(BlockMeta);
NIBBLETYPE LevelPoint[4];
// blocks around the checking pos
- Vector3i Points[]
+ std::array<Vector3i, 4> Offsets {
{
- { a_X + 1, a_Y, a_Z },
- { a_X, a_Y, a_Z + 1 },
- { a_X - 1, a_Y, a_Z },
- { a_X, a_Y, a_Z - 1 }
- };
+ { 1, 0, 0 },
+ { 0, 0, 1 },
+ { 1, 0, 0 },
+ { 0, 0, 1 }
+ }};
- for (size_t i = 0; i < ARRAYCOUNT(LevelPoint); i++)
+ for (size_t i = 0; i < Offsets.size(); i++)
{
- if (IsAllowedBlock(m_World.GetBlock(Points[i])))
+ if (IsAllowedBlock(m_World.GetBlock(a_Pos + Offsets[i])))
{
- LevelPoint[i] = HeightFromMeta(m_World.GetBlockMeta(Points[i]));
+ LevelPoint[i] = HeightFromMeta(m_World.GetBlockMeta(Offsets[i]));
}
else
{