summaryrefslogtreecommitdiffstats
path: root/src/Blocks
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Blocks/BlockBed.cpp4
-rw-r--r--src/Blocks/BlockCauldron.h18
-rw-r--r--src/Blocks/WorldInterface.h6
3 files changed, 27 insertions, 1 deletions
diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp
index 80ac18560..cd5783f58 100644
--- a/src/Blocks/BlockBed.cpp
+++ b/src/Blocks/BlockBed.cpp
@@ -108,7 +108,7 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (Meta & 0x4)
{
- a_Player->SendMessageFailure("This bed is occupied.");
+ a_Player->SendMessageFailure("This bed is occupied");
}
else
{
@@ -133,6 +133,8 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta | 0x4); // Where 0x4 = occupied bit
a_Player->SetIsInBed(true);
+ a_Player->SetBedPos(Vector3i(a_BlockX, a_BlockY, a_BlockZ));
+ a_Player->SendMessageSuccess("Home position set successfully");
cTimeFastForwardTester Tester;
if (a_WorldInterface.ForEachPlayer(Tester))
diff --git a/src/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h
index 41b79b6c3..e0f86f4cb 100644
--- a/src/Blocks/BlockCauldron.h
+++ b/src/Blocks/BlockCauldron.h
@@ -58,6 +58,24 @@ public:
{
return true;
}
+
+ 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
+ {
+ 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;
+ }
+
+ NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
+ if (Meta < 3)
+ {
+ a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta + 1);
+ }
+ }
} ;
diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h
index a75ee9e26..d1c6f9bfc 100644
--- a/src/Blocks/WorldInterface.h
+++ b/src/Blocks/WorldInterface.h
@@ -46,6 +46,12 @@ public:
virtual void SetTimeOfDay(Int64 a_TimeOfDay) = 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;
+
/** Wakes up the simulators for the specified block */
virtual void WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) = 0;