From 25ec7750aac9800bec83a844020a6eeda5cd4d74 Mon Sep 17 00:00:00 2001 From: Tycho Date: Fri, 31 Jan 2014 15:17:41 -0800 Subject: Changed signitures of Several BLockHandler Methods Changed the signitures of the following to use interfaces: GetPlacementBlockTypeMeta OnPlaced OnPlacedByPlayer OnDestroyed OnNeighbourChanged NeighbourChanged OnUse CanBeAt Check --- src/Chunk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 4ac38c46c..83d69d12c 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -440,7 +440,7 @@ private: void BroadcastPendingBlockChanges(void); /// Checks the block scheduled for checking in m_ToTickBlocks[] - void CheckBlocks(void); + void CheckBlocks(); /// Ticks several random blocks in the chunk void TickBlocks(void); -- cgit v1.2.3 From 3a897844a0796ce91e51e0154acbbce2d8e807e5 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Fri, 7 Feb 2014 22:59:08 +0100 Subject: Renamed cRedstoneManager to cRedstoneSimulator and renamed cRedstoneSimulator to cIncrementalRedstoneSimulator (Might change later). --- src/Chunk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 83d69d12c..3dc83b157 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -6,7 +6,7 @@ #include "Simulator/FireSimulator.h" #include "Simulator/SandSimulator.h" -#include "Simulator/RedstoneSimulator.h" +#include "Simulator/IncrementalRedstoneSimulator.h" -- cgit v1.2.3 From ea71bfa9b645cda80b7d4364c675ebaee8db8353 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 8 Feb 2014 21:55:21 +0100 Subject: Initial ChunkStay code. --- src/Chunk.h | 110 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 56 insertions(+), 54 deletions(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 3dc83b157..93eba217e 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -85,10 +85,10 @@ public: void MarkLoaded(void); // Marks the chunk as freshly loaded. Fails if the chunk is already valid void MarkLoadFailed(void); // Marks the chunk as failed to load. Ignored is the chunk is already valid - /// Gets all chunk data, calls the a_Callback's methods for each data type + /** Gets all chunk data, calls the a_Callback's methods for each data type */ void GetAllData(cChunkDataCallback & a_Callback); - /// Sets all chunk data + /** Sets all chunk data */ void SetAllData( const BLOCKTYPE * a_BlockTypes, const NIBBLETYPE * a_BlockMeta, @@ -104,27 +104,29 @@ public: const cChunkDef::BlockNibbles & a_SkyLight ); - /// Copies m_BlockData into a_BlockTypes, only the block types + /** Copies m_BlockData into a_BlockTypes, only the block types */ void GetBlockTypes(BLOCKTYPE * a_BlockTypes); - /// Writes the specified cBlockArea at the coords specified. Note that the coords may extend beyond the chunk! + /** Writes the specified cBlockArea at the coords specified. Note that the coords may extend beyond the chunk! */ void WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes); - /// Returns true if there is a block entity at the coords specified + /** Returns true if there is a block entity at the coords specified */ bool HasBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ); - /// Sets or resets the internal flag that prevents chunk from being unloaded + /** Sets or resets the internal flag that prevents chunk from being unloaded. + The flag is cumulative - it can be set multiple times and then needs to be un-set that many times + before the chunk is unloadable again. */ void Stay(bool a_Stay = true); - /// Recence all mobs proximities to players in order to know what to do with them + /** Recence all mobs proximities to players in order to know what to do with them */ void CollectMobCensus(cMobCensus& toFill); - /// Try to Spawn Monsters inside chunk + /** Try to Spawn Monsters inside chunk */ void SpawnMobs(cMobSpawner& a_MobSpawner); void Tick(float a_Dt); - /// Ticks a single block. Used by cWorld::TickQueuedBlocks() to tick the queued blocks + /** Ticks a single block. Used by cWorld::TickQueuedBlocks() to tick the queued blocks */ void TickBlock(int a_RelX, int a_RelY, int a_RelZ); int GetPosX(void) const { return m_PosX; } @@ -137,13 +139,13 @@ public: // SetBlock() does a lot of work (heightmap, tickblocks, blockentities) so a BlockIdx version doesn't make sense void SetBlock( const Vector3i & a_RelBlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) { SetBlock( a_RelBlockPos.x, a_RelBlockPos.y, a_RelBlockPos.z, a_BlockType, a_BlockMeta ); } - /// Queues a block change till the specified world tick + /** Queues a block change till the specified world tick */ void QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType = E_BLOCK_AIR); - /// Queues block for ticking (m_ToTickQueue) + /** Queues block for ticking (m_ToTickQueue) */ void QueueTickBlock(int a_RelX, int a_RelY, int a_RelZ); - /// Queues all 6 neighbors of the specified block for ticking (m_ToTickQueue). If any are outside the chunk, relays the checking to the proper neighboring chunk + /** Queues all 6 neighbors of the specified block for ticking (m_ToTickQueue). If any are outside the chunk, relays the checking to the proper neighboring chunk */ void QueueTickBlockNeighbors(int a_RelX, int a_RelY, int a_RelZ); void FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta ); // Doesn't force block updates on neighbors, use for simple changes such as grass growing etc. @@ -175,14 +177,14 @@ public: void CollectPickupsByPlayer(cPlayer * a_Player); - /// Sets the sign text. Returns true if successful. Also sends update packets to all clients in the chunk + /** Sets the sign text. Returns true if successful. Also sends update packets to all clients in the chunk */ bool SetSignLines(int a_RelX, int a_RelY, int a_RelZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); int GetHeight( int a_X, int a_Z ); void SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_Client); - /// Adds a client to the chunk; returns true if added, false if already there + /** Adds a client to the chunk; returns true if added, false if already there */ bool AddClient (cClientHandle* a_Client ); void RemoveClient (cClientHandle* a_Client ); @@ -193,55 +195,55 @@ public: void RemoveEntity(cEntity * a_Entity); bool HasEntity(int a_EntityID); - /// Calls the callback for each entity; returns true if all entities processed, false if the callback aborted by returning true + /** Calls the callback for each entity; returns true if all entities processed, false if the callback aborted by returning true */ bool ForEachEntity(cEntityCallback & a_Callback); // Lua-accessible - /// Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found. + /** Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found. */ bool DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackResult); // Lua-accessible - /// Calls the callback for each block entity; returns true if all block entities processed, false if the callback aborted by returning true + /** Calls the callback for each block entity; returns true if all block entities processed, false if the callback aborted by returning true */ bool ForEachBlockEntity(cBlockEntityCallback & a_Callback); // Lua-accessible - /// Calls the callback for each chest; returns true if all chests processed, false if the callback aborted by returning true + /** Calls the callback for each chest; returns true if all chests processed, false if the callback aborted by returning true */ bool ForEachChest(cChestCallback & a_Callback); // Lua-accessible - /// Calls the callback for each dispenser; returns true if all dispensers processed, false if the callback aborted by returning true + /** Calls the callback for each dispenser; returns true if all dispensers processed, false if the callback aborted by returning true */ bool ForEachDispenser(cDispenserCallback & a_Callback); - /// Calls the callback for each dropper; returns true if all droppers processed, false if the callback aborted by returning true + /** Calls the callback for each dropper; returns true if all droppers processed, false if the callback aborted by returning true */ bool ForEachDropper(cDropperCallback & a_Callback); - /// Calls the callback for each dropspenser; returns true if all dropspensers processed, false if the callback aborted by returning true + /** Calls the callback for each dropspenser; returns true if all dropspensers processed, false if the callback aborted by returning true */ bool ForEachDropSpenser(cDropSpenserCallback & a_Callback); - /// Calls the callback for each furnace; returns true if all furnaces processed, false if the callback aborted by returning true + /** Calls the callback for each furnace; returns true if all furnaces processed, false if the callback aborted by returning true */ bool ForEachFurnace(cFurnaceCallback & a_Callback); // Lua-accessible - /// Calls the callback for the block entity at the specified coords; returns false if there's no block entity at those coords, true if found + /** Calls the callback for the block entity at the specified coords; returns false if there's no block entity at those coords, true if found */ bool DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback); // Lua-acessible - /// Calls the callback for the chest at the specified coords; returns false if there's no chest at those coords, true if found + /** Calls the callback for the chest at the specified coords; returns false if there's no chest at those coords, true if found */ bool DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Lua-acessible - /// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords or callback returns true, returns true if found + /** Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords or callback returns true, returns true if found */ bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); - /// Calls the callback for the dispenser at the specified coords; returns false if there's no dropper at those coords or callback returns true, returns true if found + /** Calls the callback for the dispenser at the specified coords; returns false if there's no dropper at those coords or callback returns true, returns true if found */ bool DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback); - /// Calls the callback for the dispenser at the specified coords; returns false if there's no dropspenser at those coords or callback returns true, returns true if found + /** Calls the callback for the dispenser at the specified coords; returns false if there's no dropspenser at those coords or callback returns true, returns true if found */ bool DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback); - /// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords or callback returns true, returns true if found + /** Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords or callback returns true, returns true if found */ bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Lua-accessible - /// Calls the callback for the noteblock at the specified coords; returns false if there's no noteblock at those coords or callback returns true, returns true if found + /** Calls the callback for the noteblock at the specified coords; returns false if there's no noteblock at those coords or callback returns true, returns true if found */ bool DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBlockCallback & a_Callback); - /// Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found + /** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */ bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); - /// Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found + /** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */ bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible void UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z); // [x, y, z] in world block coords @@ -292,7 +294,7 @@ public: m_IsSaving = false; } - /// Sets the blockticking to start at the specified block. Only one blocktick may be set, second call overwrites the first call + /** Sets the blockticking to start at the specified block. Only one blocktick may be set, second call overwrites the first call */ inline void SetNextBlockTick(int a_RelX, int a_RelY, int a_RelZ) { m_BlockTickX = a_RelX; @@ -310,34 +312,34 @@ public: inline NIBBLETYPE GetBlockLight(int a_Idx) const {return cChunkDef::GetNibble(m_BlockLight, a_Idx); } inline NIBBLETYPE GetSkyLight (int a_Idx) const {return cChunkDef::GetNibble(m_BlockSkyLight, a_Idx); } - /// Same as GetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success + /** Same as GetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */ bool UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const; - /// Same as GetBlockType(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success + /** Same as GetBlockType(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */ bool UnboundedRelGetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType) const; - /// Same as GetBlockMeta(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success + /** Same as GetBlockMeta(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */ bool UnboundedRelGetBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockMeta) const; - /// Same as GetBlockBlockLight(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success + /** Same as GetBlockBlockLight(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */ bool UnboundedRelGetBlockBlockLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockLight) const; - /// Same as GetBlockSkyLight(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success + /** Same as GetBlockSkyLight(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */ bool UnboundedRelGetBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_SkyLight) const; - /// Queries both BlockLight and SkyLight, relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success + /** Queries both BlockLight and SkyLight, relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */ bool UnboundedRelGetBlockLights(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockLight, NIBBLETYPE & a_SkyLight) const; - /// Same as SetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success + /** Same as SetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */ bool UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - /// Same as FastSetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success + /** Same as FastSetBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s or m_ChunkMap in such a case); returns true on success */ bool UnboundedRelFastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - /// Same as QueueTickBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s in such a case), ignores unsuccessful attempts + /** Same as QueueTickBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s in such a case), ignores unsuccessful attempts */ void UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ); - /// Light alterations based on time + /** Light alterations based on time */ NIBBLETYPE GetTimeAlteredLight(NIBBLETYPE a_Skylight) const; @@ -389,7 +391,7 @@ private: cEntityList m_Entities; cBlockEntityList m_BlockEntities; - /// Number of times the chunk has been requested to stay (by various cChunkStay objects); if zero, the chunk can be unloaded + /** Number of times the chunk has been requested to stay (by various cChunkStay objects); if zero, the chunk can be unloaded */ int m_StayCount; int m_PosX, m_PosY, m_PosZ; @@ -427,40 +429,40 @@ private: void RemoveBlockEntity(cBlockEntity * a_BlockEntity); void AddBlockEntity (cBlockEntity * a_BlockEntity); - /// Creates a block entity for each block that needs a block entity and doesn't have one in the list + /** Creates a block entity for each block that needs a block entity and doesn't have one in the list */ void CreateBlockEntities(void); - /// Wakes up each simulator for its specific blocks; through all the blocks in the chunk + /** Wakes up each simulator for its specific blocks; through all the blocks in the chunk */ void WakeUpSimulators(void); // Makes a copy of the list cClientHandleList GetAllClients(void) const {return m_LoadedByClient; } - /// Sends m_PendingSendBlocks to all clients + /** Sends m_PendingSendBlocks to all clients */ void BroadcastPendingBlockChanges(void); - /// Checks the block scheduled for checking in m_ToTickBlocks[] + /** Checks the block scheduled for checking in m_ToTickBlocks[] */ void CheckBlocks(); - /// Ticks several random blocks in the chunk + /** Ticks several random blocks in the chunk */ void TickBlocks(void); - /// Adds snow to the top of snowy biomes and hydrates farmland / fills cauldrons in rainy biomes + /** Adds snow to the top of snowy biomes and hydrates farmland / fills cauldrons in rainy biomes */ void ApplyWeatherToTop(void); - /// Grows sugarcane by the specified number of blocks, but no more than 3 blocks high (used by both bonemeal and ticking) + /** Grows sugarcane by the specified number of blocks, but no more than 3 blocks high (used by both bonemeal and ticking) */ void GrowSugarcane (int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks); - /// Grows cactus by the specified number of blocks, but no more than 3 blocks high (used by both bonemeal and ticking) + /** Grows cactus by the specified number of blocks, but no more than 3 blocks high (used by both bonemeal and ticking) */ void GrowCactus (int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks); - /// Grows a melon or a pumpkin next to the block specified (assumed to be the stem) + /** Grows a melon or a pumpkin next to the block specified (assumed to be the stem) */ void GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, MTRand & a_Random); - /// Called by Tick() when an entity moves out of this chunk into a neighbor; moves the entity and sends spawn / despawn packet to clients + /** Called by Tick() when an entity moves out of this chunk into a neighbor; moves the entity and sends spawn / despawn packet to clients */ void MoveEntityToNewChunk(cEntity * a_Entity); - /// Processes all blocks that have been scheduled for replacement by the QueueSetBlock() function + /** Processes all blocks that have been scheduled for replacement by the QueueSetBlock() function */ void ProcessQueuedSetBlocks(void); }; -- cgit v1.2.3 From 6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 15 Feb 2014 15:51:49 +0000 Subject: Sizeable speed improvements to redstone + Moved all simulator data into individual chunks * Cleaned up parameters for functions and some code * Fixed repeaters powering off faster than they power on The main issue before was that, although the redstone simulator stored blocks to be simulated in individual cChunks, other data, such as powered lists, and etcetera, were global regardless of which chunk was being simulated. Therefore, with worlds with lots of redstone, each tick saw the ticking of chunks, which themselves iterated through the entire dataset needlessly, creating LOTS of lag. Should be better now :) --- src/Chunk.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 93eba217e..696690068 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -343,12 +343,17 @@ public: NIBBLETYPE GetTimeAlteredLight(NIBBLETYPE a_Skylight) const; - // Simulator data: + // Per-chunk simulator data: cFireSimulatorChunkData & GetFireSimulatorData (void) { return m_FireSimulatorData; } cFluidSimulatorData * GetWaterSimulatorData(void) { return m_WaterSimulatorData; } cFluidSimulatorData * GetLavaSimulatorData (void) { return m_LavaSimulatorData; } cSandSimulatorChunkData & GetSandSimulatorData (void) { return m_SandSimulatorData; } - cRedstoneSimulatorChunkData & GetRedstoneSimulatorData(void) { return m_RedstoneSimulatorData; } + + cRedstoneSimulatorChunkData * GetRedstoneSimulatorData(void) { return &m_RedstoneSimulatorData; } + cIncrementalRedstoneSimulator::PoweredBlocksList * GetRedstoneSimulatorPoweredBlocksList(void) { return &m_RedstoneSimulatorPoweredBlocksList; } + cIncrementalRedstoneSimulator::LinkedBlocksList * GetRedstoneSimulatorLinkedBlocksList(void) { return &m_RedstoneSimulatorLinkedBlocksList; }; + cIncrementalRedstoneSimulator::SimulatedPlayerToggleableList * GetRedstoneSimulatorSimulatedPlayerToggleableList(void) { return &m_RedstoneSimulatorSimulatedPlayerToggleableList; }; + cIncrementalRedstoneSimulator::RepeatersDelayList * GetRedstoneSimulatorRepeatersDelayList(void) { return &m_RedstoneSimulatorRepeatersDelayList; }; cBlockEntity * GetBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ); cBlockEntity * GetBlockEntity(const Vector3i & a_BlockPos) { return GetBlockEntity(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z); } @@ -419,7 +424,12 @@ private: cFluidSimulatorData * m_WaterSimulatorData; cFluidSimulatorData * m_LavaSimulatorData; cSandSimulatorChunkData m_SandSimulatorData; + cRedstoneSimulatorChunkData m_RedstoneSimulatorData; + cIncrementalRedstoneSimulator::PoweredBlocksList m_RedstoneSimulatorPoweredBlocksList; + cIncrementalRedstoneSimulator::LinkedBlocksList m_RedstoneSimulatorLinkedBlocksList; + cIncrementalRedstoneSimulator::SimulatedPlayerToggleableList m_RedstoneSimulatorSimulatedPlayerToggleableList; + cIncrementalRedstoneSimulator::RepeatersDelayList m_RedstoneSimulatorRepeatersDelayList; // pick up a random block of this chunk -- cgit v1.2.3 From 803ea412361ee2f4b1d74a811ddbee05f50c9345 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 18 Feb 2014 13:06:18 +0100 Subject: Added cWorld:SetAreaBiome() API function. Fixes #675. --- src/Chunk.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 696690068..682ec6170 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -175,6 +175,14 @@ public: EMCSBiome GetBiomeAt(int a_RelX, int a_RelZ) const {return cChunkDef::GetBiome(m_BiomeMap, a_RelX, a_RelZ); } + /** Sets the biome at the specified relative coords. + Doesn't resend the chunk to clients. */ + void SetBiomeAt(int a_RelX, int a_RelZ, EMCSBiome a_Biome); + + /** Sets the biome in the specified relative coords area. All the coords are inclusive. + Sends the chunk to all relevant clients. */ + void SetAreaBiome(int a_MinRelX, int a_MaxRelX, int a_MinRelZ, int a_MaxRelZ, EMCSBiome a_Biome); + void CollectPickupsByPlayer(cPlayer * a_Player); /** Sets the sign text. Returns true if successful. Also sends update packets to all clients in the chunk */ -- cgit v1.2.3 From 52c41f886927cf62ed592ba7fec974eee6b16844 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 18 Feb 2014 21:40:02 +0100 Subject: Add Heads completely --- src/Chunk.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 696690068..27388deb4 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -31,6 +31,7 @@ class cChestEntity; class cDispenserEntity; class cFurnaceEntity; class cNoteEntity; +class cSkullEntity; class cBlockArea; class cPawn; class cPickup; @@ -47,6 +48,7 @@ typedef cItemCallback cDispenserCallback; typedef cItemCallback cFurnaceCallback; typedef cItemCallback cNoteBlockCallback; typedef cItemCallback cCommandBlockCallback; +typedef cItemCallback cSkullBlockCallback; @@ -241,7 +243,10 @@ public: bool DoWithNoteBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cNoteBlockCallback & a_Callback); /** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */ - bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); + bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); + + /** Calls the callback for the skull block at the specified coords; returns false if there's no skull block at those coords or callback returns true, returns true if found */ + bool DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & a_Callback); /** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */ bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible -- cgit v1.2.3 From d63ce62f3bbe4b8e89b8c54af4b71d77bcc7e052 Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 19 Feb 2014 14:45:09 +0100 Subject: Rename SkullEntity to MobHeadEntity --- src/Chunk.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 27388deb4..6bec60813 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -31,7 +31,7 @@ class cChestEntity; class cDispenserEntity; class cFurnaceEntity; class cNoteEntity; -class cSkullEntity; +class cMobHeadEntity; class cBlockArea; class cPawn; class cPickup; @@ -48,7 +48,7 @@ typedef cItemCallback cDispenserCallback; typedef cItemCallback cFurnaceCallback; typedef cItemCallback cNoteBlockCallback; typedef cItemCallback cCommandBlockCallback; -typedef cItemCallback cSkullBlockCallback; +typedef cItemCallback cMobHeadBlockCallback; @@ -245,8 +245,8 @@ public: /** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */ bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); - /** Calls the callback for the skull block at the specified coords; returns false if there's no skull block at those coords or callback returns true, returns true if found */ - bool DoWithSkullBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cSkullBlockCallback & a_Callback); + /** Calls the callback for the mob head block at the specified coords; returns false if there's no mob header block at those coords or callback returns true, returns true if found */ + bool DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback); /** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */ bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible -- cgit v1.2.3 From 31d15f865456dd0419e5c765498344fdd99cf179 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 24 Feb 2014 09:34:20 +0100 Subject: Removed an unused member variable from cChunk. --- src/Chunk.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 1b7a6fa07..c9e9697ca 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -405,7 +405,6 @@ private: // A critical section is not needed, because all chunk access is protected by its parent ChunkMap's csLayers cClientHandleList m_LoadedByClient; - cClientHandleList m_UnloadQuery; cEntityList m_Entities; cBlockEntityList m_BlockEntities; -- cgit v1.2.3 From 787a71929cd4095681b37acf81332b7b9c3ddf89 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 7 Mar 2014 01:30:34 +0100 Subject: Add Flower Pots --- src/Chunk.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index c9e9697ca..e8b46f631 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -32,6 +32,7 @@ class cDispenserEntity; class cFurnaceEntity; class cNoteEntity; class cMobHeadEntity; +class cFlowerPotEntity; class cBlockArea; class cPawn; class cPickup; @@ -49,6 +50,7 @@ typedef cItemCallback cFurnaceCallback; typedef cItemCallback cNoteBlockCallback; typedef cItemCallback cCommandBlockCallback; typedef cItemCallback cMobHeadBlockCallback; +typedef cItemCallback cFlowerPotCallback; @@ -253,9 +255,12 @@ public: /** Calls the callback for the command block at the specified coords; returns false if there's no command block at those coords or callback returns true, returns true if found */ bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); - /** Calls the callback for the mob head block at the specified coords; returns false if there's no mob header block at those coords or callback returns true, returns true if found */ + /** Calls the callback for the mob head block at the specified coords; returns false if there's no mob head block at those coords or callback returns true, returns true if found */ bool DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback); + /** Calls the callback for the flower pot at the specified coords; returns false if there's no flower pot at those coords or callback returns true, returns true if found */ + bool DoWithFlowerPotAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFlowerPotCallback & a_Callback); + /** Retrieves the test on the sign at the specified coords; returns false if there's no sign at those coords, true if found */ bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible -- cgit v1.2.3 From c2090c0d11313bd67b02c482f1ca80d5c4567d27 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 7 Mar 2014 11:44:16 +0100 Subject: Add Lua Bindings for FlowerPotEntity.h and add documentation. --- src/Chunk.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index e8b46f631..b3fa563cc 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -49,7 +49,7 @@ typedef cItemCallback cDispenserCallback; typedef cItemCallback cFurnaceCallback; typedef cItemCallback cNoteBlockCallback; typedef cItemCallback cCommandBlockCallback; -typedef cItemCallback cMobHeadBlockCallback; +typedef cItemCallback cMobHeadCallback; typedef cItemCallback cFlowerPotCallback; @@ -256,7 +256,7 @@ public: bool DoWithCommandBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cCommandBlockCallback & a_Callback); /** Calls the callback for the mob head block at the specified coords; returns false if there's no mob head block at those coords or callback returns true, returns true if found */ - bool DoWithMobHeadBlockAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadBlockCallback & a_Callback); + bool DoWithMobHeadAt(int a_BlockX, int a_BlockY, int a_BlockZ, cMobHeadCallback & a_Callback); /** Calls the callback for the flower pot at the specified coords; returns false if there's no flower pot at those coords or callback returns true, returns true if found */ bool DoWithFlowerPotAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFlowerPotCallback & a_Callback); -- cgit v1.2.3