diff options
author | madmaxoft <github@xoft.cz> | 2014-01-23 23:46:51 +0100 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-01-23 23:46:51 +0100 |
commit | 98976de0710e60cc9d11c85cf398b0ec565399c5 (patch) | |
tree | eaae19ce64cfc644a9b5836f6fea4c6e7f9ebd2f /src/World.cpp | |
parent | Fixed a warning in ScoreboardSerializer. (diff) | |
parent | Merge pull request #580 from xdot/master (diff) | |
download | cuberite-98976de0710e60cc9d11c85cf398b0ec565399c5.tar cuberite-98976de0710e60cc9d11c85cf398b0ec565399c5.tar.gz cuberite-98976de0710e60cc9d11c85cf398b0ec565399c5.tar.bz2 cuberite-98976de0710e60cc9d11c85cf398b0ec565399c5.tar.lz cuberite-98976de0710e60cc9d11c85cf398b0ec565399c5.tar.xz cuberite-98976de0710e60cc9d11c85cf398b0ec565399c5.tar.zst cuberite-98976de0710e60cc9d11c85cf398b0ec565399c5.zip |
Diffstat (limited to 'src/World.cpp')
-rw-r--r-- | src/World.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/World.cpp b/src/World.cpp index 49d42f08e..453a22c2d 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -22,6 +22,8 @@ #include "Entities/Player.h" #include "Entities/TNTEntity.h" +#include "BlockEntities/CommandBlockEntity.h" + // Simulators: #include "Simulator/SimulatorManager.h" #include "Simulator/FloodyFluidSimulator.h" @@ -523,7 +525,7 @@ void cWorld::Start(void) } m_StorageSchema = IniFile.GetValueSet ("Storage", "Schema", m_StorageSchema); - m_StorageCompressionFactor = IniFile.GetValueSetI ("Storage", "CompressionFactor", m_StorageCompressionFactor); + m_StorageCompressionFactor = IniFile.GetValueSetI("Storage", "CompressionFactor", m_StorageCompressionFactor); m_MaxCactusHeight = IniFile.GetValueSetI("Plants", "MaxCactusHeight", 3); m_MaxSugarcaneHeight = IniFile.GetValueSetI("Plants", "MaxSugarcaneHeight", 3); m_IsCactusBonemealable = IniFile.GetValueSetB("Plants", "IsCactusBonemealable", false); @@ -540,6 +542,7 @@ void cWorld::Start(void) m_bEnabledPVP = IniFile.GetValueSetB("PVP", "Enabled", true); m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", false); m_ShouldLavaSpawnFire = IniFile.GetValueSetB("Physics", "ShouldLavaSpawnFire", true); + m_bCommandBlocksEnabled = IniFile.GetValueSetB("Mechanics", "CommandBlocksEnabled", false); m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode); @@ -2611,6 +2614,28 @@ bool cWorld::UpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString +bool cWorld::SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Command) +{ + class cUpdateCommandBlock : public cCommandBlockCallback + { + AString m_Command; + public: + cUpdateCommandBlock(const AString & a_Command) : m_Command(a_Command) {} + + virtual bool Item(cCommandBlockEntity * a_CommandBlock) override + { + a_CommandBlock->SetCommand(m_Command); + return false; + } + } CmdBlockCB (a_Command); + + return DoWithCommandBlockAt(a_BlockX, a_BlockY, a_BlockZ, CmdBlockCB); +} + + + + + void cWorld::ChunksStay(const cChunkCoordsList & a_Chunks, bool a_Stay) { m_ChunkMap->ChunksStay(a_Chunks, a_Stay); |