summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-14 11:14:04 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-14 11:14:04 +0200
commita70b8298b6ada8abead9ef2b292531407225c2d1 (patch)
tree605095d3d0a6e6a291644af0b7864a126e52ceb8
parentMerge remote-tracking branch 'origin/master' into portals (diff)
downloadcuberite-a70b8298b6ada8abead9ef2b292531407225c2d1.tar
cuberite-a70b8298b6ada8abead9ef2b292531407225c2d1.tar.gz
cuberite-a70b8298b6ada8abead9ef2b292531407225c2d1.tar.bz2
cuberite-a70b8298b6ada8abead9ef2b292531407225c2d1.tar.lz
cuberite-a70b8298b6ada8abead9ef2b292531407225c2d1.tar.xz
cuberite-a70b8298b6ada8abead9ef2b292531407225c2d1.tar.zst
cuberite-a70b8298b6ada8abead9ef2b292531407225c2d1.zip
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockCauldron.h6
-rw-r--r--src/Blocks/WorldInterface.h8
-rw-r--r--src/World.h6
3 files changed, 12 insertions, 8 deletions
diff --git a/src/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h
index 5ec776df6..e0f86f4cb 100644
--- a/src/Blocks/BlockCauldron.h
+++ b/src/Blocks/BlockCauldron.h
@@ -61,8 +61,12 @@ public:
virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
- if (IsBiomeNoDownfall(a_Chunk.GetBiomeAt(a_RelX, a_RelZ)) || !a_WorldInterface.IsWeatherWet())
+ int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
+ int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
+ if (!a_WorldInterface.IsWeatherWetAt(BlockX, BlockZ) || (a_RelY != a_WorldInterface.GetHeight(BlockX, BlockZ)))
{
+ // It's not raining at our current location or we do not have a direct view of the sky
+ // We cannot eat the rain :(
return;
}
diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h
index 7df82197e..e5638c16e 100644
--- a/src/Blocks/WorldInterface.h
+++ b/src/Blocks/WorldInterface.h
@@ -37,9 +37,9 @@ public:
virtual void SetTimeOfDay(Int64 a_TimeOfDay) = 0;
- /** Returns true if the current weather has any precipitation - rain or storm
- Does not check if biome has no downfall, use cChunk::GetBiomeAt(RelX, RelZ) for that
- */
- virtual bool IsWeatherWet(void) const = 0;
+ /** Returns true if it is raining, stormy or snowing at the specified location. This takes into account biomes. */
+ virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) = 0;
+ /** Returns the world height at the specified coords; waits for the chunk to get loaded / generated */
+ virtual int GetHeight(int a_BlockX, int a_BlockZ) = 0;
};
diff --git a/src/World.h b/src/World.h
index ab36e0a9b..0592c78fc 100644
--- a/src/World.h
+++ b/src/World.h
@@ -180,7 +180,7 @@ public:
virtual eDimension GetDimension(void) const { return m_Dimension; }
/** Returns the world height at the specified coords; waits for the chunk to get loaded / generated */
- int GetHeight(int a_BlockX, int a_BlockZ);
+ virtual int GetHeight(int a_BlockX, int a_BlockZ);
// tolua_end
@@ -749,10 +749,10 @@ public:
}
/** Returns true if the current weather has any precipitation - rain, storm or snow */
- virtual bool IsWeatherWet(void) const { return !IsWeatherSunny(); }
+ bool IsWeatherWet(void) const { return !IsWeatherSunny(); }
/** Returns true if it is raining, stormy or snowing at the specified location. This takes into account biomes. */
- bool IsWeatherWetAt(int a_BlockX, int a_BlockZ)
+ virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ)
{
return (IsWeatherWet() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ)));
}