summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2013-12-04 03:05:34 +0100
committerSamuel Barney <samjbarney@gmail.com>2013-12-04 03:05:34 +0100
commitefae54db0a9afe70237c427e855d5834e837342a (patch)
treea41104a88f0782f4c78e493ffe14898ee9ae5672 /src/Simulator
parentFire no longer goes out when on top of nether rack (diff)
downloadcuberite-efae54db0a9afe70237c427e855d5834e837342a.tar
cuberite-efae54db0a9afe70237c427e855d5834e837342a.tar.gz
cuberite-efae54db0a9afe70237c427e855d5834e837342a.tar.bz2
cuberite-efae54db0a9afe70237c427e855d5834e837342a.tar.lz
cuberite-efae54db0a9afe70237c427e855d5834e837342a.tar.xz
cuberite-efae54db0a9afe70237c427e855d5834e837342a.tar.zst
cuberite-efae54db0a9afe70237c427e855d5834e837342a.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/FireSimulator.cpp15
-rw-r--r--src/Simulator/FireSimulator.h2
2 files changed, 11 insertions, 6 deletions
diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp
index bfbc4b1c7..8e46ed320 100644
--- a/src/Simulator/FireSimulator.cpp
+++ b/src/Simulator/FireSimulator.cpp
@@ -94,9 +94,7 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
for (cCoordWithIntList::iterator itr = Data.begin(); itr != Data.end();)
{
int idx = cChunkDef::MakeIndexNoCheck(itr->x, itr->y, itr->z);
- int idb = cChunkDef::MakeIndexNoCheck(itr->x, itr->y - 1, itr->z);
BLOCKTYPE BlockType = a_Chunk->GetBlock(idx);
- BLOCKTYPE Burnee = a_Chunk->GetBlock(idb);
if (!IsAllowedBlock(BlockType))
{
@@ -137,7 +135,14 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
itr = Data.erase(itr);
continue;
}
- if(Burnee != E_BLOCK_NETHERRACK)
+
+ BLOCKTYPE Burnee = E_BLOCK_AIR;
+ if (itr->y > 0)
+ {
+ Burnee = a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z);
+ }
+
+ if(!DoesBurnForever(Burnee))
{
a_Chunk->SetMeta(idx, BlockMeta + 1);
}
@@ -181,7 +186,7 @@ bool cFireSimulator::IsFuel(BLOCKTYPE a_BlockType)
-bool cFireSimulator::IsForever(BLOCKTYPE a_BlockType)
+bool cFireSimulator::DoesBurnForever(BLOCKTYPE a_BlockType)
{
return (a_BlockType == E_BLOCK_NETHERRACK);
}
@@ -230,7 +235,7 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in
if (a_RelY > 0)
{
BLOCKTYPE BlockBelow = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ);
- if (IsForever(BlockBelow))
+ if (DoesBurnForever(BlockBelow))
{
// Is burning atop of netherrack, burn forever (re-check in 10 sec)
return 10000;
diff --git a/src/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h
index 0d8a548ef..59cc62540 100644
--- a/src/Simulator/FireSimulator.h
+++ b/src/Simulator/FireSimulator.h
@@ -28,7 +28,7 @@ public:
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
bool IsFuel (BLOCKTYPE a_BlockType);
- bool IsForever(BLOCKTYPE a_BlockType);
+ bool DoesBurnForever(BLOCKTYPE a_BlockType);
protected:
/// Time (in msec) that a fire block takes to burn with a fuel block into the next step