diff options
author | andrew <xdotftw@gmail.com> | 2014-01-23 13:57:04 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-01-23 13:57:04 +0100 |
commit | 4ef61d8bf6d815b164a32bdab6a18744cbf0abd2 (patch) | |
tree | fc0c615aba88114ce209b99e7e8c8c5d925117bb /src/World.cpp | |
parent | Merge pull request #566 from xdot/master (diff) | |
download | cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.gz cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.bz2 cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.lz cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.xz cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.tar.zst cuberite-4ef61d8bf6d815b164a32bdab6a18744cbf0abd2.zip |
Diffstat (limited to '')
-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); |