diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-02-02 15:49:37 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-02-02 15:49:37 +0100 |
commit | b82fc394dd2a40e12e3c13709fea26c2435792c9 (patch) | |
tree | a310eb96470c3651480c5899a36955f87800bee8 /src/Blocks | |
parent | Changed Signiture of OnDigging (diff) | |
download | cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.gz cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.bz2 cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.lz cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.xz cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.tar.zst cuberite-b82fc394dd2a40e12e3c13709fea26c2435792c9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/BlockCactus.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockCrops.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockDirt.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockFarmland.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockFluid.h | 6 | ||||
-rw-r--r-- | src/Blocks/BlockHandler.cpp | 14 | ||||
-rw-r--r-- | src/Blocks/BlockHandler.h | 7 | ||||
-rw-r--r-- | src/Blocks/BlockLeaves.h | 6 | ||||
-rw-r--r-- | src/Blocks/BlockNetherWart.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockSapling.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockStems.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockSugarcane.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockVine.h | 4 |
13 files changed, 27 insertions, 26 deletions
diff --git a/src/Blocks/BlockCactus.h b/src/Blocks/BlockCactus.h index 70c9c5257..83595d2b9 100644 --- a/src/Blocks/BlockCactus.h +++ b/src/Blocks/BlockCactus.h @@ -65,7 +65,7 @@ public: } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { a_Chunk.GetWorld()->GrowCactus(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1); } diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h index c86183ca4..4c4ac21be 100644 --- a/src/Blocks/BlockCrops.h +++ b/src/Blocks/BlockCrops.h @@ -74,7 +74,7 @@ public: } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { NIBBLETYPE Meta = a_Chunk.GetMeta (a_RelX, a_RelY, a_RelZ); NIBBLETYPE Light = a_Chunk.GetBlockLight(a_RelX, a_RelY, a_RelZ); diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h index 1cc6bc0c3..91534c5e5 100644 --- a/src/Blocks/BlockDirt.h +++ b/src/Blocks/BlockDirt.h @@ -25,7 +25,7 @@ public: } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { if (m_BlockType != E_BLOCK_GRASS) { diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h index a69d9b775..101ab8e34 100644 --- a/src/Blocks/BlockFarmland.h +++ b/src/Blocks/BlockFarmland.h @@ -28,7 +28,7 @@ public: } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { bool Found = false; diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index fbdbec26c..37885e4de 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -32,7 +32,7 @@ public: } - virtual void Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override + virtual void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override { switch (m_BlockType) { @@ -47,7 +47,7 @@ public: break; } } - super::Check(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk); + super::Check(a_ChunkInterface, a_PluginInterface, a_RelX, a_RelY, a_RelZ, a_Chunk); } } ; @@ -68,7 +68,7 @@ public: /// Called to tick the block - virtual void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { if (a_Chunk.GetWorld()->ShouldLavaSpawnFire()) { diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 8ce8ec1f7..3f69ba1c1 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -261,7 +261,7 @@ bool cBlockHandler::GetPlacementBlockTypeMeta( -void cBlockHandler::OnUpdate(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ) +void cBlockHandler::OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ) { } @@ -361,14 +361,14 @@ void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) -void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ) +void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ) { cItems Pickups; - NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); + NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); ConvertToPickups(Pickups, Meta); // Allow plugins to modify the pickups: - cRoot::Get()->GetPluginManager()->CallHookBlockToPickups(a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups); + a_BlockPluginInterface.CallHookBlockToPickups(a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups); if (!Pickups.empty()) { @@ -384,7 +384,7 @@ void cBlockHandler::DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX MicroX += r1.rand(1) - 0.5; MicroZ += r1.rand(1) - 0.5; - a_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ); + a_WorldInterface.SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ); } } @@ -446,7 +446,7 @@ bool cBlockHandler::DoesDropOnUnsuitable(void) -void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) +void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) { if (!CanBeAt(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk)) { @@ -454,7 +454,7 @@ void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_ { int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width; int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; - DropBlock(a_Chunk.GetWorld(), NULL, BlockX, a_RelY, BlockZ); + DropBlock(a_ChunkInterface, *a_Chunk.GetWorld(), a_PluginInterface, NULL, BlockX, a_RelY, BlockZ); } a_Chunk.SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0); diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 867c4c2c5..44b15bce1 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -5,6 +5,7 @@ #include "../Item.h" #include "WorldInterface.h" #include "ChunkInterface.h" +#include "BlockPluginInterface.h" @@ -25,7 +26,7 @@ public: /// Called when the block gets ticked either by a random tick or by a queued tick. /// Note that the coords are chunk-relative! - virtual void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ); + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ); /** Called before a block is placed into a world. The handler should return true to allow placement, false to refuse. @@ -72,7 +73,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta); /// Handles the dropping of a block based on what ConvertToDrops() returns. This will not destroy the block. a_Digger is the entity causing the drop; it may be NULL - virtual void DropBlock(cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ); + virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ); /// Returns step sound name of block virtual const char * GetStepSound(void); @@ -113,7 +114,7 @@ public: By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()), and wakes up all simulators on the block. */ - virtual void Check(cChunkInterface & ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk); + virtual void Check(cChunkInterface & ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk); /// <summary>Rotates a given block meta counter-clockwise. Default: no change</summary> /// <returns>Block meta following rotation</returns> diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 069849361..ad6e440e2 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -77,7 +77,7 @@ public: } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + 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 { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); if ((Meta & 0x04) != 0) @@ -116,8 +116,8 @@ public: } // Decay the leaves: - DropBlock(a_Chunk.GetWorld(), NULL, BlockX, a_RelY, BlockZ); - a_Chunk.GetWorld()->DigBlock(BlockX, a_RelY, BlockZ); + DropBlock(a_ChunkInterface, a_WorldInterface, a_PluginInterface, NULL, BlockX, a_RelY, BlockZ); + a_ChunkInterface.DigBlock(a_WorldInterface, BlockX, a_RelY, BlockZ); } diff --git a/src/Blocks/BlockNetherWart.h b/src/Blocks/BlockNetherWart.h index 937d2b4b5..923180e19 100644 --- a/src/Blocks/BlockNetherWart.h +++ b/src/Blocks/BlockNetherWart.h @@ -35,7 +35,7 @@ public: } } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { NIBBLETYPE Meta = a_Chunk.GetMeta (a_RelX, a_RelY, a_RelZ); diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h index 3d6e58438..3d925029a 100644 --- a/src/Blocks/BlockSapling.h +++ b/src/Blocks/BlockSapling.h @@ -31,7 +31,7 @@ public: } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); diff --git a/src/Blocks/BlockStems.h b/src/Blocks/BlockStems.h index ed18817b2..705436345 100644 --- a/src/Blocks/BlockStems.h +++ b/src/Blocks/BlockStems.h @@ -24,7 +24,7 @@ public: } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); if (Meta >= 7) diff --git a/src/Blocks/BlockSugarcane.h b/src/Blocks/BlockSugarcane.h index 59314e37d..84d3b2e7d 100644 --- a/src/Blocks/BlockSugarcane.h +++ b/src/Blocks/BlockSugarcane.h @@ -73,7 +73,7 @@ public: } - void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { a_Chunk.GetWorld()->GrowSugarcane(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1); } diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h index aa29849b2..aa0d582b3 100644 --- a/src/Blocks/BlockVine.h +++ b/src/Blocks/BlockVine.h @@ -105,7 +105,7 @@ public: } - void Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override + void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override { NIBBLETYPE CurMeta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); NIBBLETYPE MaxMeta = GetMaxMeta(a_Chunk, a_RelX, a_RelY, a_RelZ); @@ -128,7 +128,7 @@ public: { int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width; int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; - DropBlock(a_Chunk.GetWorld(), NULL, BlockX, a_RelY, BlockZ); + DropBlock(a_ChunkInterface, *a_Chunk.GetWorld(), a_PluginInterface, NULL, BlockX, a_RelY, BlockZ); } a_Chunk.SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0); return; |