From ecfe6ab65bd1fc2c7f5733fe6ef4e6ddaac44a26 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 23 Sep 2012 22:09:57 +0000 Subject: Source files cleanup: The rest of the files renamed. git-svn-id: http://mc-server.googlecode.com/svn/trunk@887 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/blocks/Block.cpp | 445 -------------------------------- source/blocks/Block.h | 90 ------- source/blocks/BlockCactus.h | 2 +- source/blocks/BlockChest.h | 6 +- source/blocks/BlockCloth.h | 2 +- source/blocks/BlockCrops.h | 4 +- source/blocks/BlockDirt.h | 4 +- source/blocks/BlockDispenser.h | 6 +- source/blocks/BlockDoor.cpp | 8 +- source/blocks/BlockDoor.h | 2 +- source/blocks/BlockEntity.h | 2 +- source/blocks/BlockFire.h | 2 +- source/blocks/BlockFlower.h | 2 +- source/blocks/BlockFluid.h | 2 +- source/blocks/BlockFurnace.h | 6 +- source/blocks/BlockGlowstone.h | 2 +- source/blocks/BlockGravel.h | 2 +- source/blocks/BlockHandler.cpp | 445 ++++++++++++++++++++++++++++++++ source/blocks/BlockHandler.h | 90 +++++++ source/blocks/BlockIce.h | 4 +- source/blocks/BlockLadder.h | 6 +- source/blocks/BlockLeaves.h | 4 +- source/blocks/BlockMelon.h | 2 +- source/blocks/BlockMushroom.h | 2 +- source/blocks/BlockNote.h | 2 +- source/blocks/BlockOre.h | 4 +- source/blocks/BlockPiston.cpp | 10 +- source/blocks/BlockPiston.h | 2 +- source/blocks/BlockRedstone.cpp | 8 +- source/blocks/BlockRedstone.h | 4 +- source/blocks/BlockRedstoneRepeater.cpp | 8 +- source/blocks/BlockRedstoneRepeater.h | 4 +- source/blocks/BlockRedstoneTorch.h | 2 +- source/blocks/BlockSand.h | 2 +- source/blocks/BlockSapling.h | 4 +- source/blocks/BlockSign.h | 8 +- source/blocks/BlockSlab.h | 2 +- source/blocks/BlockSnow.h | 2 +- source/blocks/BlockStairs.h | 4 +- source/blocks/BlockStems.h | 4 +- source/blocks/BlockStone.h | 4 +- source/blocks/BlockSugarcane.h | 2 +- source/blocks/BlockTallGrass.h | 2 +- source/blocks/BlockTorch.h | 6 +- source/blocks/BlockVine.h | 4 +- source/blocks/BlockWood.h | 2 +- source/blocks/BlockWorkbench.h | 4 +- 47 files changed, 617 insertions(+), 617 deletions(-) delete mode 100644 source/blocks/Block.cpp delete mode 100644 source/blocks/Block.h create mode 100644 source/blocks/BlockHandler.cpp create mode 100644 source/blocks/BlockHandler.h (limited to 'source/blocks') diff --git a/source/blocks/Block.cpp b/source/blocks/Block.cpp deleted file mode 100644 index 98868de7d..000000000 --- a/source/blocks/Block.cpp +++ /dev/null @@ -1,445 +0,0 @@ -#include "Globals.h" -#include "Block.h" -#include "../cItem.h" -#include "../cWorld.h" -#include "BlockSand.h" -#include "BlockGravel.h" -#include "BlockDoor.h" -#include "BlockFire.h" -#include "BlockRedstone.h" -#include "BlockRedstoneTorch.h" -#include "BlockRedstoneRepeater.h" -#include "BlockPiston.h" -#include "BlockWorkbench.h" -#include "BlockEntity.h" -#include "BlockVine.h" -#include "BlockTallGrass.h" -#include "BlockSnow.h" -#include "BlockCloth.h" -#include "BlockSlab.h" -#include "BlockDirt.h" -#include "BlockTorch.h" -#include "BlockWood.h" -#include "BlockLeaves.h" -#include "BlockSapling.h" -#include "BlockFluid.h" -#include "BlockChest.h" -#include "BlockFurnace.h" -#include "BlockDispenser.h" -#include "BlockStairs.h" -#include "BlockLadder.h" -#include "BlockSign.h" -#include "BlockCrops.h" -#include "BlockSugarcane.h" -#include "BlockFlower.h" -#include "BlockMushroom.h" -#include "BlockCactus.h" -#include "BlockStems.h" -#include "BlockGlowstone.h" -#include "BlockStone.h" -#include "BlockMelon.h" -#include "BlockIce.h" -#include "BlockOre.h" -#include "BlockNote.h" - - - - - -bool cBlockHandler::m_HandlerInitialized = false; -cBlockHandler *cBlockHandler::m_BlockHandler[256]; - - - - - -cBlockHandler *cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockID) -{ - if (!m_HandlerInitialized) - { - //We have to initialize - memset(m_BlockHandler, 0, sizeof(m_BlockHandler)); - m_HandlerInitialized = true; - } - if (m_BlockHandler[a_BlockID] != NULL) - { - return m_BlockHandler[a_BlockID]; - } - - return m_BlockHandler[a_BlockID] = CreateBlockHandler(a_BlockID); -} - - - - - -cBlockHandler *cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockID) -{ - switch(a_BlockID) - { - case E_BLOCK_SAND: - return new cBlockSandHandler(a_BlockID); - case E_BLOCK_GRAVEL: - return new cBlockGravelHandler(a_BlockID); - case E_BLOCK_WOODEN_DOOR: - case E_BLOCK_IRON_DOOR: - return new cBlockDoorHandler(a_BlockID); - case E_BLOCK_FIRE: - return new cBlockFireHandler(a_BlockID); - case E_BLOCK_REDSTONE_TORCH_ON: - case E_BLOCK_REDSTONE_TORCH_OFF: - return new cBlockRedstoneTorchHandler(a_BlockID); - case E_BLOCK_REDSTONE_WIRE: - return new cBlockRedstoneHandler(a_BlockID); - case E_BLOCK_PISTON: - case E_BLOCK_STICKY_PISTON: - return new cBlockPistonHandler(a_BlockID); - case E_BLOCK_REDSTONE_REPEATER_ON: - case E_BLOCK_REDSTONE_REPEATER_OFF: - return new cBlockRedstoneRepeaterHandler(a_BlockID); - case E_BLOCK_WORKBENCH: - return new cBlockWorkbenchHandler(a_BlockID); - case E_BLOCK_SNOW: - return new cBlockSnowHandler(a_BlockID); - case E_BLOCK_TALL_GRASS: - return new cBlockTallGrassHandler(a_BlockID); - case E_BLOCK_VINES: - return new cBlockVineHandler(a_BlockID); - case ::E_BLOCK_WOOL: - return new cBlockClothHandler(a_BlockID); - case E_BLOCK_WOODEN_SLAB: - case E_BLOCK_STONE_SLAB: - case E_BLOCK_DOUBLE_WOODEN_SLAB: - case E_BLOCK_DOUBLE_STONE_SLAB: - return new cBlockSlabHandler(a_BlockID); - case E_BLOCK_LOG: - case E_BLOCK_PLANKS: - return new cBlockWoodHandler(a_BlockID); - case E_BLOCK_TORCH: - return new cBlockTorchHandler(a_BlockID); - case E_BLOCK_DIRT: - case E_BLOCK_GRASS: - return new cBlockDirtHandler(a_BlockID); - case E_BLOCK_LEAVES: - return new cBlockLeavesHandler(a_BlockID); - case E_BLOCK_SAPLING: - return new cBlockSaplingHandler(a_BlockID); - case E_BLOCK_WATER: - case E_BLOCK_STATIONARY_WATER: - case E_BLOCK_STATIONARY_LAVA: - case E_BLOCK_LAVA: - return new cBlockFluidHandler(a_BlockID); - case E_BLOCK_DISPENSER: - return new cBlockDispenserHandler(a_BlockID); - case E_BLOCK_FURNACE: - case E_BLOCK_LIT_FURNACE: - return new cBlockFurnaceHandler(a_BlockID); - case E_BLOCK_CHEST: - return new cBlockChestHandler(a_BlockID); - case E_BLOCK_ICE: - return new cBlockIceHandler(a_BlockID); - case E_BLOCK_LADDER: - return new cBlockLadderHandler(a_BlockID); - case E_BLOCK_COBBLESTONE_STAIRS: - case E_BLOCK_BRICK_STAIRS: - case E_BLOCK_STONE_BRICK_STAIRS: - case E_BLOCK_NETHER_BRICK_STAIRS: - case E_BLOCK_WOODEN_STAIRS: - return new cBlockStairsHandler(a_BlockID); - case E_BLOCK_SIGN_POST: - case E_BLOCK_WALLSIGN: - return new cBlockSignHandler(a_BlockID); - case E_BLOCK_CROPS: - return new cBlockCropsHandler(a_BlockID); - case E_BLOCK_SUGARCANE: - return new cBlockSugarcaneHandler(a_BlockID); - case E_BLOCK_YELLOW_FLOWER: - case E_BLOCK_RED_ROSE: - return new cBlockFlowerHandler(a_BlockID); - case E_BLOCK_BROWN_MUSHROOM: - case E_BLOCK_RED_MUSHROOM: - return new cBlockMushroomHandler(a_BlockID); - case E_BLOCK_CACTUS: - return new cBlockCactusHandler(a_BlockID); - case E_BLOCK_MELON_STEM: - case E_BLOCK_PUMPKIN_STEM: - return new cBlockStemsHandler(a_BlockID); - case E_BLOCK_GLOWSTONE: - return new cBlockGlowstoneHandler(a_BlockID); - case E_BLOCK_DIAMOND_ORE: - case E_BLOCK_GOLD_ORE: - case E_BLOCK_REDSTONE_ORE: - case E_BLOCK_REDSTONE_ORE_GLOWING: - case E_BLOCK_EMERALD_ORE: - case E_BLOCK_IRON_ORE: - case E_BLOCK_LAPIS_ORE: - case E_BLOCK_COAL_ORE: - return new cBlockOreHandler(a_BlockID); - case E_BLOCK_STONE: - case E_BLOCK_COBBLESTONE: - return new cBlockStoneHandler(a_BlockID); - case E_BLOCK_MELON: - return new cBlockMelonHandler(a_BlockID); - case E_BLOCK_NOTE_BLOCK: - return new cBlockNoteHandler(a_BlockID); - default: - return new cBlockHandler(a_BlockID); - break; - } -} - - - - - -void cBlockHandler::Deinit() -{ - for(int i = 0; i < 256; i++) - { - delete m_BlockHandler[i]; - } - m_HandlerInitialized = false; -} - - - - - -cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockID) -{ - m_BlockID = a_BlockID; -} - - - - - -void cBlockHandler::OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) -{ -} - - - - - -void cBlockHandler::OnPlacedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z, int a_Dir) -{ -} - - - - - -void cBlockHandler::OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z) -{ -} - - - - - -void cBlockHandler::OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) -{ - //Notify the neighbors - NeighborChanged(a_World, a_X - 1, a_Y, a_Z); - NeighborChanged(a_World, a_X + 1, a_Y, a_Z); - NeighborChanged(a_World, a_X, a_Y - 1, a_Z); - NeighborChanged(a_World, a_X, a_Y + 1, a_Z); - NeighborChanged(a_World, a_X, a_Y, a_Z - 1); - NeighborChanged(a_World, a_X, a_Y, a_Z + 1); -} - - - - - -void cBlockHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) -{ - //Notify the neighbors - NeighborChanged(a_World, a_X - 1, a_Y, a_Z); - NeighborChanged(a_World, a_X + 1, a_Y, a_Z); - NeighborChanged(a_World, a_X, a_Y - 1, a_Z); - NeighborChanged(a_World, a_X, a_Y + 1, a_Z); - NeighborChanged(a_World, a_X, a_Y, a_Z - 1); - NeighborChanged(a_World, a_X, a_Y, a_Z + 1); -} - - - - - -void cBlockHandler::NeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z) -{ - GetBlockHandler(a_World->GetBlock(a_X, a_Y, a_Z))->OnNeighborChanged(a_World, a_X, a_Y, a_Z); -} - - - - - -void cBlockHandler::OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z) -{ -} - - - - - -void cBlockHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) -{ -} - - - - - -void cBlockHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) -{ -} - - - - - -void cBlockHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) -{ - a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, a_BlockMeta); - OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir); -} - - - - - -char cBlockHandler::GetDropCount() -{ - return 1; -} - - - - - -int cBlockHandler::GetDropID() -{ - return m_BlockID; -} - - - - - -NIBBLETYPE cBlockHandler::GetDropMeta(NIBBLETYPE a_BlockMeta) -{ - return a_BlockMeta; //This keeps most textures. The few other blocks have to override this -} - - - - - -void cBlockHandler::DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z) -{ - cItems Drops; - NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z); - char DropCount = GetDropCount(); - short DropItem = (short)GetDropID(); - if (DropCount > 0 && (DropItem != E_ITEM_EMPTY)) - { - Drops.push_back(cItem(DropItem, DropCount, GetDropMeta(Meta))); - a_World->SpawnItemPickups(Drops, a_X, a_Y, a_Z); - } -} - - - - - -AString cBlockHandler::GetStepSound() { - return "step.stone"; -} - - - - - -bool cBlockHandler::CanBePlacedAt(cWorld *a_World, int a_X, int a_Y, int a_Z, char a_Dir) -{ - return CanBeAt(a_World, a_X, a_Y, a_Z); -} - - - - - -bool cBlockHandler::CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) -{ - return true; -} - - - - - -bool cBlockHandler::IsUseable() -{ - return false; -} - - - - - -bool cBlockHandler::IsClickedThrough() -{ - return false; -} - - - - - -bool cBlockHandler::IgnoreBuildCollision() -{ - return m_BlockID == E_BLOCK_AIR; -} - - - - - -bool cBlockHandler::NeedsRandomTicks() -{ - return false; -} - - - - - -bool cBlockHandler::AllowBlockOnTop() -{ - return true; -} - - - - - -bool cBlockHandler::CanBePlacedOnSide() -{ - return true; -} - - - - - -bool cBlockHandler::DropOnUnsuitable() -{ - return true; -} - - - - diff --git a/source/blocks/Block.h b/source/blocks/Block.h deleted file mode 100644 index 859870c4a..000000000 --- a/source/blocks/Block.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once -#include "../Defines.h" - -class cWorld; -class cPlayer; - - - -class cBlockHandler -{ -public: - cBlockHandler(BLOCKTYPE a_BlockID); - - // Called when the block gets ticked either by a random tick or by a queued tick - virtual void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z); - - // Will be called by cBlockHandler::PlaceBlock after the player has placed a new block - virtual void OnPlacedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z, int a_Dir); - // Will be called before the player has destroyed a block - virtual void OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z); - // Will be called when a new block was placed. Will be called before OnPlacedByPlayer - virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir); - // Will be called before a block gets destroyed / replaced with air - virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z); - // Will be called when a direct neighbor of this block has been changed (The position is the own position, not the neighbor position) - virtual void OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z); - // Notifies all neighbors of the give block about a change - static void NeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z); - // Will be called while the player diggs the block. - virtual void OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z); - // Will be called if the user right clicks the block and the block is useable - virtual void OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z); - // This function handles the real block placement for the give block by a player and also calls the OnPlacedByPlayer function - virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir); - - // Indicates how much items are dropped DEFAULT: 1 - virtual char GetDropCount(); - // Indicates the id dropped by this block DEFAULT: BlockID - virtual int GetDropID(); - // Indicates the Drop Meta data based on the block meta DEFAULT: BlockMeta - virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta); - // This function handles the dropping of a block based on the Drop id, drop count and drop meta. This will not destroy the block - virtual void DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z); - /// Returns step sound name of block - virtual AString GetStepSound(); - - // Indicates whether this block needs random ticks DEFAULT: False - virtual bool NeedsRandomTicks(); - - /// Checks if the block can stay at the specified coords in the world - virtual bool CanBeAt(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ); - - /// Checks if the block can be placed at this point. Default: CanBeAt(...) NOTE: This call doesn't actually place the block - virtual bool CanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir); - - /// Called when the player tries to place a block on top of this block (Only if he aims directly on this block); return false to disallow - virtual bool AllowBlockOnTop(void); - - /// Called to check whether this block supports a rclk action. If it returns true, OnUse() is called - virtual bool IsUseable(void); - - // Indicates whether the client will click through this block. For example digging a fire will hit the block below the fire so fire is clicked through - virtual bool IsClickedThrough(void); - - // Checks if the player can build "inside" this block. For example blocks placed "on" snow will be placed at the same position. So: Snow ignores Build collision - virtual bool IgnoreBuildCollision(void); - - /// Indicates this block can be placed on the side of other blocks. Default: true - virtual bool CanBePlacedOnSide(); - - /// Does this block drop if it gets destroyed by an unsuitable situation? Default: true - virtual bool DropOnUnsuitable(); - - - // Static function to get the blockhandler for an specific block id - static cBlockHandler * GetBlockHandler(BLOCKTYPE a_BlockID); - - // Deletes all initialised block handlers - static void Deinit(); - -protected: - BLOCKTYPE m_BlockID; - // Creates a new blockhandler for the given block id. For internal use only, use GetBlockHandler instead. - static cBlockHandler *CreateBlockHandler(BLOCKTYPE a_BlockID); - static cBlockHandler *m_BlockHandler[256]; - static bool m_HandlerInitialized; //used to detect if the blockhandlers are initialized -}; - -// Shortcut to get the blockhandler for a specific block -inline cBlockHandler *BlockHandler(BLOCKTYPE a_BlockID) { return cBlockHandler::GetBlockHandler(a_BlockID); } \ No newline at end of file diff --git a/source/blocks/BlockCactus.h b/source/blocks/BlockCactus.h index 9da9d796b..964646299 100644 --- a/source/blocks/BlockCactus.h +++ b/source/blocks/BlockCactus.h @@ -1,6 +1,6 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" diff --git a/source/blocks/BlockChest.h b/source/blocks/BlockChest.h index 65c0ffa5c..db67fe1c8 100644 --- a/source/blocks/BlockChest.h +++ b/source/blocks/BlockChest.h @@ -1,8 +1,8 @@ #pragma once #include "BlockEntity.h" -#include "../cWorld.h" -#include "../cPiston.h" -#include "../cPlayer.h" +#include "../World.h" +#include "../Piston.h" +#include "../Player.h" class cBlockChestHandler : public cBlockEntityHandler { diff --git a/source/blocks/BlockCloth.h b/source/blocks/BlockCloth.h index d83b18ebb..452ad2237 100644 --- a/source/blocks/BlockCloth.h +++ b/source/blocks/BlockCloth.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockClothHandler : public cBlockHandler diff --git a/source/blocks/BlockCrops.h b/source/blocks/BlockCrops.h index ebf911131..b30139e79 100644 --- a/source/blocks/BlockCrops.h +++ b/source/blocks/BlockCrops.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "../MersenneTwister.h" -#include "../cWorld.h" +#include "../World.h" class cBlockCropsHandler : public cBlockHandler { diff --git a/source/blocks/BlockDirt.h b/source/blocks/BlockDirt.h index 28993d29c..5a2487f1b 100644 --- a/source/blocks/BlockDirt.h +++ b/source/blocks/BlockDirt.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "../MersenneTwister.h" -#include "../cWorld.h" +#include "../World.h" class cBlockDirtHandler : public cBlockHandler { diff --git a/source/blocks/BlockDispenser.h b/source/blocks/BlockDispenser.h index f3ad20d5c..eee75a39a 100644 --- a/source/blocks/BlockDispenser.h +++ b/source/blocks/BlockDispenser.h @@ -1,8 +1,8 @@ #pragma once #include "BlockEntity.h" -#include "../cWorld.h" -#include "../cPiston.h" -#include "../cPlayer.h" +#include "../World.h" +#include "../Piston.h" +#include "../Player.h" class cBlockDispenserHandler : public cBlockEntityHandler { diff --git a/source/blocks/BlockDoor.cpp b/source/blocks/BlockDoor.cpp index 283f546b6..deed8a256 100644 --- a/source/blocks/BlockDoor.cpp +++ b/source/blocks/BlockDoor.cpp @@ -1,9 +1,9 @@ #include "Globals.h" #include "BlockDoor.h" -#include "../cItem.h" -#include "../cWorld.h" -#include "../cDoors.h" -#include "../cPlayer.h" +#include "../Item.h" +#include "../World.h" +#include "../Doors.h" +#include "../Player.h" cBlockDoorHandler::cBlockDoorHandler(BLOCKTYPE a_BlockID) diff --git a/source/blocks/BlockDoor.h b/source/blocks/BlockDoor.h index 6af8bd955..3316f50a4 100644 --- a/source/blocks/BlockDoor.h +++ b/source/blocks/BlockDoor.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockDoorHandler : public cBlockHandler diff --git a/source/blocks/BlockEntity.h b/source/blocks/BlockEntity.h index bfc3241d3..caf6ee342 100644 --- a/source/blocks/BlockEntity.h +++ b/source/blocks/BlockEntity.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" diff --git a/source/blocks/BlockFire.h b/source/blocks/BlockFire.h index 1b9f68060..1fecf9a14 100644 --- a/source/blocks/BlockFire.h +++ b/source/blocks/BlockFire.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockFireHandler : public cBlockHandler diff --git a/source/blocks/BlockFlower.h b/source/blocks/BlockFlower.h index 920cf1c8f..35a55fcac 100644 --- a/source/blocks/BlockFlower.h +++ b/source/blocks/BlockFlower.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockFlowerHandler : public cBlockHandler diff --git a/source/blocks/BlockFluid.h b/source/blocks/BlockFluid.h index 6883ce715..c5ac660b0 100644 --- a/source/blocks/BlockFluid.h +++ b/source/blocks/BlockFluid.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockFluidHandler : public cBlockHandler diff --git a/source/blocks/BlockFurnace.h b/source/blocks/BlockFurnace.h index d0455e805..4157b5049 100644 --- a/source/blocks/BlockFurnace.h +++ b/source/blocks/BlockFurnace.h @@ -1,8 +1,8 @@ #pragma once #include "BlockEntity.h" -#include "../cWorld.h" -#include "../cPiston.h" -#include "../cPlayer.h" +#include "../World.h" +#include "../Piston.h" +#include "../Player.h" class cBlockFurnaceHandler : public cBlockEntityHandler { diff --git a/source/blocks/BlockGlowstone.h b/source/blocks/BlockGlowstone.h index ecd34a1d9..0b906e2fe 100644 --- a/source/blocks/BlockGlowstone.h +++ b/source/blocks/BlockGlowstone.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockGlowstoneHandler : public cBlockHandler diff --git a/source/blocks/BlockGravel.h b/source/blocks/BlockGravel.h index d4f36a894..da47db9bb 100644 --- a/source/blocks/BlockGravel.h +++ b/source/blocks/BlockGravel.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockGravelHandler : public cBlockHandler diff --git a/source/blocks/BlockHandler.cpp b/source/blocks/BlockHandler.cpp new file mode 100644 index 000000000..f45f40f9e --- /dev/null +++ b/source/blocks/BlockHandler.cpp @@ -0,0 +1,445 @@ +#include "Globals.h" +#include "BlockHandler.h" +#include "../Item.h" +#include "../World.h" +#include "BlockSand.h" +#include "BlockGravel.h" +#include "BlockDoor.h" +#include "BlockFire.h" +#include "BlockRedstone.h" +#include "BlockRedstoneTorch.h" +#include "BlockRedstoneRepeater.h" +#include "BlockPiston.h" +#include "BlockWorkbench.h" +#include "BlockEntity.h" +#include "BlockVine.h" +#include "BlockTallGrass.h" +#include "BlockSnow.h" +#include "BlockCloth.h" +#include "BlockSlab.h" +#include "BlockDirt.h" +#include "BlockTorch.h" +#include "BlockWood.h" +#include "BlockLeaves.h" +#include "BlockSapling.h" +#include "BlockFluid.h" +#include "BlockChest.h" +#include "BlockFurnace.h" +#include "BlockDispenser.h" +#include "BlockStairs.h" +#include "BlockLadder.h" +#include "BlockSign.h" +#include "BlockCrops.h" +#include "BlockSugarcane.h" +#include "BlockFlower.h" +#include "BlockMushroom.h" +#include "BlockCactus.h" +#include "BlockStems.h" +#include "BlockGlowstone.h" +#include "BlockStone.h" +#include "BlockMelon.h" +#include "BlockIce.h" +#include "BlockOre.h" +#include "BlockNote.h" + + + + + +bool cBlockHandler::m_HandlerInitialized = false; +cBlockHandler *cBlockHandler::m_BlockHandler[256]; + + + + + +cBlockHandler *cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockID) +{ + if (!m_HandlerInitialized) + { + //We have to initialize + memset(m_BlockHandler, 0, sizeof(m_BlockHandler)); + m_HandlerInitialized = true; + } + if (m_BlockHandler[a_BlockID] != NULL) + { + return m_BlockHandler[a_BlockID]; + } + + return m_BlockHandler[a_BlockID] = CreateBlockHandler(a_BlockID); +} + + + + + +cBlockHandler *cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockID) +{ + switch(a_BlockID) + { + case E_BLOCK_SAND: + return new cBlockSandHandler(a_BlockID); + case E_BLOCK_GRAVEL: + return new cBlockGravelHandler(a_BlockID); + case E_BLOCK_WOODEN_DOOR: + case E_BLOCK_IRON_DOOR: + return new cBlockDoorHandler(a_BlockID); + case E_BLOCK_FIRE: + return new cBlockFireHandler(a_BlockID); + case E_BLOCK_REDSTONE_TORCH_ON: + case E_BLOCK_REDSTONE_TORCH_OFF: + return new cBlockRedstoneTorchHandler(a_BlockID); + case E_BLOCK_REDSTONE_WIRE: + return new cBlockRedstoneHandler(a_BlockID); + case E_BLOCK_PISTON: + case E_BLOCK_STICKY_PISTON: + return new cBlockPistonHandler(a_BlockID); + case E_BLOCK_REDSTONE_REPEATER_ON: + case E_BLOCK_REDSTONE_REPEATER_OFF: + return new cBlockRedstoneRepeaterHandler(a_BlockID); + case E_BLOCK_WORKBENCH: + return new cBlockWorkbenchHandler(a_BlockID); + case E_BLOCK_SNOW: + return new cBlockSnowHandler(a_BlockID); + case E_BLOCK_TALL_GRASS: + return new cBlockTallGrassHandler(a_BlockID); + case E_BLOCK_VINES: + return new cBlockVineHandler(a_BlockID); + case ::E_BLOCK_WOOL: + return new cBlockClothHandler(a_BlockID); + case E_BLOCK_WOODEN_SLAB: + case E_BLOCK_STONE_SLAB: + case E_BLOCK_DOUBLE_WOODEN_SLAB: + case E_BLOCK_DOUBLE_STONE_SLAB: + return new cBlockSlabHandler(a_BlockID); + case E_BLOCK_LOG: + case E_BLOCK_PLANKS: + return new cBlockWoodHandler(a_BlockID); + case E_BLOCK_TORCH: + return new cBlockTorchHandler(a_BlockID); + case E_BLOCK_DIRT: + case E_BLOCK_GRASS: + return new cBlockDirtHandler(a_BlockID); + case E_BLOCK_LEAVES: + return new cBlockLeavesHandler(a_BlockID); + case E_BLOCK_SAPLING: + return new cBlockSaplingHandler(a_BlockID); + case E_BLOCK_WATER: + case E_BLOCK_STATIONARY_WATER: + case E_BLOCK_STATIONARY_LAVA: + case E_BLOCK_LAVA: + return new cBlockFluidHandler(a_BlockID); + case E_BLOCK_DISPENSER: + return new cBlockDispenserHandler(a_BlockID); + case E_BLOCK_FURNACE: + case E_BLOCK_LIT_FURNACE: + return new cBlockFurnaceHandler(a_BlockID); + case E_BLOCK_CHEST: + return new cBlockChestHandler(a_BlockID); + case E_BLOCK_ICE: + return new cBlockIceHandler(a_BlockID); + case E_BLOCK_LADDER: + return new cBlockLadderHandler(a_BlockID); + case E_BLOCK_COBBLESTONE_STAIRS: + case E_BLOCK_BRICK_STAIRS: + case E_BLOCK_STONE_BRICK_STAIRS: + case E_BLOCK_NETHER_BRICK_STAIRS: + case E_BLOCK_WOODEN_STAIRS: + return new cBlockStairsHandler(a_BlockID); + case E_BLOCK_SIGN_POST: + case E_BLOCK_WALLSIGN: + return new cBlockSignHandler(a_BlockID); + case E_BLOCK_CROPS: + return new cBlockCropsHandler(a_BlockID); + case E_BLOCK_SUGARCANE: + return new cBlockSugarcaneHandler(a_BlockID); + case E_BLOCK_YELLOW_FLOWER: + case E_BLOCK_RED_ROSE: + return new cBlockFlowerHandler(a_BlockID); + case E_BLOCK_BROWN_MUSHROOM: + case E_BLOCK_RED_MUSHROOM: + return new cBlockMushroomHandler(a_BlockID); + case E_BLOCK_CACTUS: + return new cBlockCactusHandler(a_BlockID); + case E_BLOCK_MELON_STEM: + case E_BLOCK_PUMPKIN_STEM: + return new cBlockStemsHandler(a_BlockID); + case E_BLOCK_GLOWSTONE: + return new cBlockGlowstoneHandler(a_BlockID); + case E_BLOCK_DIAMOND_ORE: + case E_BLOCK_GOLD_ORE: + case E_BLOCK_REDSTONE_ORE: + case E_BLOCK_REDSTONE_ORE_GLOWING: + case E_BLOCK_EMERALD_ORE: + case E_BLOCK_IRON_ORE: + case E_BLOCK_LAPIS_ORE: + case E_BLOCK_COAL_ORE: + return new cBlockOreHandler(a_BlockID); + case E_BLOCK_STONE: + case E_BLOCK_COBBLESTONE: + return new cBlockStoneHandler(a_BlockID); + case E_BLOCK_MELON: + return new cBlockMelonHandler(a_BlockID); + case E_BLOCK_NOTE_BLOCK: + return new cBlockNoteHandler(a_BlockID); + default: + return new cBlockHandler(a_BlockID); + break; + } +} + + + + + +void cBlockHandler::Deinit() +{ + for(int i = 0; i < 256; i++) + { + delete m_BlockHandler[i]; + } + m_HandlerInitialized = false; +} + + + + + +cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockID) +{ + m_BlockID = a_BlockID; +} + + + + + +void cBlockHandler::OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) +{ +} + + + + + +void cBlockHandler::OnPlacedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z, int a_Dir) +{ +} + + + + + +void cBlockHandler::OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z) +{ +} + + + + + +void cBlockHandler::OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) +{ + //Notify the neighbors + NeighborChanged(a_World, a_X - 1, a_Y, a_Z); + NeighborChanged(a_World, a_X + 1, a_Y, a_Z); + NeighborChanged(a_World, a_X, a_Y - 1, a_Z); + NeighborChanged(a_World, a_X, a_Y + 1, a_Z); + NeighborChanged(a_World, a_X, a_Y, a_Z - 1); + NeighborChanged(a_World, a_X, a_Y, a_Z + 1); +} + + + + + +void cBlockHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) +{ + //Notify the neighbors + NeighborChanged(a_World, a_X - 1, a_Y, a_Z); + NeighborChanged(a_World, a_X + 1, a_Y, a_Z); + NeighborChanged(a_World, a_X, a_Y - 1, a_Z); + NeighborChanged(a_World, a_X, a_Y + 1, a_Z); + NeighborChanged(a_World, a_X, a_Y, a_Z - 1); + NeighborChanged(a_World, a_X, a_Y, a_Z + 1); +} + + + + + +void cBlockHandler::NeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z) +{ + GetBlockHandler(a_World->GetBlock(a_X, a_Y, a_Z))->OnNeighborChanged(a_World, a_X, a_Y, a_Z); +} + + + + + +void cBlockHandler::OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z) +{ +} + + + + + +void cBlockHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) +{ +} + + + + + +void cBlockHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) +{ +} + + + + + +void cBlockHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) +{ + a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, a_BlockMeta); + OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir); +} + + + + + +char cBlockHandler::GetDropCount() +{ + return 1; +} + + + + + +int cBlockHandler::GetDropID() +{ + return m_BlockID; +} + + + + + +NIBBLETYPE cBlockHandler::GetDropMeta(NIBBLETYPE a_BlockMeta) +{ + return a_BlockMeta; //This keeps most textures. The few other blocks have to override this +} + + + + + +void cBlockHandler::DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z) +{ + cItems Drops; + NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z); + char DropCount = GetDropCount(); + short DropItem = (short)GetDropID(); + if (DropCount > 0 && (DropItem != E_ITEM_EMPTY)) + { + Drops.push_back(cItem(DropItem, DropCount, GetDropMeta(Meta))); + a_World->SpawnItemPickups(Drops, a_X, a_Y, a_Z); + } +} + + + + + +AString cBlockHandler::GetStepSound() { + return "step.stone"; +} + + + + + +bool cBlockHandler::CanBePlacedAt(cWorld *a_World, int a_X, int a_Y, int a_Z, char a_Dir) +{ + return CanBeAt(a_World, a_X, a_Y, a_Z); +} + + + + + +bool cBlockHandler::CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) +{ + return true; +} + + + + + +bool cBlockHandler::IsUseable() +{ + return false; +} + + + + + +bool cBlockHandler::IsClickedThrough() +{ + return false; +} + + + + + +bool cBlockHandler::IgnoreBuildCollision() +{ + return m_BlockID == E_BLOCK_AIR; +} + + + + + +bool cBlockHandler::NeedsRandomTicks() +{ + return false; +} + + + + + +bool cBlockHandler::AllowBlockOnTop() +{ + return true; +} + + + + + +bool cBlockHandler::CanBePlacedOnSide() +{ + return true; +} + + + + + +bool cBlockHandler::DropOnUnsuitable() +{ + return true; +} + + + + diff --git a/source/blocks/BlockHandler.h b/source/blocks/BlockHandler.h new file mode 100644 index 000000000..859870c4a --- /dev/null +++ b/source/blocks/BlockHandler.h @@ -0,0 +1,90 @@ +#pragma once +#include "../Defines.h" + +class cWorld; +class cPlayer; + + + +class cBlockHandler +{ +public: + cBlockHandler(BLOCKTYPE a_BlockID); + + // Called when the block gets ticked either by a random tick or by a queued tick + virtual void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z); + + // Will be called by cBlockHandler::PlaceBlock after the player has placed a new block + virtual void OnPlacedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z, int a_Dir); + // Will be called before the player has destroyed a block + virtual void OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z); + // Will be called when a new block was placed. Will be called before OnPlacedByPlayer + virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir); + // Will be called before a block gets destroyed / replaced with air + virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z); + // Will be called when a direct neighbor of this block has been changed (The position is the own position, not the neighbor position) + virtual void OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z); + // Notifies all neighbors of the give block about a change + static void NeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z); + // Will be called while the player diggs the block. + virtual void OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z); + // Will be called if the user right clicks the block and the block is useable + virtual void OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z); + // This function handles the real block placement for the give block by a player and also calls the OnPlacedByPlayer function + virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir); + + // Indicates how much items are dropped DEFAULT: 1 + virtual char GetDropCount(); + // Indicates the id dropped by this block DEFAULT: BlockID + virtual int GetDropID(); + // Indicates the Drop Meta data based on the block meta DEFAULT: BlockMeta + virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta); + // This function handles the dropping of a block based on the Drop id, drop count and drop meta. This will not destroy the block + virtual void DropBlock(cWorld *a_World, int a_X, int a_Y, int a_Z); + /// Returns step sound name of block + virtual AString GetStepSound(); + + // Indicates whether this block needs random ticks DEFAULT: False + virtual bool NeedsRandomTicks(); + + /// Checks if the block can stay at the specified coords in the world + virtual bool CanBeAt(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ); + + /// Checks if the block can be placed at this point. Default: CanBeAt(...) NOTE: This call doesn't actually place the block + virtual bool CanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir); + + /// Called when the player tries to place a block on top of this block (Only if he aims directly on this block); return false to disallow + virtual bool AllowBlockOnTop(void); + + /// Called to check whether this block supports a rclk action. If it returns true, OnUse() is called + virtual bool IsUseable(void); + + // Indicates whether the client will click through this block. For example digging a fire will hit the block below the fire so fire is clicked through + virtual bool IsClickedThrough(void); + + // Checks if the player can build "inside" this block. For example blocks placed "on" snow will be placed at the same position. So: Snow ignores Build collision + virtual bool IgnoreBuildCollision(void); + + /// Indicates this block can be placed on the side of other blocks. Default: true + virtual bool CanBePlacedOnSide(); + + /// Does this block drop if it gets destroyed by an unsuitable situation? Default: true + virtual bool DropOnUnsuitable(); + + + // Static function to get the blockhandler for an specific block id + static cBlockHandler * GetBlockHandler(BLOCKTYPE a_BlockID); + + // Deletes all initialised block handlers + static void Deinit(); + +protected: + BLOCKTYPE m_BlockID; + // Creates a new blockhandler for the given block id. For internal use only, use GetBlockHandler instead. + static cBlockHandler *CreateBlockHandler(BLOCKTYPE a_BlockID); + static cBlockHandler *m_BlockHandler[256]; + static bool m_HandlerInitialized; //used to detect if the blockhandlers are initialized +}; + +// Shortcut to get the blockhandler for a specific block +inline cBlockHandler *BlockHandler(BLOCKTYPE a_BlockID) { return cBlockHandler::GetBlockHandler(a_BlockID); } \ No newline at end of file diff --git a/source/blocks/BlockIce.h b/source/blocks/BlockIce.h index d6bb63b0a..cc5cc8920 100644 --- a/source/blocks/BlockIce.h +++ b/source/blocks/BlockIce.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "../MersenneTwister.h" -#include "../cWorld.h" +#include "../World.h" class cBlockIceHandler : public cBlockHandler { diff --git a/source/blocks/BlockLadder.h b/source/blocks/BlockLadder.h index e30fc884d..ee48df848 100644 --- a/source/blocks/BlockLadder.h +++ b/source/blocks/BlockLadder.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" -#include "../cWorld.h" -#include "../cLadder.h" +#include "BlockHandler.h" +#include "../World.h" +#include "../Ladder.h" class cBlockLadderHandler : public cBlockHandler { diff --git a/source/blocks/BlockLeaves.h b/source/blocks/BlockLeaves.h index c2ec697ae..65c47f8de 100644 --- a/source/blocks/BlockLeaves.h +++ b/source/blocks/BlockLeaves.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "../MersenneTwister.h" -#include "../cWorld.h" +#include "../World.h" #include "../BlockArea.h" diff --git a/source/blocks/BlockMelon.h b/source/blocks/BlockMelon.h index 3abcc6efb..87fb7e1e8 100644 --- a/source/blocks/BlockMelon.h +++ b/source/blocks/BlockMelon.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockMelonHandler : public cBlockHandler diff --git a/source/blocks/BlockMushroom.h b/source/blocks/BlockMushroom.h index ca787dce6..c4119bad0 100644 --- a/source/blocks/BlockMushroom.h +++ b/source/blocks/BlockMushroom.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockMushroomHandler : public cBlockHandler diff --git a/source/blocks/BlockNote.h b/source/blocks/BlockNote.h index 2c439f623..896a5d03b 100644 --- a/source/blocks/BlockNote.h +++ b/source/blocks/BlockNote.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "BlockEntity.h" class cBlockNoteHandler : public cBlockEntityHandler diff --git a/source/blocks/BlockOre.h b/source/blocks/BlockOre.h index 4788c9b89..556a215ce 100644 --- a/source/blocks/BlockOre.h +++ b/source/blocks/BlockOre.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "../MersenneTwister.h" -#include "../cWorld.h" +#include "../World.h" class cBlockOreHandler : public cBlockHandler { diff --git a/source/blocks/BlockPiston.cpp b/source/blocks/BlockPiston.cpp index c2fcdd1f2..a4ed13d88 100644 --- a/source/blocks/BlockPiston.cpp +++ b/source/blocks/BlockPiston.cpp @@ -1,10 +1,10 @@ #include "Globals.h" #include "BlockPiston.h" -#include "../cItem.h" -#include "../cWorld.h" -#include "../cRedstone.h" -#include "../cPlayer.h" -#include "../cPiston.h" +#include "../Item.h" +#include "../World.h" +#include "../Redstone.h" +#include "../Player.h" +#include "../Piston.h" diff --git a/source/blocks/BlockPiston.h b/source/blocks/BlockPiston.h index 1493ff27e..dbce9bae5 100644 --- a/source/blocks/BlockPiston.h +++ b/source/blocks/BlockPiston.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockPistonHandler : public cBlockHandler diff --git a/source/blocks/BlockRedstone.cpp b/source/blocks/BlockRedstone.cpp index 58edaa1cd..7653436f4 100644 --- a/source/blocks/BlockRedstone.cpp +++ b/source/blocks/BlockRedstone.cpp @@ -1,9 +1,9 @@ #include "Globals.h" #include "BlockRedstone.h" -#include "../cItem.h" -#include "../cWorld.h" -#include "../cRedstone.h" -#include "../cTorch.h" +#include "../Item.h" +#include "../World.h" +#include "../Redstone.h" +#include "../Torch.h" cBlockRedstoneHandler::cBlockRedstoneHandler(BLOCKTYPE a_BlockID) : cBlockHandler(a_BlockID) diff --git a/source/blocks/BlockRedstone.h b/source/blocks/BlockRedstone.h index dd2c75fc4..9b83b1b29 100644 --- a/source/blocks/BlockRedstone.h +++ b/source/blocks/BlockRedstone.h @@ -1,6 +1,6 @@ #pragma once -#include "Block.h" -#include "../cWorld.h" +#include "BlockHandler.h" +#include "../World.h" class cBlockRedstoneHandler : public cBlockHandler { diff --git a/source/blocks/BlockRedstoneRepeater.cpp b/source/blocks/BlockRedstoneRepeater.cpp index 4921cd6f7..861f6e221 100644 --- a/source/blocks/BlockRedstoneRepeater.cpp +++ b/source/blocks/BlockRedstoneRepeater.cpp @@ -1,9 +1,9 @@ #include "Globals.h" #include "BlockRedstoneRepeater.h" -#include "../cItem.h" -#include "../cWorld.h" -#include "../cRedstone.h" -#include "../cPlayer.h" +#include "../Item.h" +#include "../World.h" +#include "../Redstone.h" +#include "../Player.h" cBlockRedstoneRepeaterHandler::cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockID) : cBlockHandler(a_BlockID) diff --git a/source/blocks/BlockRedstoneRepeater.h b/source/blocks/BlockRedstoneRepeater.h index c2ed30e2c..a928f554f 100644 --- a/source/blocks/BlockRedstoneRepeater.h +++ b/source/blocks/BlockRedstoneRepeater.h @@ -1,6 +1,6 @@ #pragma once -#include "Block.h" -#include "../cWorld.h" +#include "BlockHandler.h" +#include "../World.h" class cBlockRedstoneRepeaterHandler : public cBlockHandler { diff --git a/source/blocks/BlockRedstoneTorch.h b/source/blocks/BlockRedstoneTorch.h index 42d3a0366..eeb2afc5c 100644 --- a/source/blocks/BlockRedstoneTorch.h +++ b/source/blocks/BlockRedstoneTorch.h @@ -2,7 +2,7 @@ #pragma once #include "BlockRedstone.h" #include "BlockTorch.h" -#include "../cTorch.h" +#include "../Torch.h" diff --git a/source/blocks/BlockSand.h b/source/blocks/BlockSand.h index 71096c5a7..69fda5ec6 100644 --- a/source/blocks/BlockSand.h +++ b/source/blocks/BlockSand.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockSandHandler : public cBlockHandler diff --git a/source/blocks/BlockSapling.h b/source/blocks/BlockSapling.h index e4ca998cb..c9862349a 100644 --- a/source/blocks/BlockSapling.h +++ b/source/blocks/BlockSapling.h @@ -1,6 +1,6 @@ #pragma once -#include "Block.h" -#include "../cWorld.h" +#include "BlockHandler.h" +#include "../World.h" class cBlockSaplingHandler : public cBlockHandler { diff --git a/source/blocks/BlockSign.h b/source/blocks/BlockSign.h index b0f9d7f7f..dd82605b3 100644 --- a/source/blocks/BlockSign.h +++ b/source/blocks/BlockSign.h @@ -1,8 +1,8 @@ #pragma once -#include "Block.h" -#include "../cWorld.h" -#include "../cSign.h" -#include "../cPlayer.h" +#include "BlockHandler.h" +#include "../World.h" +#include "../Sign.h" +#include "../Player.h" class cBlockSignHandler : public cBlockHandler { diff --git a/source/blocks/BlockSlab.h b/source/blocks/BlockSlab.h index 11d1933c3..ad9970d67 100644 --- a/source/blocks/BlockSlab.h +++ b/source/blocks/BlockSlab.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockSlabHandler : public cBlockHandler diff --git a/source/blocks/BlockSnow.h b/source/blocks/BlockSnow.h index ba9d35183..c8e6b4c1c 100644 --- a/source/blocks/BlockSnow.h +++ b/source/blocks/BlockSnow.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockSnowHandler : public cBlockHandler diff --git a/source/blocks/BlockStairs.h b/source/blocks/BlockStairs.h index 4e06a6e3f..4d0007bc5 100644 --- a/source/blocks/BlockStairs.h +++ b/source/blocks/BlockStairs.h @@ -1,6 +1,6 @@ #pragma once -#include "Block.h" -#include "../cStairs.h" +#include "BlockHandler.h" +#include "../Stairs.h" class cBlockStairsHandler : public cBlockHandler { diff --git a/source/blocks/BlockStems.h b/source/blocks/BlockStems.h index aa6229536..be4519a52 100644 --- a/source/blocks/BlockStems.h +++ b/source/blocks/BlockStems.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "../MersenneTwister.h" -#include "../cWorld.h" +#include "../World.h" class cBlockStemsHandler : public cBlockHandler { diff --git a/source/blocks/BlockStone.h b/source/blocks/BlockStone.h index bd644a3a4..8b645bf1e 100644 --- a/source/blocks/BlockStone.h +++ b/source/blocks/BlockStone.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "../MersenneTwister.h" -#include "../cWorld.h" +#include "../World.h" class cBlockStoneHandler : public cBlockHandler { diff --git a/source/blocks/BlockSugarcane.h b/source/blocks/BlockSugarcane.h index 4b0cb5408..1d477b42b 100644 --- a/source/blocks/BlockSugarcane.h +++ b/source/blocks/BlockSugarcane.h @@ -1,6 +1,6 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" diff --git a/source/blocks/BlockTallGrass.h b/source/blocks/BlockTallGrass.h index 6e7854db8..f5bb1b373 100644 --- a/source/blocks/BlockTallGrass.h +++ b/source/blocks/BlockTallGrass.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockTallGrassHandler : public cBlockHandler diff --git a/source/blocks/BlockTorch.h b/source/blocks/BlockTorch.h index f3b172bf9..450b5ecab 100644 --- a/source/blocks/BlockTorch.h +++ b/source/blocks/BlockTorch.h @@ -1,8 +1,8 @@ #pragma once -#include "Block.h" -#include "../cTorch.h" -#include "../cWorld.h" +#include "BlockHandler.h" +#include "../Torch.h" +#include "../World.h" diff --git a/source/blocks/BlockVine.h b/source/blocks/BlockVine.h index 6b8d85339..56317219a 100644 --- a/source/blocks/BlockVine.h +++ b/source/blocks/BlockVine.h @@ -1,6 +1,6 @@ #pragma once -#include "Block.h" -#include "../cVine.h" +#include "BlockHandler.h" +#include "../Vine.h" class cBlockVineHandler : public cBlockHandler { diff --git a/source/blocks/BlockWood.h b/source/blocks/BlockWood.h index 5e6615c1b..d71d5d71c 100644 --- a/source/blocks/BlockWood.h +++ b/source/blocks/BlockWood.h @@ -1,5 +1,5 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" class cBlockWoodHandler : public cBlockHandler diff --git a/source/blocks/BlockWorkbench.h b/source/blocks/BlockWorkbench.h index 776628382..c1c004dc5 100644 --- a/source/blocks/BlockWorkbench.h +++ b/source/blocks/BlockWorkbench.h @@ -1,7 +1,7 @@ #pragma once -#include "Block.h" +#include "BlockHandler.h" #include "../UI/Window.h" -#include "../cPlayer.h" +#include "../Player.h" -- cgit v1.2.3