From 0a20e19a64f88e66af68018cc46bc37dfdca7948 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 28 Jun 2014 00:29:19 +0100 Subject: Minor change to buttons and levers + They now detect if the block they are on occupies its voxel, instead of just being solid --- src/Blocks/BlockButton.h | 2 +- src/Blocks/BlockLever.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 4b2f6f618..7d9af207d 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -102,7 +102,7 @@ public: AddFaceDirection(a_RelX, a_RelY, a_RelZ, BlockMetaDataToBlockFace(Meta), true); BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn); - return (a_RelY > 0) && (cBlockInfo::IsSolid(BlockIsOn)); + return (a_RelY > 0) && (cBlockInfo::FullyOccupiesVoxel(BlockIsOn)); } } ; diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index f1d3ff6d2..afe43abf8 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -22,7 +22,7 @@ public: // Flip the ON bit on/off using the XOR bitwise operation NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08); - a_ChunkInterface.SetBlock(a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_LEVER, Meta); // SetMeta doesn't work for unpowering levers, so setblock + a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); } @@ -104,7 +104,7 @@ public: AddFaceDirection(a_RelX, a_RelY, a_RelZ, BlockMetaDataToBlockFace(Meta), true); BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn); - return (a_RelY > 0) && cBlockInfo::IsSolid(BlockIsOn); + return (a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn); } -- cgit v1.2.3 From de543ff73fa8bb846030ffc702ed4db9f2e89f7b Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 28 Jun 2014 00:29:32 +0100 Subject: Added more block exceptions to torches --- src/Blocks/BlockTorch.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index 8ddec8de1..44c33c429 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -154,7 +154,11 @@ public: if ( (BlockInQuestion == E_BLOCK_GLASS) || + (BlockInQuestion == E_BLOCK_STAINED_GLASS) || (BlockInQuestion == E_BLOCK_FENCE) || + (BlockInQuestion == E_BLOCK_SOULSAND) || + (BlockInQuestion == E_BLOCK_MOB_SPAWNER) || + (BlockInQuestion == E_BLOCK_END_PORTAL_FRAME) || // Actual vanilla behaviour (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || (BlockInQuestion == E_BLOCK_COBBLESTONE_WALL) ) -- cgit v1.2.3 From 61cb08b54698e9b70f629858a6a9c5b389db8b3e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 28 Jun 2014 20:44:34 +0100 Subject: Implemented tripwire(s) (hooks) * Fixes #944 --- src/Blocks/BlockHandler.cpp | 4 +++ src/Blocks/BlockStone.h | 2 -- src/Blocks/BlockTripwire.h | 32 +++++++++++++++++ src/Blocks/BlockTripwireHook.h | 82 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 src/Blocks/BlockTripwire.h create mode 100644 src/Blocks/BlockTripwireHook.h (limited to 'src/Blocks') diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 405c9bf43..3ddb7531d 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -65,6 +65,8 @@ #include "BlockRedstoneRepeater.h" #include "BlockRedstoneTorch.h" #include "BlockTNT.h" +#include "BlockTripwire.h" +#include "BlockTripwireHook.h" #include "BlockSand.h" #include "BlockSapling.h" #include "BlockSideways.h" @@ -291,6 +293,8 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_TORCH: return new cBlockTorchHandler (a_BlockType); case E_BLOCK_TRAPDOOR: return new cBlockTrapdoorHandler (a_BlockType); case E_BLOCK_TNT: return new cBlockTNTHandler (a_BlockType); + case E_BLOCK_TRIPWIRE: return new cBlockTripwireHandler (a_BlockType); + case E_BLOCK_TRIPWIRE_HOOK: return new cBlockTripwireHookHandler (a_BlockType); case E_BLOCK_VINES: return new cBlockVineHandler (a_BlockType); case E_BLOCK_WALLSIGN: return new cBlockSignHandler (a_BlockType); // TODO: This needs a special handler case E_BLOCK_WATER: return new cBlockFluidHandler (a_BlockType); diff --git a/src/Blocks/BlockStone.h b/src/Blocks/BlockStone.h index af4c6509a..cd5230f49 100644 --- a/src/Blocks/BlockStone.h +++ b/src/Blocks/BlockStone.h @@ -2,8 +2,6 @@ #pragma once #include "BlockHandler.h" -#include "../MersenneTwister.h" -#include "../World.h" diff --git a/src/Blocks/BlockTripwire.h b/src/Blocks/BlockTripwire.h new file mode 100644 index 000000000..3ab17bf4a --- /dev/null +++ b/src/Blocks/BlockTripwire.h @@ -0,0 +1,32 @@ + +#pragma once + +#include "BlockHandler.h" + + + + + +class cBlockTripwireHandler : + public cBlockHandler +{ +public: + cBlockTripwireHandler(BLOCKTYPE a_BlockType) + : cBlockHandler(a_BlockType) + { + } + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0)); + } + + virtual const char * GetStepSound(void) override + { + return ""; + } +}; + + + + diff --git a/src/Blocks/BlockTripwireHook.h b/src/Blocks/BlockTripwireHook.h new file mode 100644 index 000000000..f849fb8ad --- /dev/null +++ b/src/Blocks/BlockTripwireHook.h @@ -0,0 +1,82 @@ +#pragma once + +#include "BlockHandler.h" +#include "MetaRotator.h" + + + + + +class cBlockTripwireHookHandler : + public cMetaRotator +{ +public: + cBlockTripwireHookHandler(BLOCKTYPE a_BlockType) + : cMetaRotator(a_BlockType) + { + } + + virtual bool GetPlacementBlockTypeMeta( + cChunkInterface & a_ChunkInterface, cPlayer * a_Player, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_CursorX, int a_CursorY, int a_CursorZ, + BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta + ) override + { + a_BlockType = m_BlockType; + + a_BlockMeta = DirectionToMetadata(a_BlockFace); + + return true; + } + + inline static NIBBLETYPE DirectionToMetadata(eBlockFace a_Direction) + { + switch (a_Direction) + { + case BLOCK_FACE_XM: return 0x1; + case BLOCK_FACE_XP: return 0x3; + case BLOCK_FACE_ZM: return 0x2; + case BLOCK_FACE_ZP: return 0x0; + default: ASSERT(!"Unhandled tripwire hook direction!"); return 0x0; + } + } + + inline static eBlockFace MetadataToDirection(NIBBLETYPE a_Meta) + { + switch (a_Meta & 0x03) + { + case 0x1: return BLOCK_FACE_XM; + case 0x3: return BLOCK_FACE_XP; + case 0x2: return BLOCK_FACE_ZM; + case 0x0: return BLOCK_FACE_ZP; + default: ASSERT(!"Unhandled tripwire hook metadata!"); return BLOCK_FACE_NONE; + } + } + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + // Reset meta to 0 + a_Pickups.push_back(cItem(E_BLOCK_TRIPWIRE_HOOK, 1, 0)); + } + + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override + { + NIBBLETYPE Meta; + a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); + + AddFaceDirection(a_RelX, a_RelY, a_RelZ, MetadataToDirection(Meta), true); + BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn); + + return (a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn); + } + + virtual const char * GetStepSound(void) override + { + return "step.wood"; + } +}; + + + + -- cgit v1.2.3 From 19caba5125e457a9663102989ea717898e3c2827 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 2 Jul 2014 18:46:00 +0100 Subject: Redstone simulator is alerted to lever unpowering * Fixed the "fix" that broke the fix for #535, thereby fixing said issue * Fixed #535 --- src/Blocks/BlockButton.h | 1 + src/Blocks/BlockLever.h | 1 + src/Blocks/WorldInterface.h | 3 +++ 3 files changed, 5 insertions(+) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 7d9af207d..ada7d58f7 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -23,6 +23,7 @@ public: NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x08); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); + a_WorldInterface.WakeUpSimulators(a_BlockX, a_BlockY, a_BlockZ); a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); // Queue a button reset (unpress) diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index afe43abf8..4e745d413 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -23,6 +23,7 @@ public: NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); + a_WorldInterface.WakeUpSimulators(a_BlockX, a_BlockY, a_BlockZ); a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); } diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index 650a216c0..251b28d03 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -46,4 +46,7 @@ public: virtual void SetTimeOfDay(Int64 a_TimeOfDay) = 0; + /** Wakes up the simulators for the specified block */ + virtual void WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) = 0; + }; -- cgit v1.2.3 From 9e44b0aae164f2456a452714f869cc9670732d8e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 6 Jul 2014 23:50:22 +0100 Subject: Implemented trapped chests & others + Added trapped chests * Fixed a bunch of bugs in the redstone simulator concerning wires and repeaters * Other potential bugfixes --- src/Blocks/BlockChest.h | 44 ++++++++++++++++++++++---------------------- src/Blocks/BlockHandler.cpp | 1 + src/Blocks/BlockPiston.cpp | 2 +- src/Blocks/BlockPiston.h | 18 +++--------------- 4 files changed, 27 insertions(+), 38 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h index c9a769c75..f899f4bcb 100644 --- a/src/Blocks/BlockChest.h +++ b/src/Blocks/BlockChest.h @@ -44,16 +44,16 @@ public: } double yaw = a_Player->GetYaw(); if ( - (Area.GetRelBlockType(0, 0, 1) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(2, 0, 1) == E_BLOCK_CHEST) + (Area.GetRelBlockType(0, 0, 1) == m_BlockType) || + (Area.GetRelBlockType(2, 0, 1) == m_BlockType) ) { a_BlockMeta = ((yaw >= -90) && (yaw < 90)) ? 2 : 3; return true; } if ( - (Area.GetRelBlockType(0, 0, 1) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(2, 0, 1) == E_BLOCK_CHEST) + (Area.GetRelBlockType(0, 0, 1) == m_BlockType) || + (Area.GetRelBlockType(2, 0, 1) == m_BlockType) ) { // FIXME: This is unreachable, as the condition is the same as the above one @@ -130,12 +130,12 @@ public: } int NumChestNeighbors = 0; - if (Area.GetRelBlockType(1, 0, 2) == E_BLOCK_CHEST) + if (Area.GetRelBlockType(1, 0, 2) == m_BlockType) { if ( - (Area.GetRelBlockType(0, 0, 2) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(1, 0, 1) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(1, 0, 3) == E_BLOCK_CHEST) + (Area.GetRelBlockType(0, 0, 2) == m_BlockType) || + (Area.GetRelBlockType(1, 0, 1) == m_BlockType) || + (Area.GetRelBlockType(1, 0, 3) == m_BlockType) ) { // Already a doublechest neighbor, disallow: @@ -143,12 +143,12 @@ public: } NumChestNeighbors += 1; } - if (Area.GetRelBlockType(3, 0, 2) == E_BLOCK_CHEST) + if (Area.GetRelBlockType(3, 0, 2) == m_BlockType) { if ( - (Area.GetRelBlockType(4, 0, 2) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(3, 0, 1) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(3, 0, 3) == E_BLOCK_CHEST) + (Area.GetRelBlockType(4, 0, 2) == m_BlockType) || + (Area.GetRelBlockType(3, 0, 1) == m_BlockType) || + (Area.GetRelBlockType(3, 0, 3) == m_BlockType) ) { // Already a doublechest neighbor, disallow: @@ -156,12 +156,12 @@ public: } NumChestNeighbors += 1; } - if (Area.GetRelBlockType(2, 0, 1) == E_BLOCK_CHEST) + if (Area.GetRelBlockType(2, 0, 1) == m_BlockType) { if ( - (Area.GetRelBlockType(2, 0, 0) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(1, 0, 1) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(3, 0, 1) == E_BLOCK_CHEST) + (Area.GetRelBlockType(2, 0, 0) == m_BlockType) || + (Area.GetRelBlockType(1, 0, 1) == m_BlockType) || + (Area.GetRelBlockType(3, 0, 1) == m_BlockType) ) { // Already a doublechest neighbor, disallow: @@ -169,12 +169,12 @@ public: } NumChestNeighbors += 1; } - if (Area.GetRelBlockType(2, 0, 3) == E_BLOCK_CHEST) + if (Area.GetRelBlockType(2, 0, 3) == m_BlockType) { if ( - (Area.GetRelBlockType(2, 0, 4) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(1, 0, 3) == E_BLOCK_CHEST) || - (Area.GetRelBlockType(3, 0, 3) == E_BLOCK_CHEST) + (Area.GetRelBlockType(2, 0, 4) == m_BlockType) || + (Area.GetRelBlockType(1, 0, 3) == m_BlockType) || + (Area.GetRelBlockType(3, 0, 3) == m_BlockType) ) { // Already a doublechest neighbor, disallow: @@ -217,7 +217,7 @@ public: /// 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) { - if (a_Area.GetRelBlockType(a_RelX, 0, a_RelZ) != E_BLOCK_CHEST) + if (a_Area.GetRelBlockType(a_RelX, 0, a_RelZ) != m_BlockType) { return false; } @@ -228,7 +228,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.push_back(cItem(E_BLOCK_CHEST, 1, 0)); + a_Pickups.push_back(cItem(m_BlockType, 1, 0)); } } ; diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 3ddb7531d..4ec064d2b 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -191,6 +191,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_CARROTS: return new cBlockCropsHandler (a_BlockType); case E_BLOCK_CARPET: return new cBlockCarpetHandler (a_BlockType); case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType); + case E_BLOCK_TRAPPED_CHEST: case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType); case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType); diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp index faf639312..6f8d8be3e 100644 --- a/src/Blocks/BlockPiston.cpp +++ b/src/Blocks/BlockPiston.cpp @@ -85,7 +85,7 @@ int cBlockPistonHandler::FirstPassthroughBlock(int a_PistonX, int a_PistonY, int NIBBLETYPE currMeta; AddPistonDir(a_PistonX, a_PistonY, a_PistonZ, pistonmeta, 1); a_World->GetBlockTypeMeta(a_PistonX, a_PistonY, a_PistonZ, currBlock, currMeta); - if (CanBreakPush(currBlock)) + if (cBlockInfo::IsPistonBreakable(currBlock)) { // This block breaks when pushed, extend up to here return ret; diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index e6fa48e54..3913da320 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -104,6 +104,7 @@ private: case E_BLOCK_ENCHANTMENT_TABLE: case E_BLOCK_END_PORTAL: case E_BLOCK_END_PORTAL_FRAME: + // Ender chests can totally be pushed/pulled in MCS :) case E_BLOCK_FURNACE: case E_BLOCK_LIT_FURNACE: case E_BLOCK_HOPPER: @@ -113,6 +114,7 @@ private: case E_BLOCK_NOTE_BLOCK: case E_BLOCK_OBSIDIAN: case E_BLOCK_PISTON_EXTENSION: + case E_BLOCK_TRAPPED_CHEST: { return false; } @@ -126,24 +128,10 @@ private: return true; } - /// Returns true if the specified block can be pushed by a piston and broken / replaced - static inline bool CanBreakPush(BLOCKTYPE a_BlockType) { return cBlockInfo::IsPistonBreakable(a_BlockType); } - /// Returns true if the specified block can be pulled by a sticky piston static inline bool CanPull(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { - switch (a_BlockType) - { - case E_BLOCK_LAVA: - case E_BLOCK_STATIONARY_LAVA: - case E_BLOCK_STATIONARY_WATER: - case E_BLOCK_WATER: - { - return false; - } - } - - if (CanBreakPush(a_BlockType)) + if (cBlockInfo::IsPistonBreakable(a_BlockType)) { return false; // CanBreakPush returns true, but we need false to prevent pulling } -- cgit v1.2.3 From 6a33fa84ae03ada5ddeb5861094a4030e612f827 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 11 Jul 2014 12:43:24 +0100 Subject: Suggestions --- src/Blocks/BlockHandler.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 4ec064d2b..bd48ece52 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -176,7 +176,12 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) { switch(a_BlockType) { - // Block handlers, alphabetically sorted: + // Block handlers, alphabetically sorted: + case E_BLOCK_CHEST: + case E_BLOCK_TRAPPED_CHEST: return new cBlockChestHandler(a_BlockType); + case E_BLOCK_FURNACE: + case E_BLOCK_LIT_FURNACE: return new cBlockFurnaceHandler(a_BlockType); + case E_BLOCK_ACACIA_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_ACTIVATOR_RAIL: return new cBlockRailHandler (a_BlockType); case E_BLOCK_ANVIL: return new cBlockAnvilHandler (a_BlockType); @@ -191,8 +196,6 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_CARROTS: return new cBlockCropsHandler (a_BlockType); case E_BLOCK_CARPET: return new cBlockCarpetHandler (a_BlockType); case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType); - case E_BLOCK_TRAPPED_CHEST: - case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType); case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType); case E_BLOCK_ACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType); @@ -216,7 +219,6 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); case E_BLOCK_FIRE: return new cBlockFireHandler (a_BlockType); case E_BLOCK_FLOWER_POT: return new cBlockFlowerPotHandler (a_BlockType); - case E_BLOCK_FURNACE: return new cBlockFurnaceHandler (a_BlockType); case E_BLOCK_GLOWSTONE: return new cBlockGlowstoneHandler (a_BlockType); case E_BLOCK_GOLD_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_GLASS: return new cBlockGlassHandler (a_BlockType); @@ -240,7 +242,6 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_LAVA: return new cBlockLavaHandler (a_BlockType); case E_BLOCK_LEAVES: return new cBlockLeavesHandler (a_BlockType); case E_BLOCK_LILY_PAD: return new cBlockLilypadHandler (a_BlockType); - case E_BLOCK_LIT_FURNACE: return new cBlockFurnaceHandler (a_BlockType); case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE: return new cBlockPressurePlateHandler(a_BlockType); case E_BLOCK_LOG: return new cBlockSidewaysHandler (a_BlockType); case E_BLOCK_MELON: return new cBlockMelonHandler (a_BlockType); -- cgit v1.2.3 From 416c160fb52b400e81e029a358c503053a2b93ec Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 11 Jul 2014 19:40:33 +0100 Subject: Suggestions --- src/Blocks/BlockHandler.cpp | 3 ++- src/Blocks/BlockPiston.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index bd48ece52..fcd5e2b41 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -176,12 +176,13 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) { switch(a_BlockType) { - // Block handlers, alphabetically sorted: + // Duplicate block handlers (two blocks use one handler), alphabetically sorted: case E_BLOCK_CHEST: case E_BLOCK_TRAPPED_CHEST: return new cBlockChestHandler(a_BlockType); case E_BLOCK_FURNACE: case E_BLOCK_LIT_FURNACE: return new cBlockFurnaceHandler(a_BlockType); + // Block handlers, alphabetically sorted: case E_BLOCK_ACACIA_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_ACTIVATOR_RAIL: return new cBlockRailHandler (a_BlockType); case E_BLOCK_ANVIL: return new cBlockAnvilHandler (a_BlockType); diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 3913da320..27a44d829 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -104,7 +104,7 @@ private: case E_BLOCK_ENCHANTMENT_TABLE: case E_BLOCK_END_PORTAL: case E_BLOCK_END_PORTAL_FRAME: - // Ender chests can totally be pushed/pulled in MCS :) + // Notice the lack of an E_BLOCK_ENDER_CHEST here; its because ender chests can totally be pushed/pulled in MCS :) case E_BLOCK_FURNACE: case E_BLOCK_LIT_FURNACE: case E_BLOCK_HOPPER: -- cgit v1.2.3 From e71e432633a26d0ab24d2da7e3707e4ab7060296 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 12 Jul 2014 22:06:25 +0100 Subject: Suggestions and bug fix * Fixed hoppers pushing/pulling to/from (trapped)chests that do not form a double-chest with the chest type directly connected to said hopper; thank you, @madmaxoft --- src/Blocks/BlockHandler.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index fcd5e2b41..730774ab1 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -176,12 +176,6 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) { switch(a_BlockType) { - // Duplicate block handlers (two blocks use one handler), alphabetically sorted: - case E_BLOCK_CHEST: - case E_BLOCK_TRAPPED_CHEST: return new cBlockChestHandler(a_BlockType); - case E_BLOCK_FURNACE: - case E_BLOCK_LIT_FURNACE: return new cBlockFurnaceHandler(a_BlockType); - // Block handlers, alphabetically sorted: case E_BLOCK_ACACIA_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_ACTIVATOR_RAIL: return new cBlockRailHandler (a_BlockType); @@ -197,6 +191,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_CARROTS: return new cBlockCropsHandler (a_BlockType); case E_BLOCK_CARPET: return new cBlockCarpetHandler (a_BlockType); case E_BLOCK_CAULDRON: return new cBlockCauldronHandler (a_BlockType); + case E_BLOCK_CHEST: return new cBlockChestHandler (a_BlockType); case E_BLOCK_COAL_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_COMMAND_BLOCK: return new cBlockCommandBlockHandler (a_BlockType); case E_BLOCK_ACTIVE_COMPARATOR: return new cBlockComparatorHandler (a_BlockType); @@ -220,6 +215,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); case E_BLOCK_FIRE: return new cBlockFireHandler (a_BlockType); case E_BLOCK_FLOWER_POT: return new cBlockFlowerPotHandler (a_BlockType); + case E_BLOCK_FURNACE: return new cBlockFurnaceHandler (a_BlockType); case E_BLOCK_GLOWSTONE: return new cBlockGlowstoneHandler (a_BlockType); case E_BLOCK_GOLD_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_GLASS: return new cBlockGlassHandler (a_BlockType); @@ -242,8 +238,9 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_LAPIS_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_LAVA: return new cBlockLavaHandler (a_BlockType); case E_BLOCK_LEAVES: return new cBlockLeavesHandler (a_BlockType); - case E_BLOCK_LILY_PAD: return new cBlockLilypadHandler (a_BlockType); case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE: return new cBlockPressurePlateHandler(a_BlockType); + case E_BLOCK_LILY_PAD: return new cBlockLilypadHandler (a_BlockType); + case E_BLOCK_LIT_FURNACE: return new cBlockFurnaceHandler (a_BlockType); case E_BLOCK_LOG: return new cBlockSidewaysHandler (a_BlockType); case E_BLOCK_MELON: return new cBlockMelonHandler (a_BlockType); case E_BLOCK_MELON_STEM: return new cBlockStemsHandler (a_BlockType); @@ -296,6 +293,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_TORCH: return new cBlockTorchHandler (a_BlockType); case E_BLOCK_TRAPDOOR: return new cBlockTrapdoorHandler (a_BlockType); case E_BLOCK_TNT: return new cBlockTNTHandler (a_BlockType); + case E_BLOCK_TRAPPED_CHEST: return new cBlockChestHandler (a_BlockType); case E_BLOCK_TRIPWIRE: return new cBlockTripwireHandler (a_BlockType); case E_BLOCK_TRIPWIRE_HOOK: return new cBlockTripwireHookHandler (a_BlockType); case E_BLOCK_VINES: return new cBlockVineHandler (a_BlockType); -- cgit v1.2.3 From d529971e279609ae928d9077404b95bd595b5e52 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 13 Jul 2014 02:08:02 +0200 Subject: Changed BroadcastSoundEffect function to take floating pos. --- src/Blocks/BlockButton.h | 2 +- src/Blocks/BlockLever.h | 2 +- src/Blocks/BlockPiston.cpp | 4 ++-- src/Blocks/BroadcastInterface.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index ada7d58f7..7f92681dc 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -24,7 +24,7 @@ public: a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); a_WorldInterface.WakeUpSimulators(a_BlockX, a_BlockY, a_BlockZ); - a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); + a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); // Queue a button reset (unpress) a_ChunkInterface.QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), m_BlockType == E_BLOCK_STONE_BUTTON ? 20 : 30, m_BlockType, a_WorldInterface); diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index 4e745d413..7ce8d038e 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -24,7 +24,7 @@ public: a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); a_WorldInterface.WakeUpSimulators(a_BlockX, a_BlockY, a_BlockZ); - a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); + a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f); } diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp index 6f8d8be3e..ec480aaea 100644 --- a/src/Blocks/BlockPiston.cpp +++ b/src/Blocks/BlockPiston.cpp @@ -124,7 +124,7 @@ void cBlockPistonHandler::ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ, } a_World->BroadcastBlockAction(a_BlockX, a_BlockY, a_BlockZ, 0, pistonMeta, pistonBlock); - a_World->BroadcastSoundEffect("tile.piston.out", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, 0.7f); + a_World->BroadcastSoundEffect("tile.piston.out", (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 0.5f, 0.7f); // Drop the breakable block in the line, if appropriate: AddPistonDir(a_BlockX, a_BlockY, a_BlockZ, pistonMeta, dist + 1); // "a_Block" now at the breakable / empty block @@ -198,7 +198,7 @@ void cBlockPistonHandler::RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ AddPistonDir(a_BlockX, a_BlockY, a_BlockZ, pistonMeta, -1); a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, pistonBlock, pistonMeta & ~(8)); a_World->BroadcastBlockAction(a_BlockX, a_BlockY, a_BlockZ, 1, pistonMeta & ~(8), pistonBlock); - a_World->BroadcastSoundEffect("tile.piston.in", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, 0.7f); + a_World->BroadcastSoundEffect("tile.piston.in", (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 0.5f, 0.7f); AddPistonDir(a_BlockX, a_BlockY, a_BlockZ, pistonMeta, 1); // Retract the extension, pull block if appropriate diff --git a/src/Blocks/BroadcastInterface.h b/src/Blocks/BroadcastInterface.h index b1b450690..fbe72e72f 100644 --- a/src/Blocks/BroadcastInterface.h +++ b/src/Blocks/BroadcastInterface.h @@ -7,6 +7,6 @@ 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, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL) = 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 = NULL) = 0; virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) = 0; }; -- cgit v1.2.3 From 1929d16724de6f451c9485076b4091cbc457916c Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 14 Jul 2014 20:26:36 +0100 Subject: Added first implementation of cClearMetaOnDrop --- src/Blocks/BlockLadder.h | 5 +++-- src/Blocks/ClearMetaOnDrop.h | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/Blocks/ClearMetaOnDrop.h (limited to 'src/Blocks') diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index a605edf3f..1af2be067 100644 --- a/src/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h @@ -3,17 +3,18 @@ #include "BlockHandler.h" #include "../World.h" +#include "ClearMetaOnDrop.h" class cBlockLadderHandler : - public cMetaRotator + public cClearMetaOnDrop > { public: cBlockLadderHandler(BLOCKTYPE a_BlockType) - : cMetaRotator(a_BlockType) + : cClearMetaOnDrop >(a_BlockType) { } diff --git a/src/Blocks/ClearMetaOnDrop.h b/src/Blocks/ClearMetaOnDrop.h new file mode 100644 index 000000000..21b987f2c --- /dev/null +++ b/src/Blocks/ClearMetaOnDrop.h @@ -0,0 +1,18 @@ + +#pragma once + +template +class cClearMetaOnDrop : public Base +{ +public: + + cClearMetaOnDrop(BLOCKTYPE a_BlockType) : + Base(a_BlockType) + {} + + virtual ~cClearMetaOnDrop() {} + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(this->m_BlockType, 1, 0)); + } +}; -- cgit v1.2.3 From 515c3cbc67816fb770ff7e32bd593bd55c26788c Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 14 Jul 2014 20:28:16 +0100 Subject: Added cClearOnDrop Mixin to cPumpkin --- src/Blocks/BlockPumpkin.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index ac2b9817a..f4022735b 100644 --- a/src/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h @@ -6,11 +6,11 @@ class cBlockPumpkinHandler : - public cMetaRotator + public cClearMetaOnDrop > { public: cBlockPumpkinHandler(BLOCKTYPE a_BlockType) - : cMetaRotator(a_BlockType) + : cClearMetaOnDrop >(a_BlockType) { } -- cgit v1.2.3 From 093b5c6456fd2c635441630c87853a3a00008af8 Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 14 Jul 2014 20:33:30 +0100 Subject: Simplified ClearMetaOnDrop --- src/Blocks/ClearMetaOnDrop.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Blocks') diff --git a/src/Blocks/ClearMetaOnDrop.h b/src/Blocks/ClearMetaOnDrop.h index 21b987f2c..e6d26863a 100644 --- a/src/Blocks/ClearMetaOnDrop.h +++ b/src/Blocks/ClearMetaOnDrop.h @@ -13,6 +13,6 @@ public: virtual ~cClearMetaOnDrop() {} virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.push_back(cItem(this->m_BlockType, 1, 0)); + a_Pickups.push_back(cItem(this->m_BlockType)); } }; -- cgit v1.2.3 From 333f4f982cbd24ffcb376594eddef439b3f05e9e Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 14 Jul 2014 20:50:56 +0100 Subject: Converted some blockhandlers to use cClearMetaOnDrop --- src/Blocks/BlockBrewingStand.h | 10 +++------- src/Blocks/BlockCobWeb.h | 10 ++-------- src/Blocks/BlockFlowerPot.h | 9 ++------- src/Blocks/BlockLilypad.h | 9 ++------- src/Blocks/BlockMycelium.h | 8 ++------ src/Blocks/BlockRedstone.h | 11 ++--------- src/Blocks/BlockRedstoneLamp.h | 9 ++------- src/Blocks/BlockRedstoneRepeater.h | 13 +++---------- src/Blocks/BlockStone.h | 9 +++------ 9 files changed, 21 insertions(+), 67 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockBrewingStand.h b/src/Blocks/BlockBrewingStand.h index 57642bcb6..77e383b16 100644 --- a/src/Blocks/BlockBrewingStand.h +++ b/src/Blocks/BlockBrewingStand.h @@ -2,25 +2,21 @@ #pragma once #include "BlockHandler.h" +#include "ClearMetaOnDrop.h" class cBlockBrewingStandHandler : - public cBlockHandler + public cClearMetaOnDrop { public: cBlockBrewingStandHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cClearMetaOnDrop(a_BlockType) { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - a_Pickups.push_back(cItem(E_ITEM_BREWING_STAND, 1, 0)); - } - virtual bool IsUseable() override { return true; diff --git a/src/Blocks/BlockCobWeb.h b/src/Blocks/BlockCobWeb.h index 982bfaa30..29a6b8155 100644 --- a/src/Blocks/BlockCobWeb.h +++ b/src/Blocks/BlockCobWeb.h @@ -10,19 +10,13 @@ class cBlockCobWebHandler : - public cBlockHandler + public cClearMetaOnDrop { public: cBlockCobWebHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cClearMetaOnDrop(a_BlockType) { } - - - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override - { - a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0)); - } } ; diff --git a/src/Blocks/BlockFlowerPot.h b/src/Blocks/BlockFlowerPot.h index fc75ef638..39fbe1bd9 100644 --- a/src/Blocks/BlockFlowerPot.h +++ b/src/Blocks/BlockFlowerPot.h @@ -9,18 +9,13 @@ class cBlockFlowerPotHandler : - public cBlockEntityHandler + public cClearMetaOnDrop { public: cBlockFlowerPotHandler(BLOCKTYPE a_BlockType) : - cBlockEntityHandler(a_BlockType) + cClearMetaOnDrop(a_BlockType) { } - - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - a_Pickups.push_back(cItem(E_ITEM_FLOWER_POT, 1, 0)); - } } ; diff --git a/src/Blocks/BlockLilypad.h b/src/Blocks/BlockLilypad.h index 2dd4ec768..fc37f360c 100644 --- a/src/Blocks/BlockLilypad.h +++ b/src/Blocks/BlockLilypad.h @@ -8,19 +8,14 @@ class cBlockLilypadHandler : - public cBlockHandler + public cClearMetaOnDrop { public: cBlockLilypadHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cClearMetaOnDrop(a_BlockType) { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - // Reset meta to zero - a_Pickups.push_back(cItem(E_BLOCK_LILY_PAD, 1, 0)); - } }; diff --git a/src/Blocks/BlockMycelium.h b/src/Blocks/BlockMycelium.h index 2a8ef5fca..4d4a0bb4f 100644 --- a/src/Blocks/BlockMycelium.h +++ b/src/Blocks/BlockMycelium.h @@ -8,20 +8,16 @@ class cBlockMyceliumHandler : - public cBlockHandler + public cClearMetaOnDrop { public: cBlockMyceliumHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cClearMetaOnDrop(a_BlockType) { } // TODO: Add Mycel Spread - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0)); - } virtual const char * GetStepSound(void) override { diff --git a/src/Blocks/BlockRedstone.h b/src/Blocks/BlockRedstone.h index a898c9acb..6dbf46a57 100644 --- a/src/Blocks/BlockRedstone.h +++ b/src/Blocks/BlockRedstone.h @@ -9,11 +9,11 @@ class cBlockRedstoneHandler : - public cBlockHandler + public cClearMetaOnDrop { public: cBlockRedstoneHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cClearMetaOnDrop(a_BlockType) { } @@ -22,13 +22,6 @@ public: { return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); } - - - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - // Reset meta to 0 - a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, 1)); - } } ; diff --git a/src/Blocks/BlockRedstoneLamp.h b/src/Blocks/BlockRedstoneLamp.h index 69a2b27c2..4b0ca5b34 100644 --- a/src/Blocks/BlockRedstoneLamp.h +++ b/src/Blocks/BlockRedstoneLamp.h @@ -8,18 +8,13 @@ class cBlockRedstoneLampHandler : - public cBlockHandler + public cClearMetaOnDrop { public: cBlockRedstoneLampHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cClearMetaOnDrop(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 fe6cd21b9..1e9c00f2e 100644 --- a/src/Blocks/BlockRedstoneRepeater.h +++ b/src/Blocks/BlockRedstoneRepeater.h @@ -4,16 +4,16 @@ #include "BlockHandler.h" #include "Chunk.h" #include "MetaRotator.h" - +#include "ClearMetaOnDrop.h" class cBlockRedstoneRepeaterHandler : - public cMetaRotator + public cClearMetaOnDrop > { public: cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockType) - : cMetaRotator(a_BlockType) + : cClearMetaOnDrop >(a_BlockType) { } @@ -44,13 +44,6 @@ public: } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - // Reset meta to 0 - a_Pickups.push_back(cItem(E_ITEM_REDSTONE_REPEATER, 1, 0)); - } - - virtual bool IsUseable(void) override { return true; diff --git a/src/Blocks/BlockStone.h b/src/Blocks/BlockStone.h index cd5230f49..697ab0312 100644 --- a/src/Blocks/BlockStone.h +++ b/src/Blocks/BlockStone.h @@ -2,24 +2,21 @@ #pragma once #include "BlockHandler.h" +#include "ClearMetaOnDrop.h" class cBlockStoneHandler : - public cBlockHandler + public cClearMetaOnDrop { public: cBlockStoneHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cClearMetaOnDrop(a_BlockType) { } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - a_Pickups.push_back(cItem(E_BLOCK_COBBLESTONE, 1, 0)); - } } ; -- cgit v1.2.3 From 2cd3443fbbb498f06227ed44db0c6a749cafdb76 Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 14 Jul 2014 21:21:17 +0100 Subject: Added documentation --- src/Blocks/ClearMetaOnDrop.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Blocks') diff --git a/src/Blocks/ClearMetaOnDrop.h b/src/Blocks/ClearMetaOnDrop.h index e6d26863a..3f8c33819 100644 --- a/src/Blocks/ClearMetaOnDrop.h +++ b/src/Blocks/ClearMetaOnDrop.h @@ -1,6 +1,12 @@ #pragma once +// mixin for use to clear meta values when the block is converted to a pickup + +// Usage: inherit from this class, passing the parent class as the parameter Base +// For example to use in class Foo which should inherit Bar use +// class Foo : public cClearMetaOnDrop; + template class cClearMetaOnDrop : public Base { -- cgit v1.2.3 From 5b1552435f95887ba59c707e3635dcaf9cb358f4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 14 Jul 2014 21:57:44 +0100 Subject: Fixed some meta resetting bugs * Fixes #1174 * Fixes #1171 --- src/Blocks/BlockCloth.h | 7 ------- src/Blocks/BlockFarmland.h | 11 +++++++---- src/Blocks/BlockHandler.cpp | 2 +- src/Blocks/BlockHayBale.h | 1 - src/Blocks/BlockLadder.h | 22 ++++++++++++++-------- src/Blocks/BlockSideways.h | 12 ++++++------ 6 files changed, 28 insertions(+), 27 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockCloth.h b/src/Blocks/BlockCloth.h index a136d3b9d..3c1ae7c25 100644 --- a/src/Blocks/BlockCloth.h +++ b/src/Blocks/BlockCloth.h @@ -16,13 +16,6 @@ public: { } - - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - a_Pickups.push_back(cItem(E_BLOCK_WOOL, 1, a_BlockMeta)); - } - - virtual const char * GetStepSound(void) override { return "step.cloth"; diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h index 3dd5bcd1d..390b6e5ee 100644 --- a/src/Blocks/BlockFarmland.h +++ b/src/Blocks/BlockFarmland.h @@ -19,15 +19,13 @@ class cBlockFarmlandHandler : public cBlockHandler { - typedef cBlockHandler super; public: - cBlockFarmlandHandler(void) : - super(E_BLOCK_FARMLAND) + cBlockFarmlandHandler(BLOCKTYPE a_BlockType) : + cBlockHandler(a_BlockType) { } - 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; @@ -105,6 +103,11 @@ public: } } } + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.Add(E_BLOCK_DIRT, 1, 0); // Reset meta + } } ; diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 730774ab1..cef1f5f09 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -211,7 +211,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) case E_BLOCK_EMERALD_ORE: return new cBlockOreHandler (a_BlockType); case E_BLOCK_ENCHANTMENT_TABLE: return new cBlockEnchantmentTableHandler(a_BlockType); case E_BLOCK_ENDER_CHEST: return new cBlockEnderchestHandler (a_BlockType); - case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler ( ); + case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler (a_BlockType); case E_BLOCK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType); case E_BLOCK_FIRE: return new cBlockFireHandler (a_BlockType); case E_BLOCK_FLOWER_POT: return new cBlockFlowerPotHandler (a_BlockType); diff --git a/src/Blocks/BlockHayBale.h b/src/Blocks/BlockHayBale.h index 5b646e264..3c6472adb 100644 --- a/src/Blocks/BlockHayBale.h +++ b/src/Blocks/BlockHayBale.h @@ -1,7 +1,6 @@ #pragma once -#include "BlockHandler.h" #include "BlockSideways.h" diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index a605edf3f..7efd8e444 100644 --- a/src/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h @@ -41,21 +41,27 @@ public: } - static NIBBLETYPE DirectionToMetaData(eBlockFace a_Direction) // tolua_export - { // tolua_export + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.Add(m_BlockType, 1, 0); // Reset meta + } + + + static NIBBLETYPE DirectionToMetaData(eBlockFace a_Direction) + { switch (a_Direction) { case BLOCK_FACE_ZM: return 0x2; case BLOCK_FACE_ZP: return 0x3; case BLOCK_FACE_XM: return 0x4; case BLOCK_FACE_XP: return 0x5; - default: return 0x2; + default: return 0x2; } - } // tolua_export + } - static eBlockFace MetaDataToDirection(NIBBLETYPE a_MetaData) // tolua_export - { // tolua_export + static eBlockFace MetaDataToDirection(NIBBLETYPE a_MetaData) + { switch (a_MetaData) { case 0x2: return BLOCK_FACE_ZM; @@ -64,10 +70,10 @@ public: case 0x5: return BLOCK_FACE_XP; default: return BLOCK_FACE_ZM; } - } // tolua_export + } - /// Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure + /** Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure */ static eBlockFace FindSuitableBlockFace(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) { for (int FaceInt = BLOCK_FACE_ZM; FaceInt <= BLOCK_FACE_XP; FaceInt++) diff --git a/src/Blocks/BlockSideways.h b/src/Blocks/BlockSideways.h index d67c3aa24..5b37efd75 100644 --- a/src/Blocks/BlockSideways.h +++ b/src/Blocks/BlockSideways.h @@ -32,36 +32,36 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.Add(m_BlockType, 1, a_BlockMeta & 0x3); + a_Pickups.Add(m_BlockType, 1, a_BlockMeta & 0x3); // Reset meta } - inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_WoodMeta) + inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_Meta) { switch (a_BlockFace) { case BLOCK_FACE_YM: case BLOCK_FACE_YP: { - return a_WoodMeta; // Top or bottom, just return original + return a_Meta; // Top or bottom, just return original } case BLOCK_FACE_ZP: case BLOCK_FACE_ZM: { - return a_WoodMeta | 0x8; // North or south + return a_Meta | 0x8; // North or south } case BLOCK_FACE_XP: case BLOCK_FACE_XM: { - return a_WoodMeta | 0x4; // East or west + return a_Meta | 0x4; // East or west } default: { ASSERT(!"Unhandled block face!"); - return a_WoodMeta | 0xC; // No idea, give a special meta (all sides bark) + return a_Meta | 0xC; // No idea, give a special meta } } } -- cgit v1.2.3 From 8fd636aa7235698263e3b85388a4f6373cbedb76 Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 14 Jul 2014 23:59:24 +0100 Subject: Revert "Converted some blockhandlers to use cClearMetaOnDrop" This reverts commit 333f4f982cbd24ffcb376594eddef439b3f05e9e. --- src/Blocks/BlockBrewingStand.h | 10 +++++++--- src/Blocks/BlockCobWeb.h | 10 ++++++++-- src/Blocks/BlockFlowerPot.h | 9 +++++++-- src/Blocks/BlockLilypad.h | 9 +++++++-- src/Blocks/BlockMycelium.h | 8 ++++++-- src/Blocks/BlockRedstone.h | 11 +++++++++-- src/Blocks/BlockRedstoneLamp.h | 9 +++++++-- src/Blocks/BlockRedstoneRepeater.h | 13 ++++++++++--- src/Blocks/BlockStone.h | 9 ++++++--- 9 files changed, 67 insertions(+), 21 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockBrewingStand.h b/src/Blocks/BlockBrewingStand.h index 77e383b16..57642bcb6 100644 --- a/src/Blocks/BlockBrewingStand.h +++ b/src/Blocks/BlockBrewingStand.h @@ -2,21 +2,25 @@ #pragma once #include "BlockHandler.h" -#include "ClearMetaOnDrop.h" class cBlockBrewingStandHandler : - public cClearMetaOnDrop + public cBlockHandler { public: cBlockBrewingStandHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop(a_BlockType) + : cBlockHandler(a_BlockType) { } + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(E_ITEM_BREWING_STAND, 1, 0)); + } + virtual bool IsUseable() override { return true; diff --git a/src/Blocks/BlockCobWeb.h b/src/Blocks/BlockCobWeb.h index 29a6b8155..982bfaa30 100644 --- a/src/Blocks/BlockCobWeb.h +++ b/src/Blocks/BlockCobWeb.h @@ -10,13 +10,19 @@ class cBlockCobWebHandler : - public cClearMetaOnDrop + public cBlockHandler { public: cBlockCobWebHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop(a_BlockType) + : cBlockHandler(a_BlockType) { } + + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override + { + a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0)); + } } ; diff --git a/src/Blocks/BlockFlowerPot.h b/src/Blocks/BlockFlowerPot.h index 39fbe1bd9..fc75ef638 100644 --- a/src/Blocks/BlockFlowerPot.h +++ b/src/Blocks/BlockFlowerPot.h @@ -9,13 +9,18 @@ class cBlockFlowerPotHandler : - public cClearMetaOnDrop + public cBlockEntityHandler { public: cBlockFlowerPotHandler(BLOCKTYPE a_BlockType) : - cClearMetaOnDrop(a_BlockType) + cBlockEntityHandler(a_BlockType) { } + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(E_ITEM_FLOWER_POT, 1, 0)); + } } ; diff --git a/src/Blocks/BlockLilypad.h b/src/Blocks/BlockLilypad.h index fc37f360c..2dd4ec768 100644 --- a/src/Blocks/BlockLilypad.h +++ b/src/Blocks/BlockLilypad.h @@ -8,14 +8,19 @@ class cBlockLilypadHandler : - public cClearMetaOnDrop + public cBlockHandler { public: cBlockLilypadHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop(a_BlockType) + : cBlockHandler(a_BlockType) { } + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + // Reset meta to zero + a_Pickups.push_back(cItem(E_BLOCK_LILY_PAD, 1, 0)); + } }; diff --git a/src/Blocks/BlockMycelium.h b/src/Blocks/BlockMycelium.h index 4d4a0bb4f..2a8ef5fca 100644 --- a/src/Blocks/BlockMycelium.h +++ b/src/Blocks/BlockMycelium.h @@ -8,16 +8,20 @@ class cBlockMyceliumHandler : - public cClearMetaOnDrop + public cBlockHandler { public: cBlockMyceliumHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop(a_BlockType) + : cBlockHandler(a_BlockType) { } // TODO: Add Mycel Spread + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0)); + } virtual const char * GetStepSound(void) override { diff --git a/src/Blocks/BlockRedstone.h b/src/Blocks/BlockRedstone.h index 6dbf46a57..a898c9acb 100644 --- a/src/Blocks/BlockRedstone.h +++ b/src/Blocks/BlockRedstone.h @@ -9,11 +9,11 @@ class cBlockRedstoneHandler : - public cClearMetaOnDrop + public cBlockHandler { public: cBlockRedstoneHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop(a_BlockType) + : cBlockHandler(a_BlockType) { } @@ -22,6 +22,13 @@ public: { return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); } + + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + // Reset meta to 0 + a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, 1)); + } } ; diff --git a/src/Blocks/BlockRedstoneLamp.h b/src/Blocks/BlockRedstoneLamp.h index 4b0ca5b34..69a2b27c2 100644 --- a/src/Blocks/BlockRedstoneLamp.h +++ b/src/Blocks/BlockRedstoneLamp.h @@ -8,13 +8,18 @@ class cBlockRedstoneLampHandler : - public cClearMetaOnDrop + public cBlockHandler { public: cBlockRedstoneLampHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop(a_BlockType) + : 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 1e9c00f2e..fe6cd21b9 100644 --- a/src/Blocks/BlockRedstoneRepeater.h +++ b/src/Blocks/BlockRedstoneRepeater.h @@ -4,16 +4,16 @@ #include "BlockHandler.h" #include "Chunk.h" #include "MetaRotator.h" -#include "ClearMetaOnDrop.h" + class cBlockRedstoneRepeaterHandler : - public cClearMetaOnDrop > + public cMetaRotator { public: cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop >(a_BlockType) + : cMetaRotator(a_BlockType) { } @@ -44,6 +44,13 @@ public: } + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + // Reset meta to 0 + a_Pickups.push_back(cItem(E_ITEM_REDSTONE_REPEATER, 1, 0)); + } + + virtual bool IsUseable(void) override { return true; diff --git a/src/Blocks/BlockStone.h b/src/Blocks/BlockStone.h index 697ab0312..cd5230f49 100644 --- a/src/Blocks/BlockStone.h +++ b/src/Blocks/BlockStone.h @@ -2,21 +2,24 @@ #pragma once #include "BlockHandler.h" -#include "ClearMetaOnDrop.h" class cBlockStoneHandler : - public cClearMetaOnDrop + public cBlockHandler { public: cBlockStoneHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop(a_BlockType) + : cBlockHandler(a_BlockType) { } + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(E_BLOCK_COBBLESTONE, 1, 0)); + } } ; -- cgit v1.2.3 From 0e5fa2662aa2b559335a25ee78cd086f795be79e Mon Sep 17 00:00:00 2001 From: Tycho Date: Tue, 15 Jul 2014 00:01:16 +0100 Subject: COnverted Lilypad back to mixin --- src/Blocks/BlockLilypad.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockLilypad.h b/src/Blocks/BlockLilypad.h index 2dd4ec768..c25f150c7 100644 --- a/src/Blocks/BlockLilypad.h +++ b/src/Blocks/BlockLilypad.h @@ -8,19 +8,13 @@ class cBlockLilypadHandler : - public cBlockHandler + public cClearMetaOnDrop { public: cBlockLilypadHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) + : cClearMetaOnDrop(a_BlockType) { } - - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - // Reset meta to zero - a_Pickups.push_back(cItem(E_BLOCK_LILY_PAD, 1, 0)); - } }; -- cgit v1.2.3 From 01a31a1872bb7c33d5a4d0a13dae083c4ef7792e Mon Sep 17 00:00:00 2001 From: Tycho Date: Tue, 15 Jul 2014 12:27:36 +0100 Subject: Added super typedef --- src/Blocks/BlockLadder.h | 3 ++- src/Blocks/BlockLilypad.h | 3 ++- src/Blocks/BlockPumpkin.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index 1af2be067..211bbdd9e 100644 --- a/src/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h @@ -12,9 +12,10 @@ class cBlockLadderHandler : public cClearMetaOnDrop > { + typedef cClearMetaOnDrop > super; public: cBlockLadderHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop >(a_BlockType) + : super(a_BlockType) { } diff --git a/src/Blocks/BlockLilypad.h b/src/Blocks/BlockLilypad.h index c25f150c7..1320174fc 100644 --- a/src/Blocks/BlockLilypad.h +++ b/src/Blocks/BlockLilypad.h @@ -10,9 +10,10 @@ class cBlockLilypadHandler : public cClearMetaOnDrop { +typedef cClearMetaOnDrop super; public: cBlockLilypadHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop(a_BlockType) + : super(a_BlockType) { } }; diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index f4022735b..d2e9d7843 100644 --- a/src/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h @@ -8,9 +8,10 @@ class cBlockPumpkinHandler : public cClearMetaOnDrop > { +typedef cClearMetaOnDrop > super; public: cBlockPumpkinHandler(BLOCKTYPE a_BlockType) - : cClearMetaOnDrop >(a_BlockType) + : super(a_BlockType) { } -- cgit v1.2.3 From 2d245264b1b630dd9c6af6ffb6e6387e011a3198 Mon Sep 17 00:00:00 2001 From: Masy98 Date: Tue, 15 Jul 2014 13:34:45 +0200 Subject: Added various missing blocks in the lists in BlockInfo.cpp --- src/Blocks/BlockPiston.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 27a44d829..1c8ac6a35 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -94,7 +94,6 @@ private: switch (a_BlockType) { case E_BLOCK_ANVIL: - case E_BLOCK_BED: case E_BLOCK_BEDROCK: case E_BLOCK_BREWING_STAND: case E_BLOCK_CHEST: -- cgit v1.2.3 From 9a970479efaef781ea8f69e3d8b8a1e2aa367847 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 15 Jul 2014 14:54:24 +0200 Subject: Fixed code formatting. --- src/Blocks/BlockLilypad.h | 7 ++++--- src/Blocks/BlockPumpkin.h | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockLilypad.h b/src/Blocks/BlockLilypad.h index 1320174fc..53277caa5 100644 --- a/src/Blocks/BlockLilypad.h +++ b/src/Blocks/BlockLilypad.h @@ -10,10 +10,11 @@ class cBlockLilypadHandler : public cClearMetaOnDrop { -typedef cClearMetaOnDrop super; + typedef cClearMetaOnDrop super; public: - cBlockLilypadHandler(BLOCKTYPE a_BlockType) - : super(a_BlockType) + + cBlockLilypadHandler(BLOCKTYPE a_BlockType) : + super(a_BlockType) { } }; diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index d2e9d7843..4692a47df 100644 --- a/src/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h @@ -8,12 +8,14 @@ class cBlockPumpkinHandler : public cClearMetaOnDrop > { -typedef cClearMetaOnDrop > super; + typedef cClearMetaOnDrop > super; public: - cBlockPumpkinHandler(BLOCKTYPE a_BlockType) - : super(a_BlockType) + + cBlockPumpkinHandler(BLOCKTYPE a_BlockType) : + super(a_BlockType) { } + virtual void OnPlacedByPlayer(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, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override { -- cgit v1.2.3 From 68cc9c6f91bbbadedf3641099e0aa17352e4dde8 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 17 Jul 2014 21:35:34 +0200 Subject: Fix sapling drop. --- src/Blocks/BlockSapling.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h index 3d925029a..3f443b734 100644 --- a/src/Blocks/BlockSapling.h +++ b/src/Blocks/BlockSapling.h @@ -21,7 +21,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { // Only the first 2 bits contain the display information, the others are for growing - a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 3)); + a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x7)); } -- cgit v1.2.3 From 2423fbf2efa39e28cc348acc11b9269e573dcdef Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:15:34 +0200 Subject: Normalized comments. This was mostly done automatically and then visually inspected for obvious errors. All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign. --- src/Blocks/BlockBed.cpp | 8 ++++---- src/Blocks/BlockButton.h | 2 +- src/Blocks/BlockComparator.h | 2 +- src/Blocks/BlockDropSpenser.h | 4 ++-- src/Blocks/BlockEnderchest.h | 2 +- src/Blocks/BlockFarmland.h | 2 +- src/Blocks/BlockFire.h | 32 ++++++++++++++++---------------- src/Blocks/BlockLadder.h | 2 +- src/Blocks/BlockLeaves.h | 2 +- src/Blocks/BlockPiston.cpp | 4 ++-- src/Blocks/BlockPiston.h | 2 +- src/Blocks/BlockPortal.h | 4 ++-- src/Blocks/BlockQuartz.h | 10 +++++----- src/Blocks/BlockRail.h | 2 +- src/Blocks/BlockRedstoneRepeater.h | 2 +- src/Blocks/BlockSideways.h | 10 +++++----- src/Blocks/BlockSnow.h | 4 ++-- src/Blocks/BlockStairs.h | 2 +- src/Blocks/BlockTorch.h | 12 ++++++------ src/Blocks/MetaRotator.h | 2 +- 20 files changed, 55 insertions(+), 55 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp index 6a3c6a55b..32b5133c7 100644 --- a/src/Blocks/BlockBed.cpp +++ b/src/Blocks/BlockBed.cpp @@ -122,16 +122,16 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface else { // Is foot end - VERIFY((Meta & 0x4) != 0x4); // Occupied flag should never be set, else our compilator (intended) is broken + VERIFY((Meta & 0x4) != 0x4); // Occupied flag should never be set, else our compilator (intended) is broken PillowDirection = MetaDataToDirection(Meta & 0x7); - if (a_ChunkInterface.GetBlock(a_BlockX + PillowDirection.x, a_BlockY, a_BlockZ + PillowDirection.z) == E_BLOCK_BED) // Must always use pillow location for sleeping + if (a_ChunkInterface.GetBlock(a_BlockX + PillowDirection.x, a_BlockY, a_BlockZ + PillowDirection.z) == E_BLOCK_BED) // Must always use pillow location for sleeping { a_WorldInterface.GetBroadcastManager().BroadcastUseBed(*a_Player, a_BlockX + PillowDirection.x, a_BlockY, a_BlockZ + PillowDirection.z); } } - a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta | 0x4); // Where 0x4 = occupied bit + a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta | 0x4); // Where 0x4 = occupied bit a_Player->SetIsInBed(true); cTimeFastForwardTester Tester; @@ -140,7 +140,7 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface cPlayerBedStateUnsetter Unsetter(Vector3i(a_BlockX + PillowDirection.x, a_BlockY, a_BlockZ + PillowDirection.z), a_WorldInterface); a_WorldInterface.ForEachPlayer(Unsetter); a_WorldInterface.SetTimeOfDay(0); - a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0xB); // Where 0xB = 1011, and zero is to make sure 'occupied' bit is always unset + a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0xB); // Where 0xB = 1011, and zero is to make sure 'occupied' bit is always unset } } } diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 7f92681dc..9fc5e4626 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -74,7 +74,7 @@ public: default: { ASSERT(!"Unhandled block face!"); - return 0x0; // No idea, give a special meta (button in centre of block) + return 0x0; // No idea, give a special meta (button in centre of block) } } } diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h index 4dd05366d..6caaaab13 100644 --- a/src/Blocks/BlockComparator.h +++ b/src/Blocks/BlockComparator.h @@ -22,7 +22,7 @@ public: virtual void 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); - Meta ^= 0x04; // Toggle 3rd (addition/subtraction) bit with XOR + Meta ^= 0x04; // Toggle 3rd (addition/subtraction) bit with XOR a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); } diff --git a/src/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h index e2b3039fd..cf240fa60 100644 --- a/src/Blocks/BlockDropSpenser.h +++ b/src/Blocks/BlockDropSpenser.h @@ -43,8 +43,8 @@ public: // Mirrors defined by by a table. (Source, mincraft.gamepedia.com) 0x07 == 0111 switch (a_Meta & 0x07) { - case 0x00: return 0x01 + OtherMeta; // Down -> Up - case 0x01: return 0x00 + OtherMeta; // Up -> Down + case 0x00: return 0x01 + OtherMeta; // Down -> Up + case 0x01: return 0x00 + OtherMeta; // Up -> Down } // Not Facing Up or Down; No change. return a_Meta; diff --git a/src/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h index 67955f8ce..4672f1459 100644 --- a/src/Blocks/BlockEnderchest.h +++ b/src/Blocks/BlockEnderchest.h @@ -18,7 +18,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - //todo: Drop Ender Chest if using silk touch pickaxe + // todo: Drop Ender Chest if using silk touch pickaxe a_Pickups.push_back(cItem(E_BLOCK_OBSIDIAN, 8, 0)); } diff --git a/src/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h index 390b6e5ee..ed0592acd 100644 --- a/src/Blocks/BlockFarmland.h +++ b/src/Blocks/BlockFarmland.h @@ -106,7 +106,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.Add(E_BLOCK_DIRT, 1, 0); // Reset meta + a_Pickups.Add(E_BLOCK_DIRT, 1, 0); // Reset meta } } ; diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h index 147e4b53e..f52825362 100644 --- a/src/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h @@ -100,7 +100,7 @@ public: /// Evaluates if coords have a valid border on top, based on MaxY bool EvaluatePortalBorder(int X, int FoundObsidianY, int Z, int MaxY, cChunkInterface & a_ChunkInterface) { - for (int checkBorder = FoundObsidianY + 1; checkBorder <= MaxY - 1; checkBorder++) // FoundObsidianY + 1: FoundObsidianY has already been checked in FindObsidianCeiling; MaxY - 1: portal doesn't need corners + for (int checkBorder = FoundObsidianY + 1; checkBorder <= MaxY - 1; checkBorder++) // FoundObsidianY + 1: FoundObsidianY has already been checked in FindObsidianCeiling; MaxY - 1: portal doesn't need corners { if (a_ChunkInterface.GetBlock(X, checkBorder, Z) != E_BLOCK_OBSIDIAN) { @@ -115,10 +115,10 @@ public: /// Finds entire frame in any direction with the coordinates of a base block and fills hole with nether portal (START HERE) void FindAndSetPortalFrame(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface) { - int MaxY = FindObsidianCeiling(X, Y, Z, a_ChunkInterface); // Get topmost obsidian block as reference for all other checks - int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add/subtract one as we've checked the original already the line above + int MaxY = FindObsidianCeiling(X, Y, Z, a_ChunkInterface); // Get topmost obsidian block as reference for all other checks + int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add/subtract one as we've checked the original already the line above - if (MaxY == 0) // Oh noes! Not a portal coordinate :( + if (MaxY == 0) // Oh noes! Not a portal coordinate :( { return; } @@ -127,11 +127,11 @@ public: { if (!FindPortalSliceZ(X, Y, Z1, Z2, MaxY, a_ChunkInterface)) { - return; // No eligible portal construct, abort abort abort!! + return; // No eligible portal construct, abort abort abort!! } } - for (int Height = Y + 1; Height <= MaxY - 1; Height++) // Loop through boundary to set portal blocks + for (int Height = Y + 1; Height <= MaxY - 1; Height++) // Loop through boundary to set portal blocks { for (int Width = XZM; Width <= XZP; Width++) { @@ -153,23 +153,23 @@ public: /// Takes coordinates of base block and Y coord of target obsidian ceiling bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface & a_ChunkInterface) { - Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction) + Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction) bool FoundFrameXP = false, FoundFrameXM = false; - for (; ((a_ChunkInterface.GetBlock(X1, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X1, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X1++) // Check XP for obsidian blocks, exempting corners + for (; ((a_ChunkInterface.GetBlock(X1, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X1, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X1++) // Check XP for obsidian blocks, exempting corners { int Value = FindObsidianCeiling(X1, Y, Z, a_ChunkInterface, MaxY); - int ValueTwo = FindObsidianCeiling(X1, Y + 1, Z, a_ChunkInterface, MaxY); // For corners without obsidian - if ((Value == -1) || (ValueTwo == -1)) // FindObsidianCeiling returns -1 upon frame-find + int ValueTwo = FindObsidianCeiling(X1, Y + 1, Z, a_ChunkInterface, MaxY); // For corners without obsidian + if ((Value == -1) || (ValueTwo == -1)) // FindObsidianCeiling returns -1 upon frame-find { - FoundFrameXP = true; // Found a frame border in this direction, proceed in other direction (don't go further) + FoundFrameXP = true; // Found a frame border in this direction, proceed in other direction (don't go further) break; } - else if ((Value != MaxY) && (ValueTwo != MaxY)) // Make sure that there is a valid portal 'slice' + else if ((Value != MaxY) && (ValueTwo != MaxY)) // Make sure that there is a valid portal 'slice' { - return false; // Not valid slice, no portal can be formed + return false; // Not valid slice, no portal can be formed } - } XZP = X1 - 1; // Set boundary of frame interior - for (; ((a_ChunkInterface.GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM) + } XZP = X1 - 1; // Set boundary of frame interior + for (; ((a_ChunkInterface.GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM) { int Value = FindObsidianCeiling(X2, Y, Z, a_ChunkInterface, MaxY); int ValueTwo = FindObsidianCeiling(X2, Y + 1, Z, a_ChunkInterface, MaxY); @@ -182,7 +182,7 @@ public: { return false; } - } XZM = X2 + 1; // Set boundary, see previous + } XZM = X2 + 1; // Set boundary, see previous return (FoundFrameXP && FoundFrameXM); } diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index 120396c7d..2c41083e7 100644 --- a/src/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h @@ -45,7 +45,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.Add(m_BlockType, 1, 0); // Reset meta + a_Pickups.Add(m_BlockType, 1, 0); // Reset meta } diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 495e849fa..260abefc7 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -76,7 +76,7 @@ public: virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay + a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay } diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp index ec480aaea..6ffb56abd 100644 --- a/src/Blocks/BlockPiston.cpp +++ b/src/Blocks/BlockPiston.cpp @@ -235,7 +235,7 @@ void cBlockPistonHandler::RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // cBlockPistonHeadHandler: cBlockPistonHeadHandler::cBlockPistonHeadHandler(void) : @@ -262,7 +262,7 @@ void cBlockPistonHeadHandler::OnDestroyedByPlayer(cChunkInterface & a_ChunkInter a_ChunkInterface.DigBlock(a_WorldInterface, newX, newY, newZ); if (a_Player->IsGameModeCreative()) { - return; // No pickups if creative + return; // No pickups if creative } cItems Pickups; diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 1c8ac6a35..307539476 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -132,7 +132,7 @@ private: { if (cBlockInfo::IsPistonBreakable(a_BlockType)) { - return false; // CanBreakPush returns true, but we need false to prevent pulling + return false; // CanBreakPush returns true, but we need false to prevent pulling } return CanPush(a_BlockType, a_BlockMeta); diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index 3b8030028..d58b2f09d 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -36,7 +36,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - return; // No pickups + return; // No pickups } virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override @@ -57,7 +57,7 @@ public: { if ((a_RelY - 1 < 0) || (a_RelY + 1 > cChunkDef::Height)) { - return false; // In case someone places a portal with meta 1 or 2 at boundaries, and server tries to get invalid coords at Y - 1 or Y + 1 + return false; // In case someone places a portal with meta 1 or 2 at boundaries, and server tries to get invalid coords at Y - 1 or Y + 1 } switch (a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ)) diff --git a/src/Blocks/BlockQuartz.h b/src/Blocks/BlockQuartz.h index 9cc51490f..1b1f6f9f0 100644 --- a/src/Blocks/BlockQuartz.h +++ b/src/Blocks/BlockQuartz.h @@ -25,7 +25,7 @@ public: { a_BlockType = m_BlockType; NIBBLETYPE Meta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage); - if (Meta != E_META_QUARTZ_PILLAR) // Check if the block is a pillar block. + if (Meta != E_META_QUARTZ_PILLAR) // Check if the block is a pillar block. { a_BlockMeta = Meta; return true; @@ -42,25 +42,25 @@ public: case BLOCK_FACE_YM: case BLOCK_FACE_YP: { - return a_QuartzMeta; // Top or bottom, just return original + return a_QuartzMeta; // Top or bottom, just return original } case BLOCK_FACE_ZP: case BLOCK_FACE_ZM: { - return 0x4; // North or south + return 0x4; // North or south } case BLOCK_FACE_XP: case BLOCK_FACE_XM: { - return 0x3; // East or west + return 0x3; // East or west } default: { ASSERT(!"Unhandled block face!"); - return a_QuartzMeta; // No idea, give a special meta (all sides the same) + return a_QuartzMeta; // No idea, give a special meta (all sides the same) } } } diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 358b5ca11..6f3fa1bd5 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -140,7 +140,7 @@ public: { NIBBLETYPE Meta = 0; char RailsCnt = 0; - bool Neighbors[8]; // 0 - EAST, 1 - WEST, 2 - NORTH, 3 - SOUTH, 4 - EAST UP, 5 - WEST UP, 6 - NORTH UP, 7 - SOUTH UP + bool Neighbors[8]; // 0 - EAST, 1 - WEST, 2 - NORTH, 3 - SOUTH, 4 - EAST UP, 5 - WEST UP, 6 - NORTH UP, 7 - SOUTH UP memset(Neighbors, 0, sizeof(Neighbors)); Neighbors[0] = (IsUnstable(a_ChunkInterface, a_BlockX + 1, a_BlockY, a_BlockZ) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST, E_PURE_DOWN)); Neighbors[1] = (IsUnstable(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST, E_PURE_DOWN)); diff --git a/src/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h index fe6cd21b9..4c8a6a087 100644 --- a/src/Blocks/BlockRedstoneRepeater.h +++ b/src/Blocks/BlockRedstoneRepeater.h @@ -71,7 +71,7 @@ public: inline static NIBBLETYPE RepeaterRotationToMetaData(double a_Rotation) { - a_Rotation += 90 + 45; // So its not aligned with axis + a_Rotation += 90 + 45; // So its not aligned with axis if (a_Rotation > 360) { a_Rotation -= 360; diff --git a/src/Blocks/BlockSideways.h b/src/Blocks/BlockSideways.h index 5b37efd75..9cbd4cf97 100644 --- a/src/Blocks/BlockSideways.h +++ b/src/Blocks/BlockSideways.h @@ -32,7 +32,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - a_Pickups.Add(m_BlockType, 1, a_BlockMeta & 0x3); // Reset meta + a_Pickups.Add(m_BlockType, 1, a_BlockMeta & 0x3); // Reset meta } @@ -43,25 +43,25 @@ public: case BLOCK_FACE_YM: case BLOCK_FACE_YP: { - return a_Meta; // Top or bottom, just return original + return a_Meta; // Top or bottom, just return original } case BLOCK_FACE_ZP: case BLOCK_FACE_ZM: { - return a_Meta | 0x8; // North or south + return a_Meta | 0x8; // North or south } case BLOCK_FACE_XP: case BLOCK_FACE_XM: { - return a_Meta | 0x4; // East or west + return a_Meta | 0x4; // East or west } default: { ASSERT(!"Unhandled block face!"); - return a_Meta | 0xC; // No idea, give a special meta + return a_Meta | 0xC; // No idea, give a special meta } } } diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h index b21995d3c..c5ae4a5a6 100644 --- a/src/Blocks/BlockSnow.h +++ b/src/Blocks/BlockSnow.h @@ -47,12 +47,12 @@ public: { if ((a_Player->GetEquippedItem().m_ItemType == E_BLOCK_SNOW) && (a_Meta < 7)) { - return true; // If a player is holding a (thin) snow block and it's size can be increased, return collision ignored + return true; // If a player is holding a (thin) snow block and it's size can be increased, return collision ignored } if (a_Meta == 0) { - return true; // If at normal snowfall height (lowest), we ignore collision + return true; // If at normal snowfall height (lowest), we ignore collision } return false; diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h index a49fda5ae..e74ab0094 100644 --- a/src/Blocks/BlockStairs.h +++ b/src/Blocks/BlockStairs.h @@ -85,7 +85,7 @@ public: static NIBBLETYPE RotationToMetaData(double a_Rotation) { - a_Rotation += 90 + 45; // So its not aligned with axis + a_Rotation += 90 + 45; // So its not aligned with axis if (a_Rotation > 360) { a_Rotation -= 360; diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index 44c33c429..554ab8125 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -28,7 +28,7 @@ public: if ((a_BlockFace == BLOCK_FACE_TOP) || (a_BlockFace == BLOCK_FACE_BOTTOM)) { - a_BlockFace = FindSuitableFace(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); // Top or bottom faces clicked, find a suitable face + a_BlockFace = FindSuitableFace(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); // Top or bottom faces clicked, find a suitable face if (a_BlockFace == BLOCK_FACE_NONE) { // Client wouldn't have sent anything anyway, but whatever @@ -38,10 +38,10 @@ public: else { // Not top or bottom faces, try to preserve whatever face was clicked - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true); // Set to clicked block + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true); // Set to clicked block if (!CanBePlacedOn(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ), a_BlockFace)) { - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false); // Reset to torch block + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false); // Reset to torch block // Torch couldn't be placed on whatever face was clicked, last ditch resort - find another face a_BlockFace = FindSuitableFace(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); if (a_BlockFace == BLOCK_FACE_NONE) @@ -113,13 +113,13 @@ 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) { - for (int i = BLOCK_FACE_YM; i <= BLOCK_FACE_XP; i++) // Loop through all directions + for (int i = BLOCK_FACE_YM; i <= BLOCK_FACE_XP; i++) // Loop through all directions { eBlockFace Face = static_cast(i); AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, Face, true); BLOCKTYPE BlockInQuestion = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ); - if ( // If on a block that can only hold a torch if torch is standing on it, return that face + if ( // If on a block that can only hold a torch if torch is standing on it, return that face ((BlockInQuestion == E_BLOCK_GLASS) || (BlockInQuestion == E_BLOCK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || @@ -158,7 +158,7 @@ public: (BlockInQuestion == E_BLOCK_FENCE) || (BlockInQuestion == E_BLOCK_SOULSAND) || (BlockInQuestion == E_BLOCK_MOB_SPAWNER) || - (BlockInQuestion == E_BLOCK_END_PORTAL_FRAME) || // Actual vanilla behaviour + (BlockInQuestion == E_BLOCK_END_PORTAL_FRAME) || // Actual vanilla behaviour (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || (BlockInQuestion == E_BLOCK_COBBLESTONE_WALL) ) diff --git a/src/Blocks/MetaRotator.h b/src/Blocks/MetaRotator.h index 899c583e1..ad8f36183 100644 --- a/src/Blocks/MetaRotator.h +++ b/src/Blocks/MetaRotator.h @@ -6,7 +6,7 @@ // MSVC generates warnings for the templated AssertIfNotMatched parameter conditions, so disable it: #ifdef _MSC_VER - #pragma warning(disable: 4127) // Conditional expression is constant + #pragma warning(disable: 4127) // Conditional expression is constant #endif -- cgit v1.2.3 From 5e198c673009cf8ca9d92cf59848999bc96bbc37 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:50:58 +0200 Subject: Basic style fixes. --- src/Blocks/BlockAnvil.h | 2 +- src/Blocks/BlockBed.cpp | 4 ++-- src/Blocks/BlockBigFlower.h | 4 ++-- src/Blocks/BlockButton.h | 2 +- src/Blocks/BlockCarpet.h | 2 +- src/Blocks/BlockChest.h | 4 ++-- src/Blocks/BlockCrops.h | 2 +- src/Blocks/BlockDoor.cpp | 4 ++-- src/Blocks/BlockDoor.h | 2 +- src/Blocks/BlockDropSpenser.h | 2 +- src/Blocks/BlockFenceGate.h | 2 +- src/Blocks/BlockFluid.h | 2 +- src/Blocks/BlockFurnace.h | 4 ++-- src/Blocks/BlockHandler.cpp | 4 ++-- src/Blocks/BlockHandler.h | 22 +++++++++++----------- src/Blocks/BlockHopper.h | 2 +- src/Blocks/BlockIce.h | 2 +- src/Blocks/BlockLeaves.h | 8 ++++---- src/Blocks/BlockLever.h | 2 +- src/Blocks/BlockMobHead.h | 4 ++-- src/Blocks/BlockPiston.cpp | 2 +- src/Blocks/BlockPiston.h | 4 ++-- src/Blocks/BlockPlanks.h | 2 +- src/Blocks/BlockPortal.h | 2 +- src/Blocks/BlockPumpkin.h | 4 ++-- src/Blocks/BlockQuartz.h | 2 +- src/Blocks/BlockRail.h | 22 +++++++++++----------- src/Blocks/BlockSideways.h | 2 +- src/Blocks/BlockSign.h | 2 +- src/Blocks/BlockSlab.h | 2 +- src/Blocks/BlockSnow.h | 2 +- src/Blocks/BlockStairs.h | 2 +- src/Blocks/BlockTorch.h | 2 +- src/Blocks/BlockVine.h | 2 +- src/Blocks/BroadcastInterface.h | 2 +- src/Blocks/ChunkInterface.h | 2 +- src/Blocks/ClearMetaOnDrop.h | 2 +- src/Blocks/MetaRotator.h | 6 +++--- src/Blocks/WorldInterface.h | 2 +- 39 files changed, 73 insertions(+), 73 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockAnvil.h b/src/Blocks/BlockAnvil.h index 35a356678..5c4661c11 100644 --- a/src/Blocks/BlockAnvil.h +++ b/src/Blocks/BlockAnvil.h @@ -34,7 +34,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp index 32b5133c7..fbf98044c 100644 --- a/src/Blocks/BlockBed.cpp +++ b/src/Blocks/BlockBed.cpp @@ -116,7 +116,7 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface if (Meta & 0x8) { - // Is pillow + // Is pillow a_WorldInterface.GetBroadcastManager().BroadcastUseBed(*a_Player, a_BlockX, a_BlockY, a_BlockZ); } else @@ -142,7 +142,7 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface a_WorldInterface.SetTimeOfDay(0); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0xB); // Where 0xB = 1011, and zero is to make sure 'occupied' bit is always unset } - } + } } else { diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index 39fd3cac8..ff9825a83 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -86,8 +86,8 @@ public: virtual void OnPlacedByPlayer( - cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + 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, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) override diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 9fc5e4626..3b45afff8 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -46,7 +46,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockCarpet.h b/src/Blocks/BlockCarpet.h index 33dc1da6c..d1aa52687 100644 --- a/src/Blocks/BlockCarpet.h +++ b/src/Blocks/BlockCarpet.h @@ -32,7 +32,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h index f899f4bcb..28adbed4f 100644 --- a/src/Blocks/BlockChest.h +++ b/src/Blocks/BlockChest.h @@ -22,7 +22,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override @@ -68,7 +68,7 @@ public: virtual void OnPlacedByPlayer( - cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, + 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, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta diff --git a/src/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h index 8606cf3f3..ae6e490e1 100644 --- a/src/Blocks/BlockCrops.h +++ b/src/Blocks/BlockCrops.h @@ -71,7 +71,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 diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp index 934a01994..e80473cb5 100644 --- a/src/Blocks/BlockDoor.cpp +++ b/src/Blocks/BlockDoor.cpp @@ -152,7 +152,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta) // Return a_Meta if panel is a top panel (0x08 bit is set to 1) // Note: Currently, you can not properly mirror the hinges on a double door. The orientation of the door is stored - // in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time, + // in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time, // so the function can only see either the hinge position or orientation, but not both, at any given time. The class itself // needs extra datamembers. if (a_Meta & 0x08) return a_Meta; @@ -179,7 +179,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta) // Return a_Meta if panel is a top panel (0x08 bit is set to 1) // Note: Currently, you can not properly mirror the hinges on a double door. The orientation of the door is stored - // in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time, + // in only the bottom tile while the hinge position is in the top tile. This function only operates on one tile at a time, // so the function can only see either the hinge position or orientation, but not both, at any given time.The class itself // needs extra datamembers. diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h index 049c4a334..c86fe829b 100644 --- a/src/Blocks/BlockDoor.h +++ b/src/Blocks/BlockDoor.h @@ -28,7 +28,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h index cf240fa60..ba96c716a 100644 --- a/src/Blocks/BlockDropSpenser.h +++ b/src/Blocks/BlockDropSpenser.h @@ -24,7 +24,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockFenceGate.h b/src/Blocks/BlockFenceGate.h index e992870d4..433531275 100644 --- a/src/Blocks/BlockFenceGate.h +++ b/src/Blocks/BlockFenceGate.h @@ -19,7 +19,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index d0c4ea55b..8c0aae041 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -17,7 +17,7 @@ public: : cBlockHandler(a_BlockType) { - } + } virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override diff --git a/src/Blocks/BlockFurnace.h b/src/Blocks/BlockFurnace.h index 74582c3b3..2c7310ac9 100644 --- a/src/Blocks/BlockFurnace.h +++ b/src/Blocks/BlockFurnace.h @@ -13,7 +13,7 @@ class cBlockFurnaceHandler : public cMetaRotator { public: - cBlockFurnaceHandler(BLOCKTYPE a_BlockType) + cBlockFurnaceHandler(BLOCKTYPE a_BlockType) : cMetaRotator(a_BlockType) { } @@ -27,7 +27,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index cef1f5f09..97762f9bd 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -176,7 +176,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType) { switch(a_BlockType) { - // Block handlers, alphabetically sorted: + // Block handlers, alphabetically sorted: case E_BLOCK_ACACIA_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType); case E_BLOCK_ACTIVATOR_RAIL: return new cBlockRailHandler (a_BlockType); case E_BLOCK_ANVIL: return new cBlockAnvilHandler (a_BlockType); @@ -327,7 +327,7 @@ cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockType) bool cBlockHandler::GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index fb6cae729..7f23fc6ff 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -30,14 +30,14 @@ public: /// Note that the coords are chunk-relative! 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. + /** Called before a block is placed into a world. The handler should return true to allow placement, false to refuse. Also, the handler should set a_BlockType and a_BlockMeta to correct values for the newly placed block. Called by cItemHandler::GetPlacementBlockTypeMeta() if the item is a block */ virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ); @@ -47,8 +47,8 @@ public: /// Called by cClientHandle::HandlePlaceBlock() after the player has placed a new block. Called after OnPlaced(). virtual void OnPlacedByPlayer( - cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + 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, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ); @@ -90,7 +90,7 @@ public: virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta); /** Checks if the block can be placed at this point. - Default: CanBeAt(...) + 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); @@ -98,27 +98,27 @@ public: /// 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. + /** 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. + /** 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 */ virtual bool DoesIgnoreBuildCollision(void); /// Similar to DoesIgnoreBuildCollision(void), but is used for cases where block meta/player item-in-hand is needed to determine collision (thin snow) - virtual bool DoesIgnoreBuildCollision(cPlayer *, NIBBLETYPE a_Meta) - { + virtual bool DoesIgnoreBuildCollision(cPlayer *, NIBBLETYPE a_Meta) + { UNUSED(a_Meta); - return DoesIgnoreBuildCollision(); + return DoesIgnoreBuildCollision(); } /// Returns if this block drops if it gets destroyed by an unsuitable situation. Default: true virtual bool DoesDropOnUnsuitable(void); - /** Called when one of the neighbors gets set; equivalent to MC block update. + /** Called when one of the neighbors gets set; equivalent to MC block update. By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()), and wakes up all simulators on the block. */ diff --git a/src/Blocks/BlockHopper.h b/src/Blocks/BlockHopper.h index a882bb077..4a5d32dd5 100644 --- a/src/Blocks/BlockHopper.h +++ b/src/Blocks/BlockHopper.h @@ -19,7 +19,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockIce.h b/src/Blocks/BlockIce.h index 8dfe7ddac..c50623594 100644 --- a/src/Blocks/BlockIce.h +++ b/src/Blocks/BlockIce.h @@ -29,7 +29,7 @@ public: // TODO: Ice destroyed with air below it should turn into air instead of water a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_WATER, 0); // This is called later than the real destroying of this ice block - } + } } ; diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 260abefc7..d0baab013 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -100,10 +100,10 @@ public: int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; cBlockArea Area; if (!Area.Read( - a_Chunk.GetWorld(), - BlockX - LEAVES_CHECK_DISTANCE, BlockX + LEAVES_CHECK_DISTANCE, - a_RelY - LEAVES_CHECK_DISTANCE, a_RelY + LEAVES_CHECK_DISTANCE, - BlockZ - LEAVES_CHECK_DISTANCE, BlockZ + LEAVES_CHECK_DISTANCE, + a_Chunk.GetWorld(), + BlockX - LEAVES_CHECK_DISTANCE, BlockX + LEAVES_CHECK_DISTANCE, + a_RelY - LEAVES_CHECK_DISTANCE, a_RelY + LEAVES_CHECK_DISTANCE, + BlockZ - LEAVES_CHECK_DISTANCE, BlockZ + LEAVES_CHECK_DISTANCE, cBlockArea::baTypes) ) { diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index 7ce8d038e..4316fd06b 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -43,7 +43,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockMobHead.h b/src/Blocks/BlockMobHead.h index 301386568..ff1ef97bf 100644 --- a/src/Blocks/BlockMobHead.h +++ b/src/Blocks/BlockMobHead.h @@ -193,8 +193,8 @@ public: } virtual void OnPlacedByPlayer( - cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + 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, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) override diff --git a/src/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp index 6ffb56abd..164967621 100644 --- a/src/Blocks/BlockPiston.cpp +++ b/src/Blocks/BlockPiston.cpp @@ -62,7 +62,7 @@ void cBlockPistonHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorld bool cBlockPistonHandler::GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 307539476..bbb8af75b 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -17,7 +17,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override; @@ -75,7 +75,7 @@ public: return BLOCK_FACE_NONE; } } - } + } static void ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); static void RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); diff --git a/src/Blocks/BlockPlanks.h b/src/Blocks/BlockPlanks.h index 2a99a455e..de84ed319 100644 --- a/src/Blocks/BlockPlanks.h +++ b/src/Blocks/BlockPlanks.h @@ -18,7 +18,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index d58b2f09d..9ee5d69e2 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -19,7 +19,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index 4692a47df..15ac80fd7 100644 --- a/src/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h @@ -76,14 +76,14 @@ public: a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0); // Spawn the golem: - a_WorldInterface.SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtIronGolem); + a_WorldInterface.SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtIronGolem); } } virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockQuartz.h b/src/Blocks/BlockQuartz.h index 1b1f6f9f0..2ce7e71e4 100644 --- a/src/Blocks/BlockQuartz.h +++ b/src/Blocks/BlockQuartz.h @@ -18,7 +18,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 6f3fa1bd5..87ce069ab 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -31,7 +31,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override @@ -223,7 +223,7 @@ public: case E_META_RAIL_ZM_ZP: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH, E_PURE_DOWN) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH, E_PURE_DOWN) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH, E_PURE_DOWN) ) { @@ -235,7 +235,7 @@ public: case E_META_RAIL_XM_XP: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST, E_PURE_DOWN) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST, E_PURE_DOWN) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST, E_PURE_DOWN) ) { @@ -247,7 +247,7 @@ public: case E_META_RAIL_ASCEND_XP: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_EAST) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_EAST) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST) ) { @@ -259,7 +259,7 @@ public: case E_META_RAIL_ASCEND_XM: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_WEST) ) { @@ -271,7 +271,7 @@ public: case E_META_RAIL_ASCEND_ZM: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NORTH) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NORTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) ) { @@ -283,7 +283,7 @@ public: case E_META_RAIL_ASCEND_ZP: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_SOUTH) ) { @@ -295,7 +295,7 @@ public: case E_META_RAIL_CURVED_ZP_XP: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST) ) { @@ -307,7 +307,7 @@ public: case E_META_RAIL_CURVED_ZP_XM: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_SOUTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST) ) { @@ -319,7 +319,7 @@ public: case E_META_RAIL_CURVED_ZM_XM: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_WEST) ) { @@ -331,7 +331,7 @@ public: case E_META_RAIL_CURVED_ZM_XP: { if ( - IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || + IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_NORTH) || IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, BLOCK_FACE_EAST) ) { diff --git a/src/Blocks/BlockSideways.h b/src/Blocks/BlockSideways.h index 9cbd4cf97..f5f10899d 100644 --- a/src/Blocks/BlockSideways.h +++ b/src/Blocks/BlockSideways.h @@ -18,7 +18,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockSign.h b/src/Blocks/BlockSign.h index f5630bdb0..5aa8ade3d 100644 --- a/src/Blocks/BlockSign.h +++ b/src/Blocks/BlockSign.h @@ -59,7 +59,7 @@ public: } } return 0x2; - } + } virtual void OnPlacedByPlayer( diff --git a/src/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index 6c861be86..214445eda 100644 --- a/src/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h @@ -33,7 +33,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h index c5ae4a5a6..27fc17e7f 100644 --- a/src/Blocks/BlockSnow.h +++ b/src/Blocks/BlockSnow.h @@ -19,7 +19,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h index e74ab0094..a7ccf1714 100644 --- a/src/Blocks/BlockStairs.h +++ b/src/Blocks/BlockStairs.h @@ -20,7 +20,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index 554ab8125..73f2bf9a8 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -19,7 +19,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h index 7bb9dc484..c2d82eb4d 100644 --- a/src/Blocks/BlockVine.h +++ b/src/Blocks/BlockVine.h @@ -18,7 +18,7 @@ public: virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override diff --git a/src/Blocks/BroadcastInterface.h b/src/Blocks/BroadcastInterface.h index fbe72e72f..c8593c76a 100644 --- a/src/Blocks/BroadcastInterface.h +++ b/src/Blocks/BroadcastInterface.h @@ -1,7 +1,7 @@ #pragma once -class cBroadcastInterface +class cBroadcastInterface { public: virtual ~cBroadcastInterface() {} diff --git a/src/Blocks/ChunkInterface.h b/src/Blocks/ChunkInterface.h index be7c2e0e5..f9cbe3a2d 100644 --- a/src/Blocks/ChunkInterface.h +++ b/src/Blocks/ChunkInterface.h @@ -21,7 +21,7 @@ public: return m_ChunkMap->GetBlock(a_BlockX,a_BlockY,a_BlockZ); } BLOCKTYPE GetBlock(const Vector3i & a_Pos) - { + { return GetBlock(a_Pos.x, a_Pos.y, a_Pos.z); } NIBBLETYPE GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) diff --git a/src/Blocks/ClearMetaOnDrop.h b/src/Blocks/ClearMetaOnDrop.h index 3f8c33819..f2afbc6ea 100644 --- a/src/Blocks/ClearMetaOnDrop.h +++ b/src/Blocks/ClearMetaOnDrop.h @@ -4,7 +4,7 @@ // mixin for use to clear meta values when the block is converted to a pickup // Usage: inherit from this class, passing the parent class as the parameter Base -// For example to use in class Foo which should inherit Bar use +// For example to use in class Foo which should inherit Bar use // class Foo : public cClearMetaOnDrop; template diff --git a/src/Blocks/MetaRotator.h b/src/Blocks/MetaRotator.h index ad8f36183..599aa7ef9 100644 --- a/src/Blocks/MetaRotator.h +++ b/src/Blocks/MetaRotator.h @@ -47,8 +47,8 @@ NIBBLETYPE cMetaRotator Date: Thu, 17 Jul 2014 22:59:02 +0200 Subject: More trailing whitespace fixes. --- src/Blocks/BlockLadder.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index 2c41083e7..72acced41 100644 --- a/src/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h @@ -12,17 +12,17 @@ class cBlockLadderHandler : public cClearMetaOnDrop > { - typedef cClearMetaOnDrop > super; + typedef cClearMetaOnDrop > super; public: cBlockLadderHandler(BLOCKTYPE a_BlockType) : super(a_BlockType) { - } + } virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer * a_Player, - int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, + int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta ) override -- cgit v1.2.3 From c03161f75d22a7965aea20fb9843ae580a07079a Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 23:15:53 +0200 Subject: Fixed tabs used for alignment. --- src/Blocks/BlockSnow.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Blocks') diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h index 27fc17e7f..977f19a16 100644 --- a/src/Blocks/BlockSnow.h +++ b/src/Blocks/BlockSnow.h @@ -33,8 +33,8 @@ public: if ((BlockBeforePlacement == E_BLOCK_SNOW) && (MetaBeforePlacement < 7)) { // Only increment if: - // A snow block was already there (not first time placement) AND - // Height is smaller than 7, the maximum possible height + // - A snow block was already there (not first time placement) AND + // - Height is smaller than 7, the maximum possible height MetaBeforePlacement++; } -- cgit v1.2.3