From ca6ef58b1ee8521e4b940ee4883dee714960e413 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Fri, 5 Feb 2016 23:45:45 +0200 Subject: Bulk clearing of whitespace --- src/Blocks/BlockAnvil.h | 4 ++-- src/Blocks/BlockBed.h | 4 ++-- src/Blocks/BlockBigFlower.h | 6 +++--- src/Blocks/BlockButton.h | 8 ++++---- src/Blocks/BlockCake.h | 4 ++-- src/Blocks/BlockCarpet.h | 4 ++-- src/Blocks/BlockChest.h | 16 +++++++-------- src/Blocks/BlockComparator.h | 4 ++-- src/Blocks/BlockCrops.h | 2 +- src/Blocks/BlockDirt.h | 12 +++++------ src/Blocks/BlockDoor.cpp | 4 ++-- src/Blocks/BlockDoor.h | 6 +++--- src/Blocks/BlockDropSpenser.h | 4 ++-- src/Blocks/BlockEnderchest.h | 2 +- src/Blocks/BlockEntity.h | 4 ++-- src/Blocks/BlockFenceGate.h | 2 +- src/Blocks/BlockFire.h | 2 +- src/Blocks/BlockFluid.h | 16 +++++++-------- src/Blocks/BlockFurnace.h | 6 +++--- src/Blocks/BlockHandler.cpp | 10 ++++----- src/Blocks/BlockHandler.h | 42 +++++++++++++++++++------------------- src/Blocks/BlockHopper.h | 2 +- src/Blocks/BlockIce.h | 4 ++-- src/Blocks/BlockLadder.h | 2 +- src/Blocks/BlockLeaves.h | 4 ++-- src/Blocks/BlockLever.h | 8 ++++---- src/Blocks/BlockMelon.h | 2 +- src/Blocks/BlockMobHead.h | 4 ++-- src/Blocks/BlockMobSpawner.h | 4 ++-- src/Blocks/BlockMushroom.h | 4 ++-- src/Blocks/BlockPiston.h | 10 ++++----- src/Blocks/BlockPlanks.h | 2 +- src/Blocks/BlockPluginInterface.h | 2 +- src/Blocks/BlockPortal.h | 2 +- src/Blocks/BlockPumpkin.h | 4 ++-- src/Blocks/BlockRail.h | 30 +++++++++++++-------------- src/Blocks/BlockRedstone.h | 2 +- src/Blocks/BlockRedstoneLamp.h | 2 +- src/Blocks/BlockRedstoneRepeater.h | 2 +- src/Blocks/BlockSapling.h | 6 +++--- src/Blocks/BlockSideways.h | 2 +- src/Blocks/BlockSignPost.h | 6 +++--- src/Blocks/BlockSlab.h | 10 ++++----- src/Blocks/BlockSlime.h | 2 +- src/Blocks/BlockSnow.h | 8 ++++---- src/Blocks/BlockStems.h | 2 +- src/Blocks/BlockSugarcane.h | 2 +- src/Blocks/BlockTorch.h | 4 ++-- src/Blocks/BlockTrapdoor.h | 2 +- src/Blocks/BlockVine.h | 8 ++++---- src/Blocks/BlockWorkbench.h | 2 +- src/Blocks/BroadcastInterface.h | 2 +- src/Blocks/ChunkInterface.h | 16 +++++++-------- src/Blocks/ClearMetaOnDrop.h | 2 +- src/Blocks/MetaRotator.h | 2 +- src/Blocks/WorldInterface.h | 14 ++++++------- 56 files changed, 171 insertions(+), 171 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockAnvil.h b/src/Blocks/BlockAnvil.h index 539316682..28718e316 100644 --- a/src/Blocks/BlockAnvil.h +++ b/src/Blocks/BlockAnvil.h @@ -18,7 +18,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { a_Pickups.push_back(cItem(E_BLOCK_ANVIL, 1, a_BlockMeta >> 2)); @@ -30,7 +30,7 @@ public: a_Player->OpenWindow(Window); return true; } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, diff --git a/src/Blocks/BlockBed.h b/src/Blocks/BlockBed.h index c104a7cb5..cfb02ceeb 100644 --- a/src/Blocks/BlockBed.h +++ b/src/Blocks/BlockBed.h @@ -21,7 +21,7 @@ public: : cMetaRotator(a_BlockType) { } - + virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override; virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override; @@ -29,7 +29,7 @@ public: { return true; } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { // Reset meta to zero diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index b1aec7385..7a70a7a6b 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -34,12 +34,12 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { NIBBLETYPE Meta = a_BlockMeta & 0x7; - + if ((Meta == E_META_BIG_FLOWER_DOUBLE_TALL_GRASS) || (Meta == E_META_BIG_FLOWER_LARGE_FERN)) { return; } - + a_Pickups.push_back(cItem(E_BLOCK_BIG_FLOWER, 1, Meta)); } @@ -50,7 +50,7 @@ public: { Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY - 1, a_BlockZ); } - + NIBBLETYPE FlowerMeta = Meta & 0x7; if (!a_Player->IsGameModeCreative()) { diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 354d563fd..b67ae7c97 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -15,11 +15,11 @@ public: : cMetaRotator(a_BlockType) { } - + virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - + double x(a_BlockX); double y(a_BlockY); double z(a_BlockZ); @@ -53,7 +53,7 @@ public: return true; } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { // Reset meta to 0 @@ -64,7 +64,7 @@ public: { return true; } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, diff --git a/src/Blocks/BlockCake.h b/src/Blocks/BlockCake.h index 7c7208b05..88af210a2 100644 --- a/src/Blocks/BlockCake.h +++ b/src/Blocks/BlockCake.h @@ -14,7 +14,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); @@ -23,7 +23,7 @@ public: { return false; } - + if (Meta >= 5) { a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); diff --git a/src/Blocks/BlockCarpet.h b/src/Blocks/BlockCarpet.h index 19be882d0..aa3de131d 100644 --- a/src/Blocks/BlockCarpet.h +++ b/src/Blocks/BlockCarpet.h @@ -22,7 +22,7 @@ public: cBlockHandler(a_BlockType) { } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -34,7 +34,7 @@ public: a_BlockMeta = a_Player->GetEquippedItem().m_ItemDamage & 0x0f; return true; } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { a_Pickups.push_back(cItem(E_BLOCK_CARPET, 1, a_BlockMeta)); diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h index df87ca4c7..2c34beeeb 100644 --- a/src/Blocks/BlockChest.h +++ b/src/Blocks/BlockChest.h @@ -18,7 +18,7 @@ public: : cMetaRotator(a_BlockType) { } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -27,14 +27,14 @@ public: ) override { a_BlockType = m_BlockType; - + // Is there a doublechest already next to this block? if (!CanBeAt(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ)) { // Yup, cannot form a triple-chest, refuse: return false; } - + // Check if this forms a doublechest, if so, need to adjust the meta: cBlockArea Area; if (!Area.Read(&a_ChunkInterface, a_BlockX - 1, a_BlockX + 1, a_BlockY, a_BlockY, a_BlockZ - 1, a_BlockZ + 1)) @@ -59,7 +59,7 @@ public: a_BlockMeta = (yaw < 0) ? 4 : 5; return true; } - + // Single chest, get meta from rotation only a_BlockMeta = PlayerYawToMetaData(yaw); return true; @@ -71,7 +71,7 @@ public: int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; return CanBeAt(a_ChunkInterface, BlockX, a_RelY, BlockZ); } - + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) { cBlockArea Area; @@ -80,7 +80,7 @@ public: // Cannot read the surroundings, probably at the edge of loaded chunks. Disallow. return false; } - + int NumChestNeighbors = 0; if (Area.GetRelBlockType(1, 0, 2) == m_BlockType) { @@ -136,7 +136,7 @@ public: } return (NumChestNeighbors < 2); } - + /** Translates player yaw when placing a chest into the chest block metadata. Valid for single chests only */ static NIBBLETYPE PlayerYawToMetaData(double a_Yaw) { @@ -163,7 +163,7 @@ public: return 0x03; } } - + /** If there's a chest in the a_Area in the specified coords, modifies its meta to a_NewMeta and returns true. */ bool CheckAndAdjustNeighbor(cChunkInterface & a_ChunkInterface, const cBlockArea & a_Area, int a_RelX, int a_RelZ, NIBBLETYPE a_NewMeta) { diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h index 8f1822299..394b53a15 100644 --- a/src/Blocks/BlockComparator.h +++ b/src/Blocks/BlockComparator.h @@ -17,7 +17,7 @@ public: : cMetaRotator(a_BlockType) { } - + virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); @@ -42,7 +42,7 @@ public: { return true; } - + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR)); diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h index 0751d19f0..cc18a2b18 100644 --- a/src/Blocks/BlockCrops.h +++ b/src/Blocks/BlockCrops.h @@ -72,7 +72,7 @@ public: } } } - + 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/BlockDirt.h b/src/Blocks/BlockDirt.h index 813ff5b24..336fa8c51 100644 --- a/src/Blocks/BlockDirt.h +++ b/src/Blocks/BlockDirt.h @@ -20,7 +20,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { if (a_BlockMeta == E_META_DIRT_COARSE) @@ -33,7 +33,7 @@ public: a_Pickups.Add(E_BLOCK_DIRT, 1, E_META_DIRT_NORMAL); } } - + 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) @@ -50,21 +50,21 @@ public: else if ((a_RelY < cChunkDef::Height - 1)) { BLOCKTYPE above = a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ); - + // Grass turns back to dirt when the block above is not transparent if (!cBlockInfo::IsTransparent(above)) { a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_DIRT, E_META_DIRT_NORMAL); return; } - + NIBBLETYPE light = std::max(a_Chunk.GetBlockLight(a_RelX, a_RelY + 1, a_RelZ), a_Chunk.GetTimeAlteredLight(a_Chunk.GetSkyLight(a_RelX, a_RelY + 1, a_RelZ))); // Source block is not bright enough to spread if (light < 9) { return; } - + } // Grass spreads to adjacent dirt blocks: @@ -74,7 +74,7 @@ public: int OfsX = rand.NextInt(3) - 1; // [-1 .. 1] int OfsY = rand.NextInt(5) - 3; // [-3 .. 1] int OfsZ = rand.NextInt(3) - 1; // [-1 .. 1] - + BLOCKTYPE DestBlock; NIBBLETYPE DestMeta; if (!cChunkDef::IsValidHeight(a_RelY + OfsY)) diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp index 94c49a4b8..6dae5a34d 100644 --- a/src/Blocks/BlockDoor.cpp +++ b/src/Blocks/BlockDoor.cpp @@ -86,10 +86,10 @@ bool cBlockDoorHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterfac void cBlockDoorHandler::OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) { UNUSED(a_ChunkInterface); - + a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - + if (Meta & 0x8) { // Current block is top of the door diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h index a5f2c61c3..a19cbdc40 100644 --- a/src/Blocks/BlockDoor.h +++ b/src/Blocks/BlockDoor.h @@ -46,7 +46,7 @@ public: { return false; } - + a_BlockType = m_BlockType; a_BlockMeta = PlayerYawToMetaData(a_Player->GetYaw()); return true; @@ -118,7 +118,7 @@ public: { // Vanilla refuses to place doors on transparent blocks, except top-half slabs and other doors // We need to keep the door compatible with itself, otherwise the top half drops while the bottom half stays - + // Doors can be placed on upside-down slabs if (cBlockSlabHandler::IsAnySlabType(a_BlockType) && ((a_BlockMeta & 0x08) != 0)) { @@ -159,7 +159,7 @@ public: inline static NIBBLETYPE PlayerYawToMetaData(double a_Yaw) { ASSERT((a_Yaw >= -180) && (a_Yaw < 180)); - + a_Yaw += 90 + 45; if (a_Yaw > 360) { diff --git a/src/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h index c572d5d34..235d67380 100644 --- a/src/Blocks/BlockDropSpenser.h +++ b/src/Blocks/BlockDropSpenser.h @@ -29,12 +29,12 @@ public: ) override { a_BlockType = m_BlockType; - + // FIXME: Do not use cPiston class for dispenser placement! a_BlockMeta = cBlockPistonHandler::RotationPitchToMetaData(a_Player->GetYaw(), a_Player->GetPitch()); return true; } - + virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override { // Bit 0x08 is a flag. Lowest three bits are position. 0x08 == 1000 diff --git a/src/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h index 0bc67a8f5..b5f015ff4 100644 --- a/src/Blocks/BlockEnderchest.h +++ b/src/Blocks/BlockEnderchest.h @@ -33,7 +33,7 @@ public: a_BlockMeta = RotationToMetaData(a_Player->GetYaw()); return true; } - + static NIBBLETYPE RotationToMetaData(double a_Rotation) { a_Rotation += 90 + 45; // So its not aligned with axis diff --git a/src/Blocks/BlockEntity.h b/src/Blocks/BlockEntity.h index 416e16069..06cd860c5 100644 --- a/src/Blocks/BlockEntity.h +++ b/src/Blocks/BlockEntity.h @@ -14,12 +14,12 @@ public: : cBlockHandler(a_BlockType) { } - + virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { return a_ChunkInterface.UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ); } - + virtual bool IsUseable() override { return true; diff --git a/src/Blocks/BlockFenceGate.h b/src/Blocks/BlockFenceGate.h index 9e7c10cf5..f80502fb8 100644 --- a/src/Blocks/BlockFenceGate.h +++ b/src/Blocks/BlockFenceGate.h @@ -68,7 +68,7 @@ public: inline static NIBBLETYPE PlayerYawToMetaData(double a_Yaw) { ASSERT((a_Yaw >= -180) && (a_Yaw < 180)); - + a_Yaw += 360 + 45; if (a_Yaw > 360) { diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h index d1c8c17c9..346167a26 100644 --- a/src/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h @@ -59,7 +59,7 @@ public: { return 0; } - + for (int newY = Y + 1; newY < cChunkDef::Height; newY++) { BLOCKTYPE Block = a_ChunkInterface.GetBlock(X, newY, Z); diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index 2d9adbab5..df51fb104 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -11,24 +11,24 @@ class cBlockFluidHandler : public cBlockHandler { typedef cBlockHandler super; - + public: cBlockFluidHandler(BLOCKTYPE a_BlockType) : cBlockHandler(a_BlockType) { } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { // No pickups } - + virtual bool DoesIgnoreBuildCollision(void) override { return true; } - + 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) @@ -84,7 +84,7 @@ public: super(a_BlockType) { } - + /** Called to tick the block */ virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { @@ -97,7 +97,7 @@ public: } } } - + /** Tries to start a fire near the lava at given coords. Returns true if fire started. */ static bool TryStartFireNear(int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) { @@ -106,7 +106,7 @@ public: int x = (rnd % 3) - 1; // -1 .. 1 int y = ((rnd / 4) % 4) - 1; // -1 .. 2 int z = ((rnd / 16) % 3) - 1; // -1 .. 1 - + // Check if it's fuel: BLOCKTYPE BlockType; if ( @@ -117,7 +117,7 @@ public: { return false; } - + // Try to set it on fire: static struct { diff --git a/src/Blocks/BlockFurnace.h b/src/Blocks/BlockFurnace.h index a543a26f4..6310458f8 100644 --- a/src/Blocks/BlockFurnace.h +++ b/src/Blocks/BlockFurnace.h @@ -22,7 +22,7 @@ public: { a_Pickups.push_back(cItem(E_BLOCK_FURNACE, 1, 0)); } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -31,10 +31,10 @@ public: ) override { a_BlockType = m_BlockType; - + // FIXME: Do not use cPiston class for furnace placement! a_BlockMeta = cBlockPistonHandler::RotationPitchToMetaData(a_Player->GetYaw(), 0); - + return true; } diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 22b70f590..be254900d 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -136,7 +136,7 @@ public: // CW rotation of a CCW rotation should produce no change in the meta printf("Handler for blocktype %d (%s) fails CW(CCW) rotation test for meta %d: got back %d\n", Type, BlockName.c_str(), Meta, TestMeta); } - + // Test the mirroring: TestMeta = Handler->MetaMirrorXY(Handler->MetaMirrorXY(Meta)); if (TestMeta != Meta) @@ -156,7 +156,7 @@ public: // Double-mirroring should produce the same meta: printf("Handler for blocktype %d (%s) fails YZ mirror test for meta %d: got back %d\n", Type, BlockName.c_str(), Meta, TestMeta); } - + // Test mirror-rotating: TestMeta = Handler->MetaRotateCW(Handler->MetaRotateCW(Handler->MetaMirrorXY(Handler->MetaMirrorYZ(Meta)))); if (TestMeta != Meta) @@ -331,7 +331,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_WOOL: return new cBlockClothHandler (a_BlockType); case E_BLOCK_WORKBENCH: return new cBlockWorkbenchHandler (a_BlockType); case E_BLOCK_YELLOW_FLOWER: return new cBlockFlowerHandler (a_BlockType); - + default: return new cBlockHandler(a_BlockType); } } @@ -512,7 +512,7 @@ void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterfac // Allow plugins to modify the pickups: a_BlockPluginInterface.CallHookBlockToPickups(a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups); - + if (!Pickups.empty()) { MTRand r1; @@ -600,7 +600,7 @@ void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterf int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; DropBlock(a_ChunkInterface, *a_Chunk.GetWorld(), a_PluginInterface, nullptr, BlockX, a_RelY, BlockZ); } - + a_Chunk.SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0); } else diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 41fbc5140..24552fb46 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -23,7 +23,7 @@ class cBlockHandler { public: cBlockHandler(BLOCKTYPE a_BlockType); - + virtual ~cBlockHandler() {} /** Called when the block gets ticked either by a random tick or by a queued tick. @@ -43,71 +43,71 @@ public: /** Called by cWorld::SetBlock() after the block has been set */ virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - + /** Called by cPlayer::PlaceBlocks() for each block after it has been set to the world. Called after OnPlaced(). */ virtual void OnPlacedByPlayer( cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, const sSetBlock & a_BlockChange ); - + /** Called before the player has destroyed a block */ virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ); - + /** Called before a block gets destroyed / replaced with air */ virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ); - + /** Called when a direct neighbor of this block has been changed (The position is the block's own position, not the changing neighbor's position) a_WhichNeighbor indicates which neighbor has changed. For example, BLOCK_FACE_YP meant the neighbor above has changed. BLOCK_FACE_NONE means that it is a neighbor not directly adjacent (diagonal, etc.) */ virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) {} - + /** Notifies the specified neighbor that the current block has changed. a_NeighborXYZ coords are the coords of the neighbor a_WhichNeighbor specifies which neighbor (relative to a_NeighborXYZ) has changed. For example BLOCK_FACE_YP means that the block at {a_NeighborX, a_NeighborY + 1, a_NeighborZ} has changed. BLOCK_FACE_NONE means that it is a neighbor not directly adjacent (diagonal, etc.) */ static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_NeighborX, int a_NeighborY, int a_NeighborZ, eBlockFace a_WhichNeighbor); - + /** Called when the player starts digging the block. */ virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) {} - + /** Called if the user right clicks the block and the block is useable returns true if the use was successful, return false to use the block as a "normal" block */ virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) { return false; } - + /** Called when a right click to this block is cancelled */ virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) {} - + /** Called when the item is mined to convert it into pickups. Pickups may specify multiple items. Appends items to a_Pickups, preserves its original contents */ virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta); - + /** Handles the dropping, but not destruction, of a block based on what ConvertTo(Verbatim)Pickups() returns, including the spawning of pickups and alertion of plugins @param a_Digger The entity causing the drop; it may be nullptr @param a_CanDrop Informs the handler whether the block should be dropped at all. One example when this is false is when stone is destroyed by hand @param a_DropVerbatim Calls ConvertToVerbatimPickups() instead of its counterpart, meaning the block itself is dropped by default (due to a speical tool or enchantment) */ virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop = true); - + /** Checks if the block can stay at the specified relative coords in the chunk */ virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk); /** Checks whether the block has an effect on growing the plant */ virtual bool CanSustainPlant(BLOCKTYPE a_Plant) { return false; } - + /** Checks if the block can be placed at this point. Default: CanBeAt(...) NOTE: This call doesn't actually place the block */ // virtual bool CanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir); - + /** Called to check whether this block supports a rclk action. If it returns true, OnUse() is called */ virtual bool IsUseable(void); - + /** Indicates whether the client will click through this block. For example digging a fire will hit the block below the fire so fire is clicked through */ virtual bool IsClickedThrough(void); - + /** Checks if the player can build "inside" this block. For example blocks placed "on" snow will be placed at the same position. So: Snow ignores Build collision */ @@ -136,15 +136,15 @@ public: /** Returns the base colour ID of the block, as will be represented on a map, as per documentation: http://minecraft.gamepedia.com/Map_item_format */ virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta); - + /** Rotates a given block meta counter-clockwise. Default: no change Returns block meta following rotation */ virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) { return a_Meta; } - + /** Rotates a given block meta clockwise. Default: no change Returns block meta following rotation */ virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) { return a_Meta; } - + /** Mirrors a given block meta around the XY plane. Default: no change Returns block meta following rotation */ virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) { return a_Meta; } @@ -156,10 +156,10 @@ public: /** Mirros a given block meta around the YZ plane. Default: no change Returns block meta following rotation */ virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) { return a_Meta; } - + protected: BLOCKTYPE m_BlockType; - + // Creates a new blockhandler for the given block type. For internal use only, use ::GetBlockHandler() instead. static cBlockHandler * CreateBlockHandler(BLOCKTYPE a_BlockType); diff --git a/src/Blocks/BlockHopper.h b/src/Blocks/BlockHopper.h index 0c0871fdd..6fd8204fd 100644 --- a/src/Blocks/BlockHopper.h +++ b/src/Blocks/BlockHopper.h @@ -24,7 +24,7 @@ public: ) override { a_BlockType = m_BlockType; - + // Convert the blockface into meta: switch (a_BlockFace) { diff --git a/src/Blocks/BlockIce.h b/src/Blocks/BlockIce.h index 337c92022..aae190036 100644 --- a/src/Blocks/BlockIce.h +++ b/src/Blocks/BlockIce.h @@ -21,14 +21,14 @@ public: { // No pickups } - + virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override { if (a_Player->IsGameModeCreative() || (a_BlockY <= 0)) { return; } - + cEnchantments Enchantments = a_Player->GetInventory().GetEquippedItem().m_Enchantments; if (Enchantments.GetLevel(cEnchantments::enchSilkTouch) == 0) { diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index 5a1a099b7..41d01280b 100644 --- a/src/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h @@ -29,7 +29,7 @@ public: if (!LadderCanBePlacedAt(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace)) { a_BlockFace = FindSuitableBlockFace(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); - + if (a_BlockFace == BLOCK_FACE_BOTTOM) { return false; diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 2017c391b..8807a40ef 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -82,7 +82,7 @@ public: a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); } } - + 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); @@ -159,7 +159,7 @@ bool HasNearLog(cBlockArea & a_Area, int a_BlockX, int a_BlockY, int a_BlockZ) } } } // for i - Types[] - + // Perform a breadth-first search to see if there's a log connected within 4 blocks of the leaves block: // Simply replace all reachable leaves blocks with a sponge block plus iteration (in the Area) and see if we can reach a log in 4 iterations a_Area.SetBlockType(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_SPONGE); diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index a3bbd54f5..4b52df981 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -10,13 +10,13 @@ class cBlockLeverHandler : public cMetaRotator { typedef cMetaRotator super; - + public: cBlockLeverHandler(BLOCKTYPE a_BlockType) : super(a_BlockType) { } - + virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { // Flip the ON bit on / off using the XOR bitwise operation @@ -38,7 +38,7 @@ public: { return true; } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -93,7 +93,7 @@ public: virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); - + eBlockFace Face = BlockMetaDataToBlockFace(Meta); AddFaceDirection(a_RelX, a_RelY, a_RelZ, Face, true); diff --git a/src/Blocks/BlockMelon.h b/src/Blocks/BlockMelon.h index 4743e5c98..a9723dcec 100644 --- a/src/Blocks/BlockMelon.h +++ b/src/Blocks/BlockMelon.h @@ -15,7 +15,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { cFastRandom Random; diff --git a/src/Blocks/BlockMobHead.h b/src/Blocks/BlockMobHead.h index 72face3a2..a271c3b43 100644 --- a/src/Blocks/BlockMobHead.h +++ b/src/Blocks/BlockMobHead.h @@ -39,7 +39,7 @@ public: return false; } cMobHeadEntity * MobHeadEntity = static_cast(a_BlockEntity); - + cItems Pickups; Pickups.Add(E_ITEM_HEAD, 1, static_cast(MobHeadEntity->GetType())); MTRand r1; @@ -58,7 +58,7 @@ public: return false; } } Callback; - + a_WorldInterface.DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, Callback); } diff --git a/src/Blocks/BlockMobSpawner.h b/src/Blocks/BlockMobSpawner.h index 67102c78d..a6205490f 100644 --- a/src/Blocks/BlockMobSpawner.h +++ b/src/Blocks/BlockMobSpawner.h @@ -35,8 +35,8 @@ public: { // No pickups } - - + + virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override { cItemHandler * Handler = a_Player->GetEquippedItem().GetHandler(); diff --git a/src/Blocks/BlockMushroom.h b/src/Blocks/BlockMushroom.h index 65b68b097..d6b726b57 100644 --- a/src/Blocks/BlockMushroom.h +++ b/src/Blocks/BlockMushroom.h @@ -30,9 +30,9 @@ public: { return false; } - + // TODO: Cannot be at too much daylight - + switch (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)) { case E_BLOCK_GLASS: diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 6a384b85d..30ccc168d 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -14,7 +14,7 @@ class cBlockPistonHandler : { public: cBlockPistonHandler(BLOCKTYPE a_BlockType); - + virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override; virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override; @@ -94,7 +94,7 @@ public: } private: - + typedef std::unordered_set> Vector3iSet; /** Returns true if the piston (specified by blocktype) is a sticky piston */ @@ -153,7 +153,7 @@ private: const Vector3i & a_BlockPos, cWorld * a_World, bool a_RequirePushable, Vector3iSet & a_BlocksPushed, const Vector3i & a_PushDir ); - + /** Moves a list of blocks in a specific direction */ static void PushBlocks(const Vector3iSet & a_BlocksToPush, cWorld * a_World, const Vector3i & a_PushDir @@ -168,10 +168,10 @@ class cBlockPistonHeadHandler : public cBlockHandler { typedef cBlockHandler super; - + public: cBlockPistonHeadHandler(void); - + virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override; virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override diff --git a/src/Blocks/BlockPlanks.h b/src/Blocks/BlockPlanks.h index 52e8c34dc..b84b048c1 100644 --- a/src/Blocks/BlockPlanks.h +++ b/src/Blocks/BlockPlanks.h @@ -14,7 +14,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, diff --git a/src/Blocks/BlockPluginInterface.h b/src/Blocks/BlockPluginInterface.h index 6d49a248d..d97927b36 100644 --- a/src/Blocks/BlockPluginInterface.h +++ b/src/Blocks/BlockPluginInterface.h @@ -28,7 +28,7 @@ class cBlockPluginInterface { public: virtual ~cBlockPluginInterface() {} - + virtual bool CallHookBlockSpread(int a_BlockX, int a_BlockY, int a_BlockZ, eSpreadSource a_Source) = 0; virtual bool CallHookBlockToPickups(cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) = 0; virtual bool CallHookPlayerBreakingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0; diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index 4af50984e..504c018fb 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -112,7 +112,7 @@ public: } return true; } - + virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override { UNUSED(a_Meta); diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index 133a486ac..b5927c1ef 100644 --- a/src/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h @@ -15,7 +15,7 @@ public: super(a_BlockType) { } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -31,7 +31,7 @@ public: inline static NIBBLETYPE PlayerYawToMetaData(double a_Yaw) { ASSERT((a_Yaw >= -180) && (a_Yaw < 180)); - + a_Yaw += 180 + 45; if (a_Yaw > 360) { diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 734ee93c7..dda9af60d 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -22,13 +22,13 @@ class cBlockRailHandler : public cBlockHandler { typedef cBlockHandler super; - + public: cBlockRailHandler(BLOCKTYPE a_BlockType) : cBlockHandler(a_BlockType) { } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -85,7 +85,7 @@ public: { super::ConvertToPickups(a_Pickups, 0); } - + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { if (a_RelY <= 0) @@ -279,7 +279,7 @@ public: } break; } - + case E_META_RAIL_XM_XP: { if ( @@ -291,7 +291,7 @@ public: } break; } - + case E_META_RAIL_ASCEND_XP: { if ( @@ -303,7 +303,7 @@ public: } break; } - + case E_META_RAIL_ASCEND_XM: { if ( @@ -315,7 +315,7 @@ public: } break; } - + case E_META_RAIL_ASCEND_ZM: { if ( @@ -327,7 +327,7 @@ public: } break; } - + case E_META_RAIL_ASCEND_ZP: { if ( @@ -339,7 +339,7 @@ public: } break; } - + case E_META_RAIL_CURVED_ZP_XP: { if ( @@ -351,7 +351,7 @@ public: } break; } - + case E_META_RAIL_CURVED_ZP_XM: { if ( @@ -363,7 +363,7 @@ public: } break; } - + case E_META_RAIL_CURVED_ZM_XM: { if ( @@ -375,7 +375,7 @@ public: } break; } - + case E_META_RAIL_CURVED_ZM_XP: { if ( @@ -417,7 +417,7 @@ public: { Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); } - + switch (a_BlockFace) { case BLOCK_FACE_NORTH: @@ -434,7 +434,7 @@ public: } break; } - + case BLOCK_FACE_SOUTH: { if ( @@ -449,7 +449,7 @@ public: } break; } - + case BLOCK_FACE_EAST: { if ( diff --git a/src/Blocks/BlockRedstone.h b/src/Blocks/BlockRedstone.h index ec661b1f0..47c90bfd9 100644 --- a/src/Blocks/BlockRedstone.h +++ b/src/Blocks/BlockRedstone.h @@ -43,7 +43,7 @@ public: } return false; } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { // Reset meta to zero diff --git a/src/Blocks/BlockRedstoneLamp.h b/src/Blocks/BlockRedstoneLamp.h index 8545d5ca6..5ac98de87 100644 --- a/src/Blocks/BlockRedstoneLamp.h +++ b/src/Blocks/BlockRedstoneLamp.h @@ -15,7 +15,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_LAMP_OFF, 1, 0)); diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h index 033ba82de..54e87bb32 100644 --- a/src/Blocks/BlockRedstoneRepeater.h +++ b/src/Blocks/BlockRedstoneRepeater.h @@ -52,7 +52,7 @@ public: { return true; } - + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { if (a_RelY <= 0) diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h index ea10d5c20..b7d2f163b 100644 --- a/src/Blocks/BlockSapling.h +++ b/src/Blocks/BlockSapling.h @@ -17,18 +17,18 @@ public: : cBlockHandler(a_BlockType) { } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { // Only the first 2 bits contain the display information and the 4th bit is for the growth indicator, but, we use 0x07 for forward compatibility a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x07)); } - + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)); } - + 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/BlockSideways.h b/src/Blocks/BlockSideways.h index c3fa5b3da..c9d157d11 100644 --- a/src/Blocks/BlockSideways.h +++ b/src/Blocks/BlockSideways.h @@ -15,7 +15,7 @@ public: { } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, diff --git a/src/Blocks/BlockSignPost.h b/src/Blocks/BlockSignPost.h index 0b122af98..51e034081 100644 --- a/src/Blocks/BlockSignPost.h +++ b/src/Blocks/BlockSignPost.h @@ -13,7 +13,7 @@ class cBlockSignPostHandler : public cBlockHandler { typedef cBlockHandler super; - + public: cBlockSignPostHandler(BLOCKTYPE a_BlockType) : super(a_BlockType) @@ -43,9 +43,9 @@ public: { a_Rotation -= 360; } - + a_Rotation = (a_Rotation / 360) * 16; - + return (static_cast(a_Rotation)) % 16; } diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index bc7f79099..c75dee50d 100644 --- a/src/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h @@ -39,7 +39,7 @@ public: { a_BlockType = m_BlockType; NIBBLETYPE Meta = static_cast(a_Player->GetEquippedItem().m_ItemDamage); - + // Set the correct metadata based on player equipped item (i.e. a_BlockMeta not initialised yet) switch (a_BlockFace) { @@ -84,7 +84,7 @@ public: return true; } - + /** Returns true if the specified blocktype is one of the slabs handled by this handler */ static bool IsAnySlabType(BLOCKTYPE a_BlockType) { @@ -101,7 +101,7 @@ public: // Sends the slab back to the client. It's to refuse a doubleslab placement. */ a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); } - + /** Converts the single-slab blocktype to its equivalent double-slab blocktype */ static BLOCKTYPE GetDoubleSlabType(BLOCKTYPE a_SingleSlabBlockType) { @@ -114,7 +114,7 @@ public: ASSERT(!"Unhandled slab type!"); return E_BLOCK_AIR; } - + virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override { // Toggle the 4th bit - up / down: @@ -203,7 +203,7 @@ public: BLOCKTYPE Block = GetSingleSlabType(m_BlockType); a_Pickups.push_back(cItem(Block, 2, a_BlockMeta & 0x7)); } - + inline static BLOCKTYPE GetSingleSlabType(BLOCKTYPE a_BlockType) { switch (a_BlockType) diff --git a/src/Blocks/BlockSlime.h b/src/Blocks/BlockSlime.h index e785a6a13..8302c0bf4 100644 --- a/src/Blocks/BlockSlime.h +++ b/src/Blocks/BlockSlime.h @@ -14,7 +14,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { a_Pickups.push_back(cItem(m_BlockType, 1, 0)); diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h index c49aa7161..d11c444b9 100644 --- a/src/Blocks/BlockSnow.h +++ b/src/Blocks/BlockSnow.h @@ -36,7 +36,7 @@ public: // - Height is smaller than 7, the maximum possible height MetaBeforePlacement++; } - + a_BlockMeta = MetaBeforePlacement; return true; } @@ -67,17 +67,17 @@ public: { BLOCKTYPE BlockBelow = a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ); NIBBLETYPE MetaBelow = a_Chunk.GetMeta(a_RelX, a_RelY - 1, a_RelZ); - + if (cBlockInfo::IsSnowable(BlockBelow) || ((BlockBelow == E_BLOCK_SNOW) && (MetaBelow == 7))) { // If block below is snowable, or it is a thin slow block and has a meta of 7 (full thin snow block), say yay return true; } } - + return false; } - + virtual bool DoesDropOnUnsuitable(void) override { return false; diff --git a/src/Blocks/BlockStems.h b/src/Blocks/BlockStems.h index df832c55a..388da5874 100644 --- a/src/Blocks/BlockStems.h +++ b/src/Blocks/BlockStems.h @@ -23,7 +23,7 @@ public: short ItemType = (m_BlockType == E_BLOCK_MELON_STEM) ? E_ITEM_MELON_SEEDS : E_ITEM_PUMPKIN_SEEDS; a_Pickups.push_back(cItem(ItemType, 1, 0)); } - + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { auto Action = CanGrow(a_Chunk, a_RelX, a_RelY, a_RelZ); diff --git a/src/Blocks/BlockSugarcane.h b/src/Blocks/BlockSugarcane.h index 2b4c9e583..7e2a0c0a5 100644 --- a/src/Blocks/BlockSugarcane.h +++ b/src/Blocks/BlockSugarcane.h @@ -71,7 +71,7 @@ public: } return false; } - + 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 (CanGrow(a_Chunk, a_RelX, a_RelY, a_RelZ) == paGrowth) diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index db66259e9..6fd2ca231 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -16,7 +16,7 @@ public: : cMetaRotator(a_BlockType) { } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -142,7 +142,7 @@ public: } } } - + /** Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure */ static eBlockFace FindSuitableFace(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) { diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h index bd10a63da..e9e1f7794 100644 --- a/src/Blocks/BlockTrapdoor.h +++ b/src/Blocks/BlockTrapdoor.h @@ -39,7 +39,7 @@ public: // Flip the ON bit on / off using the XOR bitwise operation NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); - + cWorld * World = static_cast(&a_WorldInterface); World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_DOOR_OPEN_CLOSE, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player->GetClientHandle()); diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h index 575273cde..dc04bee60 100644 --- a/src/Blocks/BlockVine.h +++ b/src/Blocks/BlockVine.h @@ -14,7 +14,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -117,18 +117,18 @@ public: } return res; } - + 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); - + // Check if vine above us, add its meta to MaxMeta if ((a_RelY < cChunkDef::Height - 1) && (a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ) == m_BlockType)) { MaxMeta |= a_Chunk.GetMeta(a_RelX, a_RelY + 1, a_RelZ); } - + NIBBLETYPE Common = CurMeta & MaxMeta; // Neighbors that we have and are legal if (Common != CurMeta) { diff --git a/src/Blocks/BlockWorkbench.h b/src/Blocks/BlockWorkbench.h index cafc11af8..eb75647ff 100644 --- a/src/Blocks/BlockWorkbench.h +++ b/src/Blocks/BlockWorkbench.h @@ -17,7 +17,7 @@ public: : cBlockHandler(a_BlockType) { } - + virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { cWindow * Window = new cCraftingWindow(a_BlockX, a_BlockY, a_BlockZ); diff --git a/src/Blocks/BroadcastInterface.h b/src/Blocks/BroadcastInterface.h index bf464627d..ab101e1f6 100644 --- a/src/Blocks/BroadcastInterface.h +++ b/src/Blocks/BroadcastInterface.h @@ -5,7 +5,7 @@ class cBroadcastInterface { public: virtual ~cBroadcastInterface() {} - + virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) = 0; virtual void BroadcastSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr) = 0; virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = nullptr) = 0; diff --git a/src/Blocks/ChunkInterface.h b/src/Blocks/ChunkInterface.h index ee9bf9da7..33413ca1a 100644 --- a/src/Blocks/ChunkInterface.h +++ b/src/Blocks/ChunkInterface.h @@ -21,32 +21,32 @@ public: NIBBLETYPE GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ); bool GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta); - + /** Sets the block at the specified coords to the specified value. Full processing, incl. updating neighbors, is performed. */ void SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - + void SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_MetaData); - + /** Sets the block at the specified coords to the specified value. The replacement doesn't trigger block updates. The replaced blocks aren't checked for block entities (block entity is leaked if it exists at this block) */ void FastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); - + void FastSetBlock(const Vector3i & a_Pos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); /** Use block entity on coordinate. returns true if the use was successful, return false to use the block as a "normal" block */ bool UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ); - + virtual bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) override; - + virtual bool WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) override; - + bool DigBlock(cWorldInterface & a_WorldInterface, int a_X, int a_Y, int a_Z); - + private: cChunkMap * m_ChunkMap; }; diff --git a/src/Blocks/ClearMetaOnDrop.h b/src/Blocks/ClearMetaOnDrop.h index aa4f23848..91e932454 100644 --- a/src/Blocks/ClearMetaOnDrop.h +++ b/src/Blocks/ClearMetaOnDrop.h @@ -15,7 +15,7 @@ public: cClearMetaOnDrop(BLOCKTYPE a_BlockType) : Base(a_BlockType) {} - + virtual ~cClearMetaOnDrop() {} virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { diff --git a/src/Blocks/MetaRotator.h b/src/Blocks/MetaRotator.h index 4c268077a..67066efff 100644 --- a/src/Blocks/MetaRotator.h +++ b/src/Blocks/MetaRotator.h @@ -28,7 +28,7 @@ public: cMetaRotator(BLOCKTYPE a_BlockType) : Base(a_BlockType) {} - + virtual ~cMetaRotator() {} virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override; diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index ede0837a4..c6cf070a0 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -17,22 +17,22 @@ class cWorldInterface { public: virtual ~cWorldInterface() {} - + virtual int GetTimeOfDay(void) const = 0; virtual Int64 GetWorldAge(void) const = 0; - + virtual eDimension GetDimension(void) const = 0; - + virtual cBroadcastInterface & GetBroadcastManager() = 0; - + virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) = 0; - + /** Spawns item pickups for each item in the list. May compress pickups if too many entities: */ virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed = 1.0, bool IsPlayerCreated = false) = 0; - + /** Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified. */ virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false) = 0; - + /** Spawns a mob of the specified type. Returns the mob's UniqueID if recognized and spawned, or cEntity::INVALID_ID on failure. */ virtual UInt32 SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby) = 0; -- cgit v1.2.3