diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-09 02:23:55 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-09 02:23:55 +0100 |
commit | ff186f9735bd08727d6d010e6815c103b2e181e8 (patch) | |
tree | f06b70eabd5845e1436f7c382b0f18b203fed9a2 | |
parent | Slight plugin messaging changes (diff) | |
download | cuberite-ff186f9735bd08727d6d010e6815c103b2e181e8.tar cuberite-ff186f9735bd08727d6d010e6815c103b2e181e8.tar.gz cuberite-ff186f9735bd08727d6d010e6815c103b2e181e8.tar.bz2 cuberite-ff186f9735bd08727d6d010e6815c103b2e181e8.tar.lz cuberite-ff186f9735bd08727d6d010e6815c103b2e181e8.tar.xz cuberite-ff186f9735bd08727d6d010e6815c103b2e181e8.tar.zst cuberite-ff186f9735bd08727d6d010e6815c103b2e181e8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Simulator/FireSimulator.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index 4967c83f9..6079ea740 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -335,20 +335,33 @@ void cFireSimulator::RemoveFuelNeighbors(cChunk * a_Chunk, int a_RelX, int a_Rel { BLOCKTYPE BlockType; NIBBLETYPE BlockMeta; - if (!a_Chunk->UnboundedRelGetBlock(a_RelX + gNeighborCoords[i].x, a_RelY + gNeighborCoords[i].y, a_RelZ + gNeighborCoords[i].z, BlockType, BlockMeta)) + int X = a_RelX + gNeighborCoords[i].x; + int Z = a_RelZ + gNeighborCoords[i].z; + + cChunkPtr Neighbour = a_Chunk->GetRelNeighborChunkAdjustCoords(X, Z); + if (Neighbour == NULL) { - // Neighbor not accessible, ignore it continue; } + Neighbour->GetBlockTypeMeta(X, a_RelY + gCrossCoords[i].y, Z, BlockType, BlockMeta); + if (!IsFuel(BlockType)) { continue; } + + if (BlockType == E_BLOCK_TNT) + { + int AbsX = X + Neighbour->GetPosX() * cChunkDef::Width; + int AbsZ = Z + Neighbour->GetPosZ() * cChunkDef::Width; + + m_World.SpawnPrimedTNT(AbsX, a_RelY + gNeighborCoords[i].y, AbsZ, 0); + Neighbour->SetBlock(X, a_RelY + gNeighborCoords[i].y, Z, E_BLOCK_AIR, 0); + return; + } + bool ShouldReplaceFuel = (m_World.GetTickRandomNumber(MAX_CHANCE_REPLACE_FUEL) < m_ReplaceFuelChance); - a_Chunk->UnboundedRelSetBlock( - a_RelX + gNeighborCoords[i].x, a_RelY + gNeighborCoords[i].y, a_RelZ + gNeighborCoords[i].z, - ShouldReplaceFuel ? E_BLOCK_FIRE : E_BLOCK_AIR, 0 - ); + Neighbour->SetBlock(X, a_RelY + gNeighborCoords[i].y, Z, ShouldReplaceFuel ? E_BLOCK_FIRE : E_BLOCK_AIR, 0); } // for i - Coords[] } |