summaryrefslogtreecommitdiffstats
path: root/source/Blocks
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-03 10:52:11 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-03 10:52:11 +0200
commitea2ed2c918bddf773bb8d10298016f4e5309d0b2 (patch)
tree129848747361501cbc2e330e1a33b7f8089f51b2 /source/Blocks
parentsTick: Updated the plugin to work with current code (diff)
downloadcuberite-ea2ed2c918bddf773bb8d10298016f4e5309d0b2.tar
cuberite-ea2ed2c918bddf773bb8d10298016f4e5309d0b2.tar.gz
cuberite-ea2ed2c918bddf773bb8d10298016f4e5309d0b2.tar.bz2
cuberite-ea2ed2c918bddf773bb8d10298016f4e5309d0b2.tar.lz
cuberite-ea2ed2c918bddf773bb8d10298016f4e5309d0b2.tar.xz
cuberite-ea2ed2c918bddf773bb8d10298016f4e5309d0b2.tar.zst
cuberite-ea2ed2c918bddf773bb8d10298016f4e5309d0b2.zip
Diffstat (limited to 'source/Blocks')
-rw-r--r--source/Blocks/BlockBed.cpp36
-rw-r--r--source/Blocks/BlockBed.h10
-rw-r--r--source/Blocks/BlockCactus.h24
-rw-r--r--source/Blocks/BlockChest.h10
-rw-r--r--source/Blocks/BlockCloth.h4
-rw-r--r--source/Blocks/BlockCrops.h22
-rw-r--r--source/Blocks/BlockDirt.h18
-rw-r--r--source/Blocks/BlockDispenser.h10
-rw-r--r--source/Blocks/BlockDoor.cpp38
-rw-r--r--source/Blocks/BlockDoor.h14
-rw-r--r--source/Blocks/BlockEntity.h4
-rw-r--r--source/Blocks/BlockFire.h8
-rw-r--r--source/Blocks/BlockFlower.h10
-rw-r--r--source/Blocks/BlockFluid.h4
-rw-r--r--source/Blocks/BlockFurnace.h10
-rw-r--r--source/Blocks/BlockGlowstone.h4
-rw-r--r--source/Blocks/BlockGravel.h4
-rw-r--r--source/Blocks/BlockHandler.cpp162
-rw-r--r--source/Blocks/BlockHandler.h37
-rw-r--r--source/Blocks/BlockIce.h8
-rw-r--r--source/Blocks/BlockLadder.h22
-rw-r--r--source/Blocks/BlockLeaves.h36
-rw-r--r--source/Blocks/BlockMelon.h4
-rw-r--r--source/Blocks/BlockMushroom.h10
-rw-r--r--source/Blocks/BlockNote.h4
-rw-r--r--source/Blocks/BlockOre.h8
-rw-r--r--source/Blocks/BlockPiston.cpp43
-rw-r--r--source/Blocks/BlockPiston.h8
-rw-r--r--source/Blocks/BlockRedstone.cpp22
-rw-r--r--source/Blocks/BlockRedstone.h22
-rw-r--r--source/Blocks/BlockRedstoneRepeater.cpp26
-rw-r--r--source/Blocks/BlockRedstoneRepeater.h16
-rw-r--r--source/Blocks/BlockRedstoneTorch.h4
-rw-r--r--source/Blocks/BlockSand.h4
-rw-r--r--source/Blocks/BlockSapling.h16
-rw-r--r--source/Blocks/BlockSign.h10
-rw-r--r--source/Blocks/BlockSlab.h16
-rw-r--r--source/Blocks/BlockSnow.h9
-rw-r--r--source/Blocks/BlockStairs.h10
-rw-r--r--source/Blocks/BlockStems.h24
-rw-r--r--source/Blocks/BlockStone.h4
-rw-r--r--source/Blocks/BlockSugarcane.h17
-rw-r--r--source/Blocks/BlockTallGrass.h8
-rw-r--r--source/Blocks/BlockTorch.h38
-rw-r--r--source/Blocks/BlockVine.h10
-rw-r--r--source/Blocks/BlockWood.h4
-rw-r--r--source/Blocks/BlockWorkbench.h4
47 files changed, 444 insertions, 392 deletions
diff --git a/source/Blocks/BlockBed.cpp b/source/Blocks/BlockBed.cpp
index 4a6d842b7..19dfbfd3d 100644
--- a/source/Blocks/BlockBed.cpp
+++ b/source/Blocks/BlockBed.cpp
@@ -5,34 +5,36 @@
-void cBlockBedHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockBedHandler::PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir)
{
- if( a_Dir != 1 ) // Can only be placed on the floor
+ if (a_Dir != 1) // Can only be placed on the floor
+ {
return;
+ }
NIBBLETYPE Meta = RotationToMetaData( a_Player->GetRotation() );
Vector3i Direction = MetaDataToDirection( Meta );
- if (a_World->GetBlock(a_X+Direction.x, a_Y, a_Z+Direction.z) != E_BLOCK_AIR)
+ if (a_World->GetBlock(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z) != E_BLOCK_AIR)
{
return;
}
- a_World->SetBlock(a_X, a_Y, a_Z, E_BLOCK_BED, Meta);
- a_World->SetBlock(a_X + Direction.x, a_Y, a_Z + Direction.z, E_BLOCK_BED, Meta | 0x8);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_BED, Meta);
+ a_World->SetBlock(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z, E_BLOCK_BED, Meta | 0x8);
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
-void cBlockBedHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
+void cBlockBedHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- NIBBLETYPE OldMeta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ NIBBLETYPE OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- Vector3i ThisPos( a_X, a_Y, a_Z );
+ Vector3i ThisPos( a_BlockX, a_BlockY, a_BlockZ );
Vector3i Direction = MetaDataToDirection( OldMeta & 0x7 );
if (OldMeta & 0x8)
{
@@ -56,22 +58,26 @@ void cBlockBedHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
-void cBlockBedHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z)
+void cBlockBedHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (Meta & 0x8)
{
// Is pillow
- a_World->BroadcastUseBed( *a_Player, a_X, a_Y, a_Z );
+ a_World->BroadcastUseBed( *a_Player, a_BlockX, a_BlockY, a_BlockZ );
}
else
{
// Is foot end
Vector3i Direction = MetaDataToDirection( Meta & 0x7 );
- if (a_World->GetBlock(a_X + Direction.x, a_Y, a_Z + Direction.z) == E_BLOCK_BED) // Must always use pillow location for sleeping
+ if (a_World->GetBlock(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z) == E_BLOCK_BED) // Must always use pillow location for sleeping
{
- a_World->BroadcastUseBed( *a_Player, a_X + Direction.x, a_Y, a_Z + Direction.z );
+ a_World->BroadcastUseBed(*a_Player, a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z );
}
}
-} \ No newline at end of file
+}
+
+
+
+
diff --git a/source/Blocks/BlockBed.h b/source/Blocks/BlockBed.h
index 0fe2a1e07..0c3d3b028 100644
--- a/source/Blocks/BlockBed.h
+++ b/source/Blocks/BlockBed.h
@@ -14,15 +14,15 @@ class cBlockBedHandler :
public cBlockHandler
{
public:
- cBlockBedHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockBedHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
- virtual void OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z) override;
- virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z) override;
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override;
+ virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
virtual bool IsUseable(void) override
diff --git a/source/Blocks/BlockCactus.h b/source/Blocks/BlockCactus.h
index 6eec866be..daa0e02c2 100644
--- a/source/Blocks/BlockCactus.h
+++ b/source/Blocks/BlockCactus.h
@@ -11,8 +11,8 @@ class cBlockCactusHandler :
public cBlockHandler
{
public:
- cBlockCactusHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockCactusHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -20,13 +20,13 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Reset meta to 0
- a_Pickups.push_back(cItem(m_BlockID, 1, 0));
+ a_Pickups.push_back(cItem(m_BlockType, 1, 0));
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- BLOCKTYPE Surface = a_World->GetBlock(a_X, a_Y - 1, a_Z);
+ BLOCKTYPE Surface = a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ);
if ((Surface != E_BLOCK_SAND) && (Surface != E_BLOCK_CACTUS))
{
// Cactus can only be placed on sand and itself
@@ -35,10 +35,10 @@ public:
// Check surroundings. Cacti may ONLY be surrounded by air
if (
- (a_World->GetBlock(a_X - 1, a_Y, a_Z) != E_BLOCK_AIR) ||
- (a_World->GetBlock(a_X + 1, a_Y, a_Z) != E_BLOCK_AIR) ||
- (a_World->GetBlock(a_X, a_Y, a_Z - 1) != E_BLOCK_AIR) ||
- (a_World->GetBlock(a_X, a_Y, a_Z + 1) != E_BLOCK_AIR)
+ (a_World->GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) != E_BLOCK_AIR) ||
+ (a_World->GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) != E_BLOCK_AIR) ||
+ (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) != E_BLOCK_AIR) ||
+ (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) != E_BLOCK_AIR)
)
{
return false;
@@ -54,6 +54,12 @@ public:
}
+ void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
+ {
+ a_World->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, 1);
+ }
+
+
virtual const char * GetStepSound(void) override
{
return "step.cloth";
diff --git a/source/Blocks/BlockChest.h b/source/Blocks/BlockChest.h
index ef00fce19..271a88097 100644
--- a/source/Blocks/BlockChest.h
+++ b/source/Blocks/BlockChest.h
@@ -14,16 +14,16 @@ class cBlockChestHandler :
public cBlockEntityHandler
{
public:
- cBlockChestHandler(BLOCKTYPE a_BlockID)
- : cBlockEntityHandler(a_BlockID)
+ cBlockChestHandler(BLOCKTYPE a_BlockType)
+ : cBlockEntityHandler(a_BlockType)
{
}
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
diff --git a/source/Blocks/BlockCloth.h b/source/Blocks/BlockCloth.h
index eb92b313a..82c0a0e29 100644
--- a/source/Blocks/BlockCloth.h
+++ b/source/Blocks/BlockCloth.h
@@ -11,8 +11,8 @@ class cBlockClothHandler :
public cBlockHandler
{
public:
- cBlockClothHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockClothHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockCrops.h b/source/Blocks/BlockCrops.h
index d288a597f..24b8904ae 100644
--- a/source/Blocks/BlockCrops.h
+++ b/source/Blocks/BlockCrops.h
@@ -6,8 +6,8 @@
class cBlockCropsHandler : public cBlockHandler
{
public:
- cBlockCropsHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockCropsHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -18,10 +18,10 @@ public:
}
- virtual void OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
MTRand rand;
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
cItems Drops;
@@ -30,19 +30,23 @@ public:
Drops.push_back(cItem(E_ITEM_WHEAT, 1, 0));
}
Drops.push_back(cItem(E_ITEM_SEEDS, (rand.randInt(3) == 0) ? 2 : 1, 0));
- a_World->SpawnItemPickups(Drops, a_X, a_Y, a_Z);
+ a_World->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ);
}
- void OnUpdate(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- // TODO: Handle Growing here
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ if (Meta < 7)
+ {
+ a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_CROPS, ++Meta);
+ }
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- return a_World->GetBlock(a_X, a_Y - 1, a_Z) == E_BLOCK_FARMLAND;
+ return a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ) == E_BLOCK_FARMLAND;
}
diff --git a/source/Blocks/BlockDirt.h b/source/Blocks/BlockDirt.h
index 346815846..b048b6318 100644
--- a/source/Blocks/BlockDirt.h
+++ b/source/Blocks/BlockDirt.h
@@ -14,8 +14,8 @@ class cBlockDirtHandler :
public cBlockHandler
{
public:
- cBlockDirtHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockDirtHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -26,18 +26,18 @@ public:
}
- void OnUpdate(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- if (m_BlockID != E_BLOCK_GRASS)
+ if (m_BlockType != E_BLOCK_GRASS)
{
return;
}
// Grass becomes dirt if there is something on top of it:
- BLOCKTYPE Above = a_World->GetBlock(a_X, a_Y + 1, a_Z);
+ BLOCKTYPE Above = a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ);
if (!g_BlockTransparent[Above] && !g_BlockOneHitDig[Above])
{
- a_World->FastSetBlock(a_X, a_Y, a_Z, E_BLOCK_DIRT, 0);
+ a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_DIRT, 0);
return;
}
@@ -51,7 +51,7 @@ public:
BLOCKTYPE DestBlock;
NIBBLETYPE DestMeta;
- a_World->GetBlockTypeMeta(a_X + OfsX, a_Y + OfsY, a_Z + OfsZ, DestBlock, DestMeta);
+ a_World->GetBlockTypeMeta(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ, DestBlock, DestMeta);
if(DestBlock != E_BLOCK_DIRT)
{
continue;
@@ -59,10 +59,10 @@ public:
BLOCKTYPE AboveDest;
NIBBLETYPE AboveMeta;
- a_World->GetBlockTypeMeta(a_X + OfsX, a_Y + OfsY + 1, a_Z + OfsZ, AboveDest, AboveMeta);
+ a_World->GetBlockTypeMeta(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, AboveDest, AboveMeta);
if (g_BlockOneHitDig[AboveDest] || g_BlockTransparent[AboveDest])
{
- a_World->FastSetBlock(a_X + OfsX, a_Y + OfsY, a_Z + OfsZ, E_BLOCK_GRASS, 0);
+ a_World->FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ, E_BLOCK_GRASS, 0);
}
} // for i - repeat twice
}
diff --git a/source/Blocks/BlockDispenser.h b/source/Blocks/BlockDispenser.h
index eee75a39a..4a54fbde5 100644
--- a/source/Blocks/BlockDispenser.h
+++ b/source/Blocks/BlockDispenser.h
@@ -7,15 +7,15 @@
class cBlockDispenserHandler : public cBlockEntityHandler
{
public:
- cBlockDispenserHandler(BLOCKTYPE a_BlockID)
- : cBlockEntityHandler(a_BlockID)
+ cBlockDispenserHandler(BLOCKTYPE a_BlockType)
+ : cBlockEntityHandler(a_BlockType)
{
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
diff --git a/source/Blocks/BlockDoor.cpp b/source/Blocks/BlockDoor.cpp
index da9b7d161..c0d616b37 100644
--- a/source/Blocks/BlockDoor.cpp
+++ b/source/Blocks/BlockDoor.cpp
@@ -10,8 +10,8 @@
-cBlockDoorHandler::cBlockDoorHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+cBlockDoorHandler::cBlockDoorHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -19,7 +19,7 @@ cBlockDoorHandler::cBlockDoorHandler(BLOCKTYPE a_BlockID)
-void cBlockDoorHandler::OnPlaced(cWorld * a_World, int a_X, int a_Y, int a_Z, int a_Dir)
+void cBlockDoorHandler::OnPlaced(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir)
{
}
@@ -28,24 +28,24 @@ void cBlockDoorHandler::OnPlaced(cWorld * a_World, int a_X, int a_Y, int a_Z, in
-void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z)
+void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- char OldMeta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ char OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (OldMeta & 8)
{
// Was upper part of door
- if (cDoors::IsDoor(a_World->GetBlock(a_X, a_Y - 1, a_Z)))
+ if (cDoors::IsDoor(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)))
{
- a_World->FastSetBlock(a_X, a_Y - 1, a_Z, E_BLOCK_AIR, 0);
+ a_World->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
}
}
else
{
// Was lower part
- if (cDoors::IsDoor(a_World->GetBlock(a_X, a_Y + 1, a_Z)))
+ if (cDoors::IsDoor(a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)))
{
- a_World->FastSetBlock(a_X, a_Y + 1, a_Z, E_BLOCK_AIR, 0);
+ a_World->FastSetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, E_BLOCK_AIR, 0);
}
}
}
@@ -54,32 +54,32 @@ void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z)
-void cBlockDoorHandler::OnDigging(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z)
+void cBlockDoorHandler::OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- cDoors::ChangeDoor(a_World, a_X, a_Y, a_Z);
+ cDoors::ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ);
}
-void cBlockDoorHandler::OnUse(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z)
+void cBlockDoorHandler::OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- cDoors::ChangeDoor(a_World, a_X, a_Y, a_Z);
+ cDoors::ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ);
}
-void cBlockDoorHandler::PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockDoorHandler::PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir)
{
- if (a_World->GetBlock(a_X, a_Y + 1, a_Z) == E_BLOCK_AIR)
+ if (a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ) == E_BLOCK_AIR)
{
a_BlockMeta = cDoors::RotationToMetaData(a_Player->GetRotation());
- a_World->SetBlock(a_X, a_Y + 1, a_Z, m_BlockID, a_BlockMeta + 8);
- 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);
+ a_World->SetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_BlockMeta + 8);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, a_BlockMeta);
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
}
@@ -89,7 +89,7 @@ void cBlockDoorHandler::PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLET
const char * cBlockDoorHandler::GetStepSound(void)
{
- return (m_BlockID == E_BLOCK_WOODEN_DOOR) ? "step.wood" : "step.stone";
+ return (m_BlockType == E_BLOCK_WOODEN_DOOR) ? "step.wood" : "step.stone";
}
diff --git a/source/Blocks/BlockDoor.h b/source/Blocks/BlockDoor.h
index 4d9d2dd4d..7499e9c82 100644
--- a/source/Blocks/BlockDoor.h
+++ b/source/Blocks/BlockDoor.h
@@ -11,16 +11,16 @@ class cBlockDoorHandler :
public cBlockHandler
{
public:
- cBlockDoorHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld * a_World, int a_X, int a_Y, int a_Z, int a_Dir) override;
- virtual void OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z) override;
- virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z) override;
- virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z) override;
+ cBlockDoorHandler(BLOCKTYPE a_BlockType);
+ virtual void OnPlaced(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir) override;
+ virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
virtual const char * GetStepSound(void) override;
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
- a_Pickups.push_back(cItem((m_BlockID == E_BLOCK_WOODEN_DOOR) ? E_ITEM_WOODEN_DOOR : E_ITEM_IRON_DOOR, 1, 0));
+ a_Pickups.push_back(cItem((m_BlockType == E_BLOCK_WOODEN_DOOR) ? E_ITEM_WOODEN_DOOR : E_ITEM_IRON_DOOR, 1, 0));
}
virtual bool IsUseable() override
@@ -28,7 +28,7 @@ public:
return true;
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override;
virtual bool CanBePlacedOnSide(void) override
{
diff --git a/source/Blocks/BlockEntity.h b/source/Blocks/BlockEntity.h
index caf6ee342..458cb33bd 100644
--- a/source/Blocks/BlockEntity.h
+++ b/source/Blocks/BlockEntity.h
@@ -10,8 +10,8 @@
class cBlockEntityHandler : public cBlockHandler
{
public:
- cBlockEntityHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockEntityHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockFire.h b/source/Blocks/BlockFire.h
index 73a8a64b9..7da66f982 100644
--- a/source/Blocks/BlockFire.h
+++ b/source/Blocks/BlockFire.h
@@ -11,14 +11,14 @@ class cBlockFireHandler :
public cBlockHandler
{
public:
- cBlockFireHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockFireHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
- virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z) override
+ virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- a_World->DigBlock(a_X, a_Y, a_Z);
+ a_World->DigBlock(a_BlockX, a_BlockY, a_BlockZ);
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
diff --git a/source/Blocks/BlockFlower.h b/source/Blocks/BlockFlower.h
index 4763d6911..7db42c9fc 100644
--- a/source/Blocks/BlockFlower.h
+++ b/source/Blocks/BlockFlower.h
@@ -11,8 +11,8 @@ class cBlockFlowerHandler :
public cBlockHandler
{
public:
- cBlockFlowerHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockFlowerHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -20,13 +20,13 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Reset meta to 0
- a_Pickups.push_back(cItem(m_BlockID, 1, 0));
+ a_Pickups.push_back(cItem(m_BlockType, 1, 0));
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- return IsBlockTypeOfDirt(a_World->GetBlock(a_X, a_Y - 1, a_Z));
+ return IsBlockTypeOfDirt(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ));
}
diff --git a/source/Blocks/BlockFluid.h b/source/Blocks/BlockFluid.h
index 1fc1b9a14..40ff621e4 100644
--- a/source/Blocks/BlockFluid.h
+++ b/source/Blocks/BlockFluid.h
@@ -11,8 +11,8 @@ class cBlockFluidHandler :
public cBlockHandler
{
public:
- cBlockFluidHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockFluidHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockFurnace.h b/source/Blocks/BlockFurnace.h
index ef78ba901..356014b11 100644
--- a/source/Blocks/BlockFurnace.h
+++ b/source/Blocks/BlockFurnace.h
@@ -14,8 +14,8 @@ class cBlockFurnaceHandler :
public cBlockEntityHandler
{
public:
- cBlockFurnaceHandler(BLOCKTYPE a_BlockID)
- : cBlockEntityHandler(a_BlockID)
+ cBlockFurnaceHandler(BLOCKTYPE a_BlockType)
+ : cBlockEntityHandler(a_BlockType)
{
}
@@ -26,10 +26,10 @@ public:
}
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), 0));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
} ;
diff --git a/source/Blocks/BlockGlowstone.h b/source/Blocks/BlockGlowstone.h
index a04b1a567..5ff9394b7 100644
--- a/source/Blocks/BlockGlowstone.h
+++ b/source/Blocks/BlockGlowstone.h
@@ -11,8 +11,8 @@ class cBlockGlowstoneHandler :
public cBlockHandler
{
public:
- cBlockGlowstoneHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockGlowstoneHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockGravel.h b/source/Blocks/BlockGravel.h
index 432df5f0a..6324fe06f 100644
--- a/source/Blocks/BlockGravel.h
+++ b/source/Blocks/BlockGravel.h
@@ -11,8 +11,8 @@ class cBlockGravelHandler :
public cBlockHandler
{
public:
- cBlockGravelHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockGravelHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp
index ae138db92..ab8dcda8a 100644
--- a/source/Blocks/BlockHandler.cpp
+++ b/source/Blocks/BlockHandler.cpp
@@ -54,7 +54,7 @@ cBlockHandler *cBlockHandler::m_BlockHandler[256];
-cBlockHandler *cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockID)
+cBlockHandler *cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockType)
{
if (!m_HandlerInitialized)
{
@@ -62,85 +62,85 @@ cBlockHandler *cBlockHandler::GetBlockHandler(BLOCKTYPE a_BlockID)
memset(m_BlockHandler, 0, sizeof(m_BlockHandler));
m_HandlerInitialized = true;
}
- if (m_BlockHandler[a_BlockID] != NULL)
+ if (m_BlockHandler[a_BlockType] != NULL)
{
- return m_BlockHandler[a_BlockID];
+ return m_BlockHandler[a_BlockType];
}
- return m_BlockHandler[a_BlockID] = CreateBlockHandler(a_BlockID);
+ return m_BlockHandler[a_BlockType] = CreateBlockHandler(a_BlockType);
}
-cBlockHandler *cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockID)
+cBlockHandler *cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
{
- switch(a_BlockID)
+ switch(a_BlockType)
{
case E_BLOCK_SAND:
- return new cBlockSandHandler(a_BlockID);
+ return new cBlockSandHandler(a_BlockType);
case E_BLOCK_GRAVEL:
- return new cBlockGravelHandler(a_BlockID);
+ return new cBlockGravelHandler(a_BlockType);
case E_BLOCK_WOODEN_DOOR:
case E_BLOCK_IRON_DOOR:
- return new cBlockDoorHandler(a_BlockID);
+ return new cBlockDoorHandler(a_BlockType);
case E_BLOCK_FIRE:
- return new cBlockFireHandler(a_BlockID);
+ return new cBlockFireHandler(a_BlockType);
case E_BLOCK_REDSTONE_TORCH_ON:
case E_BLOCK_REDSTONE_TORCH_OFF:
- return new cBlockRedstoneTorchHandler(a_BlockID);
+ return new cBlockRedstoneTorchHandler(a_BlockType);
case E_BLOCK_REDSTONE_WIRE:
- return new cBlockRedstoneHandler(a_BlockID);
+ return new cBlockRedstoneHandler(a_BlockType);
case E_BLOCK_PISTON:
case E_BLOCK_STICKY_PISTON:
- return new cBlockPistonHandler(a_BlockID);
+ return new cBlockPistonHandler(a_BlockType);
case E_BLOCK_REDSTONE_REPEATER_ON:
case E_BLOCK_REDSTONE_REPEATER_OFF:
- return new cBlockRedstoneRepeaterHandler(a_BlockID);
+ return new cBlockRedstoneRepeaterHandler(a_BlockType);
case E_BLOCK_WORKBENCH:
- return new cBlockWorkbenchHandler(a_BlockID);
+ return new cBlockWorkbenchHandler(a_BlockType);
case E_BLOCK_SNOW:
- return new cBlockSnowHandler(a_BlockID);
+ return new cBlockSnowHandler(a_BlockType);
case E_BLOCK_TALL_GRASS:
- return new cBlockTallGrassHandler(a_BlockID);
+ return new cBlockTallGrassHandler(a_BlockType);
case E_BLOCK_VINES:
- return new cBlockVineHandler(a_BlockID);
+ return new cBlockVineHandler(a_BlockType);
case ::E_BLOCK_WOOL:
- return new cBlockClothHandler(a_BlockID);
+ return new cBlockClothHandler(a_BlockType);
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);
+ return new cBlockSlabHandler(a_BlockType);
case E_BLOCK_LOG:
case E_BLOCK_PLANKS:
- return new cBlockWoodHandler(a_BlockID);
+ return new cBlockWoodHandler(a_BlockType);
case E_BLOCK_TORCH:
- return new cBlockTorchHandler(a_BlockID);
+ return new cBlockTorchHandler(a_BlockType);
case E_BLOCK_DIRT:
case E_BLOCK_GRASS:
- return new cBlockDirtHandler(a_BlockID);
+ return new cBlockDirtHandler(a_BlockType);
case E_BLOCK_LEAVES:
- return new cBlockLeavesHandler(a_BlockID);
+ return new cBlockLeavesHandler(a_BlockType);
case E_BLOCK_SAPLING:
- return new cBlockSaplingHandler(a_BlockID);
+ return new cBlockSaplingHandler(a_BlockType);
case E_BLOCK_WATER:
case E_BLOCK_STATIONARY_WATER:
case E_BLOCK_STATIONARY_LAVA:
case E_BLOCK_LAVA:
- return new cBlockFluidHandler(a_BlockID);
+ return new cBlockFluidHandler(a_BlockType);
case E_BLOCK_DISPENSER:
- return new cBlockDispenserHandler(a_BlockID);
+ return new cBlockDispenserHandler(a_BlockType);
case E_BLOCK_FURNACE:
case E_BLOCK_LIT_FURNACE:
- return new cBlockFurnaceHandler(a_BlockID);
+ return new cBlockFurnaceHandler(a_BlockType);
case E_BLOCK_CHEST:
- return new cBlockChestHandler(a_BlockID);
+ return new cBlockChestHandler(a_BlockType);
case E_BLOCK_ICE:
- return new cBlockIceHandler(a_BlockID);
+ return new cBlockIceHandler(a_BlockType);
case E_BLOCK_LADDER:
- return new cBlockLadderHandler(a_BlockID);
+ return new cBlockLadderHandler(a_BlockType);
case E_BLOCK_COBBLESTONE_STAIRS:
case E_BLOCK_BRICK_STAIRS:
case E_BLOCK_STONE_BRICK_STAIRS:
@@ -149,27 +149,27 @@ cBlockHandler *cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockID)
case E_BLOCK_SPRUCE_WOOD_STAIRS:
case E_BLOCK_BIRCH_WOOD_STAIRS:
case E_BLOCK_JUNGLE_WOOD_STAIRS:
- return new cBlockStairsHandler(a_BlockID);
+ return new cBlockStairsHandler(a_BlockType);
case E_BLOCK_SIGN_POST:
case E_BLOCK_WALLSIGN:
- return new cBlockSignHandler(a_BlockID);
+ return new cBlockSignHandler(a_BlockType);
case E_BLOCK_CROPS:
- return new cBlockCropsHandler(a_BlockID);
+ return new cBlockCropsHandler(a_BlockType);
case E_BLOCK_SUGARCANE:
- return new cBlockSugarcaneHandler(a_BlockID);
+ return new cBlockSugarcaneHandler(a_BlockType);
case E_BLOCK_YELLOW_FLOWER:
case E_BLOCK_RED_ROSE:
- return new cBlockFlowerHandler(a_BlockID);
+ return new cBlockFlowerHandler(a_BlockType);
case E_BLOCK_BROWN_MUSHROOM:
case E_BLOCK_RED_MUSHROOM:
- return new cBlockMushroomHandler(a_BlockID);
+ return new cBlockMushroomHandler(a_BlockType);
case E_BLOCK_CACTUS:
- return new cBlockCactusHandler(a_BlockID);
+ return new cBlockCactusHandler(a_BlockType);
case E_BLOCK_MELON_STEM:
case E_BLOCK_PUMPKIN_STEM:
- return new cBlockStemsHandler(a_BlockID);
+ return new cBlockStemsHandler(a_BlockType);
case E_BLOCK_GLOWSTONE:
- return new cBlockGlowstoneHandler(a_BlockID);
+ return new cBlockGlowstoneHandler(a_BlockType);
case E_BLOCK_DIAMOND_ORE:
case E_BLOCK_GOLD_ORE:
case E_BLOCK_REDSTONE_ORE:
@@ -178,18 +178,18 @@ cBlockHandler *cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockID)
case E_BLOCK_IRON_ORE:
case E_BLOCK_LAPIS_ORE:
case E_BLOCK_COAL_ORE:
- return new cBlockOreHandler(a_BlockID);
+ return new cBlockOreHandler(a_BlockType);
case E_BLOCK_STONE:
case E_BLOCK_COBBLESTONE:
- return new cBlockStoneHandler(a_BlockID);
+ return new cBlockStoneHandler(a_BlockType);
case E_BLOCK_MELON:
- return new cBlockMelonHandler(a_BlockID);
+ return new cBlockMelonHandler(a_BlockType);
case E_BLOCK_NOTE_BLOCK:
- return new cBlockNoteHandler(a_BlockID);
+ return new cBlockNoteHandler(a_BlockType);
case E_BLOCK_BED:
- return new cBlockBedHandler(a_BlockID);
+ return new cBlockBedHandler(a_BlockType);
default:
- return new cBlockHandler(a_BlockID);
+ return new cBlockHandler(a_BlockType);
break;
}
}
@@ -211,16 +211,16 @@ void cBlockHandler::Deinit()
-cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockID)
+cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockType)
{
- m_BlockID = a_BlockID;
+ m_BlockType = a_BlockType;
}
-void cBlockHandler::OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z)
+void cBlockHandler::OnUpdate(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
}
@@ -228,7 +228,7 @@ 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::OnPlacedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir)
{
}
@@ -236,7 +236,7 @@ void cBlockHandler::OnPlacedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_
-void cBlockHandler::OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z)
+void cBlockHandler::OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
}
@@ -244,46 +244,46 @@ void cBlockHandler::OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int
-void cBlockHandler::OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir)
+void cBlockHandler::OnPlaced(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ, 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);
+ NeighborChanged(a_World, a_BlockX - 1, a_BlockY, a_BlockZ);
+ NeighborChanged(a_World, a_BlockX + 1, a_BlockY, a_BlockZ);
+ NeighborChanged(a_World, a_BlockX, a_BlockY - 1, a_BlockZ);
+ NeighborChanged(a_World, a_BlockX, a_BlockY + 1, a_BlockZ);
+ NeighborChanged(a_World, a_BlockX, a_BlockY, a_BlockZ - 1);
+ NeighborChanged(a_World, a_BlockX, a_BlockY, a_BlockZ + 1);
}
-void cBlockHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
+void cBlockHandler::OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
//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);
+ NeighborChanged(a_World, a_BlockX - 1, a_BlockY, a_BlockZ);
+ NeighborChanged(a_World, a_BlockX + 1, a_BlockY, a_BlockZ);
+ NeighborChanged(a_World, a_BlockX, a_BlockY - 1, a_BlockZ);
+ NeighborChanged(a_World, a_BlockX, a_BlockY + 1, a_BlockZ);
+ NeighborChanged(a_World, a_BlockX, a_BlockY, a_BlockZ - 1);
+ NeighborChanged(a_World, a_BlockX, a_BlockY, a_BlockZ + 1);
}
-void cBlockHandler::NeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z)
+void cBlockHandler::NeighborChanged(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- GetBlockHandler(a_World->GetBlock(a_X, a_Y, a_Z))->OnNeighborChanged(a_World, a_X, a_Y, a_Z);
+ GetBlockHandler(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnNeighborChanged(a_World, a_BlockX, a_BlockY, a_BlockZ);
}
-void cBlockHandler::OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z)
+void cBlockHandler::OnNeighborChanged(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
}
@@ -291,7 +291,7 @@ 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::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
}
@@ -299,7 +299,7 @@ void cBlockHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a
-void cBlockHandler::OnUse(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_BlockX, int a_BlockY, int a_BlockZ)
{
}
@@ -307,10 +307,10 @@ void cBlockHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y,
-void cBlockHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, 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);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, a_BlockMeta);
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
@@ -320,21 +320,21 @@ void cBlockHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_
void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta)
{
// Setting the meta to a_BlockMeta keeps most textures. The few other blocks have to override this.
- a_Pickups.push_back(cItem(m_BlockID, 1, a_BlockMeta));
+ a_Pickups.push_back(cItem(m_BlockType, 1, a_BlockMeta));
}
-void cBlockHandler::DropBlock(cWorld * a_World, int a_X, int a_Y, int a_Z)
+void cBlockHandler::DropBlock(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
cItems Pickups;
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
ConvertToPickups(Pickups, Meta);
if (!Pickups.empty())
{
- a_World->SpawnItemPickups(Pickups, a_X, a_Y, a_Z);
+ a_World->SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ);
}
}
@@ -351,16 +351,16 @@ const char * cBlockHandler::GetStepSound()
-bool cBlockHandler::CanBePlacedAt(cWorld *a_World, int a_X, int a_Y, int a_Z, char a_Dir)
+bool cBlockHandler::CanBePlacedAt(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir)
{
- return CanBeAt(a_World, a_X, a_Y, a_Z);
+ return CanBeAt(a_World, a_BlockX, a_BlockY, a_BlockZ);
}
-bool cBlockHandler::CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z)
+bool cBlockHandler::CanBeAt(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
return true;
}
@@ -389,7 +389,7 @@ bool cBlockHandler::IsClickedThrough(void)
bool cBlockHandler::DoesIgnoreBuildCollision(void)
{
- return (m_BlockID == E_BLOCK_AIR);
+ return (m_BlockType == E_BLOCK_AIR);
}
diff --git a/source/Blocks/BlockHandler.h b/source/Blocks/BlockHandler.h
index 4ac7b2338..bfe92b676 100644
--- a/source/Blocks/BlockHandler.h
+++ b/source/Blocks/BlockHandler.h
@@ -19,43 +19,43 @@ class cPlayer;
class cBlockHandler
{
public:
- cBlockHandler(BLOCKTYPE a_BlockID);
+ cBlockHandler(BLOCKTYPE a_BlockType);
// 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);
+ virtual void OnUpdate(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ);
/// 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);
+ virtual void OnPlacedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir);
/// 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);
+ virtual void OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Called when a new block was placed. Called before OnPlacedByPlayer
- virtual void OnPlaced(cWorld * a_World, int a_X, int a_Y, int a_Z, int a_Dir);
+ virtual void OnPlaced(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir);
/// Called before a block gets destroyed / replaced with air
- virtual void OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z);
+ virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ);
/// 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);
+ virtual void OnNeighborChanged(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Notifies all neighbors of the given block about a change
- static void NeighborChanged(cWorld * a_World, int a_X, int a_Y, int a_Z);
+ static void NeighborChanged(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ);
/// 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);
+ virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Called if the user right clicks the block and the block is useable
- virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z);
+ virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ);
/// This function handles the real block placement for the give block by a player and also calls OnPlacedByPlayer()
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir);
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir);
/// Called when the item is mined to convert it into pickups. Pickups may specify multiple items.
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta);
/// Handles the dropping of a block based on what ConvertToDrops() returns. This will not destroy the block
- virtual void DropBlock(cWorld * a_World, int a_X, int a_Y, int a_Z);
+ virtual void DropBlock(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Returns step sound name of block
virtual const char * GetStepSound(void);
@@ -93,15 +93,16 @@ public:
/// Get the blockhandler for a specific block id
- static cBlockHandler * GetBlockHandler(BLOCKTYPE a_BlockID);
+ static cBlockHandler * GetBlockHandler(BLOCKTYPE a_BlockType);
/// 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);
+ BLOCKTYPE m_BlockType;
+
+ // Creates a new blockhandler for the given block type. For internal use only, use ::GetBlockHandler() instead.
+ static cBlockHandler *CreateBlockHandler(BLOCKTYPE a_BlockType);
static cBlockHandler *m_BlockHandler[256];
static bool m_HandlerInitialized; //used to detect if the blockhandlers are initialized
};
@@ -111,9 +112,9 @@ protected:
// Shortcut to get the blockhandler for a specific block
-inline cBlockHandler *BlockHandler(BLOCKTYPE a_BlockID)
+inline cBlockHandler * BlockHandler(BLOCKTYPE a_BlockType)
{
- return cBlockHandler::GetBlockHandler(a_BlockID);
+ return cBlockHandler::GetBlockHandler(a_BlockType);
}
diff --git a/source/Blocks/BlockIce.h b/source/Blocks/BlockIce.h
index 31a92db53..605a8ae1d 100644
--- a/source/Blocks/BlockIce.h
+++ b/source/Blocks/BlockIce.h
@@ -12,8 +12,8 @@ class cBlockIceHandler :
public cBlockHandler
{
public:
- cBlockIceHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockIceHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -24,10 +24,10 @@ public:
}
- virtual void OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
// TODO: Ice destroyed with air below it should turn into air instead of water
- a_World->FastSetBlock(a_X, a_Y, a_Z, E_BLOCK_STATIONARY_WATER, 8);
+ a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_STATIONARY_WATER, 8);
// This is called later than the real destroying of this ice block
}
} ;
diff --git a/source/Blocks/BlockLadder.h b/source/Blocks/BlockLadder.h
index a783b7074..92826b721 100644
--- a/source/Blocks/BlockLadder.h
+++ b/source/Blocks/BlockLadder.h
@@ -13,30 +13,30 @@ class cBlockLadderHandler :
public cBlockHandler
{
public:
- cBlockLadderHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockLadderHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cLadder::DirectionToMetaData(a_Dir));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cLadder::DirectionToMetaData(a_Dir));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
- virtual bool CanBePlacedAt(cWorld * a_World, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual bool CanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- AddDirection( a_X, a_Y, a_Z, a_Dir, true );
- return a_World->GetBlock( a_X, a_Y, a_Z ) != E_BLOCK_AIR;
+ AddDirection( a_BlockX, a_BlockY, a_BlockZ, a_Dir, true );
+ return a_World->GetBlock( a_BlockX, a_BlockY, a_BlockZ ) != E_BLOCK_AIR;
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- char Dir = cLadder::MetaDataToDirection(a_World->GetBlockMeta( a_X, a_Y, a_Z));
- return CanBePlacedAt(a_World, a_X, a_Y, a_Z, Dir);
+ char Dir = cLadder::MetaDataToDirection(a_World->GetBlockMeta( a_BlockX, a_BlockY, a_BlockZ));
+ return CanBePlacedAt(a_World, a_BlockX, a_BlockY, a_BlockZ, Dir);
}
diff --git a/source/Blocks/BlockLeaves.h b/source/Blocks/BlockLeaves.h
index e8e1d0f46..76b5e6d60 100644
--- a/source/Blocks/BlockLeaves.h
+++ b/source/Blocks/BlockLeaves.h
@@ -28,8 +28,8 @@ class cBlockLeavesHandler :
public cBlockHandler
{
public:
- cBlockLeavesHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockLeavesHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -53,33 +53,33 @@ public:
}
- void OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- cBlockHandler::OnDestroyed(a_World, a_X, a_Y, a_Z);
+ cBlockHandler::OnDestroyed(a_World, a_BlockX, a_BlockY, a_BlockZ);
//0.5% chance of dropping an apple
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
//check if Oak (0x1 and 0x2 bit not set)
MTRand rand;
if(!(Meta & 3) && rand.randInt(200) == 100)
{
cItems Drops;
Drops.push_back(cItem(E_ITEM_RED_APPLE, 1, 0));
- a_World->SpawnItemPickups(Drops, a_X, a_Y, a_Z);
+ a_World->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ);
}
}
- virtual void OnNeighborChanged(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual void OnNeighborChanged(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
- a_World->SetBlockMeta(a_X, a_Y, a_Z, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay
}
- virtual void OnUpdate(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if ((Meta & 0x04) != 0)
{
// Player-placed leaves, don't decay
@@ -96,9 +96,9 @@ public:
cBlockArea Area;
if (!Area.Read(
a_World,
- a_X - LEAVES_CHECK_DISTANCE, a_X + LEAVES_CHECK_DISTANCE,
- a_Y - LEAVES_CHECK_DISTANCE, a_Y + LEAVES_CHECK_DISTANCE,
- a_Z - LEAVES_CHECK_DISTANCE, a_Z + LEAVES_CHECK_DISTANCE,
+ a_BlockX - LEAVES_CHECK_DISTANCE, a_BlockX + LEAVES_CHECK_DISTANCE,
+ a_BlockY - LEAVES_CHECK_DISTANCE, a_BlockY + LEAVES_CHECK_DISTANCE,
+ a_BlockZ - LEAVES_CHECK_DISTANCE, a_BlockZ + LEAVES_CHECK_DISTANCE,
cBlockArea::baTypes)
)
{
@@ -106,16 +106,16 @@ public:
return;
}
- if (HasNearLog(Area, a_X, a_Y, a_Z))
+ if (HasNearLog(Area, a_BlockX, a_BlockY, a_BlockZ))
{
// Wood found, the leaves stay; mark them as checked:
- a_World->SetBlockMeta(a_X, a_Y, a_Z, Meta | 0x8);
+ a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta | 0x8);
return;
}
// Decay the leaves:
- DropBlock(a_World, a_X, a_Y, a_Z);
+ DropBlock(a_World, a_BlockX, a_BlockY, a_BlockZ);
- a_World->DigBlock(a_X, a_Y, a_Z);
+ a_World->DigBlock(a_BlockX, a_BlockY, a_BlockZ);
}
diff --git a/source/Blocks/BlockMelon.h b/source/Blocks/BlockMelon.h
index 62c1e2dd8..d985ef126 100644
--- a/source/Blocks/BlockMelon.h
+++ b/source/Blocks/BlockMelon.h
@@ -11,8 +11,8 @@ class cBlockMelonHandler :
public cBlockHandler
{
public:
- cBlockMelonHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockMelonHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockMushroom.h b/source/Blocks/BlockMushroom.h
index a74eacbc3..96bdbc310 100644
--- a/source/Blocks/BlockMushroom.h
+++ b/source/Blocks/BlockMushroom.h
@@ -11,8 +11,8 @@ class cBlockMushroomHandler :
public cBlockHandler
{
public:
- cBlockMushroomHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockMushroomHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -20,13 +20,13 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Reset meta to 0
- a_Pickups.push_back(cItem(m_BlockID, 1, 0));
+ a_Pickups.push_back(cItem(m_BlockType, 1, 0));
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- switch (a_World->GetBlock(a_X, a_Y - 1, a_Z))
+ switch (a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ))
{
case E_BLOCK_GLASS:
case E_BLOCK_CACTUS:
diff --git a/source/Blocks/BlockNote.h b/source/Blocks/BlockNote.h
index 896a5d03b..5884a1eb3 100644
--- a/source/Blocks/BlockNote.h
+++ b/source/Blocks/BlockNote.h
@@ -5,8 +5,8 @@
class cBlockNoteHandler : public cBlockEntityHandler
{
public:
- cBlockNoteHandler(BLOCKTYPE a_BlockID)
- : cBlockEntityHandler(a_BlockID)
+ cBlockNoteHandler(BLOCKTYPE a_BlockType)
+ : cBlockEntityHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockOre.h b/source/Blocks/BlockOre.h
index 86688b761..50f5a88e2 100644
--- a/source/Blocks/BlockOre.h
+++ b/source/Blocks/BlockOre.h
@@ -13,8 +13,8 @@ class cBlockOreHandler :
public cBlockHandler
{
public:
- cBlockOreHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockOreHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -25,7 +25,7 @@ public:
short Meta = 0;
MTRand r1;
- switch (m_BlockID)
+ switch (m_BlockType)
{
case E_BLOCK_LAPIS_ORE:
{
@@ -47,7 +47,7 @@ public:
}
}
- switch (m_BlockID)
+ switch (m_BlockType)
{
case E_BLOCK_DIAMOND_ORE:
{
diff --git a/source/Blocks/BlockPiston.cpp b/source/Blocks/BlockPiston.cpp
index a4ed13d88..e20f5c600 100644
--- a/source/Blocks/BlockPiston.cpp
+++ b/source/Blocks/BlockPiston.cpp
@@ -15,23 +15,30 @@
-cBlockPistonHandler::cBlockPistonHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+cBlockPistonHandler::cBlockPistonHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
-void cBlockPistonHandler::OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir)
-{
+
+
+
+void cBlockPistonHandler::OnPlaced(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir)
+{
}
-void cBlockPistonHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
+
+
+
+
+void cBlockPistonHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- char OldMeta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ char OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- int newX = a_X;
- int newY = a_Y;
- int newZ = a_Z;
+ int newX = a_BlockX;
+ int newY = a_BlockY;
+ int newZ = a_BlockZ;
AddPistonDir(newX, newY, newZ, OldMeta & ~(8), 1);
if (a_World->GetBlock(newX, newY, newZ) == E_BLOCK_PISTON_EXTENSION)
@@ -40,12 +47,20 @@ void cBlockPistonHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z
}
}
-void cBlockPistonHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+
+
+
+
+void cBlockPistonHandler::PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir)
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), a_Player->GetPitch()));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cPiston::RotationPitchToMetaData(a_Player->GetRotation(), a_Player->GetPitch()));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
cRedstone Redstone(a_World);
- Redstone.ChangeRedstone(a_X, a_Y, a_Z, false);
-} \ No newline at end of file
+ Redstone.ChangeRedstone(a_BlockX, a_BlockY, a_BlockZ, false);
+}
+
+
+
+
diff --git a/source/Blocks/BlockPiston.h b/source/Blocks/BlockPiston.h
index dbce9bae5..ce217c2bf 100644
--- a/source/Blocks/BlockPiston.h
+++ b/source/Blocks/BlockPiston.h
@@ -5,11 +5,11 @@
class cBlockPistonHandler : public cBlockHandler
{
public:
- cBlockPistonHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) override;
- virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override;
+ cBlockPistonHandler(BLOCKTYPE a_BlockType);
+ virtual void OnPlaced(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir) override;
+ virtual void OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override;
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override;
}; \ No newline at end of file
diff --git a/source/Blocks/BlockRedstone.cpp b/source/Blocks/BlockRedstone.cpp
index 7653436f4..dac4aecb7 100644
--- a/source/Blocks/BlockRedstone.cpp
+++ b/source/Blocks/BlockRedstone.cpp
@@ -5,30 +5,30 @@
#include "../Redstone.h"
#include "../Torch.h"
-cBlockRedstoneHandler::cBlockRedstoneHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+cBlockRedstoneHandler::cBlockRedstoneHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
-void cBlockRedstoneHandler::OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir)
+void cBlockRedstoneHandler::OnPlaced(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir)
{
cRedstone Redstone(a_World);
bool Added = false;
- if(a_World->GetBlock(a_X, a_Y, a_Z) == E_BLOCK_REDSTONE_TORCH_ON)
+ if(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_REDSTONE_TORCH_ON)
Added = true;
- Redstone.ChangeRedstone(a_X, a_Y, a_Z, Added);
+ Redstone.ChangeRedstone(a_BlockX, a_BlockY, a_BlockZ, Added);
}
-void cBlockRedstoneHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
+void cBlockRedstoneHandler::OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
cRedstone Redstone(a_World);
- Redstone.ChangeRedstone(a_X, a_Y, a_Z, false);
+ Redstone.ChangeRedstone(a_BlockX, a_BlockY, a_BlockZ, false);
}
-void cBlockRedstoneHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockRedstoneHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir)
{
- switch(m_BlockID)
+ switch(m_BlockType)
{
case E_BLOCK_REDSTONE_TORCH_ON:
case E_BLOCK_REDSTONE_TORCH_OFF:
@@ -36,6 +36,6 @@ void cBlockRedstoneHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBL
break;
}
- 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);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, a_BlockMeta);
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
} \ No newline at end of file
diff --git a/source/Blocks/BlockRedstone.h b/source/Blocks/BlockRedstone.h
index fa9aeef01..bb4997e2f 100644
--- a/source/Blocks/BlockRedstone.h
+++ b/source/Blocks/BlockRedstone.h
@@ -12,30 +12,38 @@ class cBlockRedstoneHandler :
public cBlockHandler
{
public:
- cBlockRedstoneHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld * a_World, int a_X, int a_Y, int a_Z, int a_Dir) override;
- virtual void OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z) override;
+ cBlockRedstoneHandler(BLOCKTYPE a_BlockType);
+ virtual void OnPlaced(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir) override;
+ virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override;
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
virtual bool DoesAllowBlockOnTop(void) override
{
return false;
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- return a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR;
+ return a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ) != E_BLOCK_AIR;
}
+
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Reset meta to 0
a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, 1));
}
+
virtual bool CanBePlacedOnSide(void) override
{
return false;
}
-}; \ No newline at end of file
+} ;
+
+
+
+
diff --git a/source/Blocks/BlockRedstoneRepeater.cpp b/source/Blocks/BlockRedstoneRepeater.cpp
index 861f6e221..797c8c4d2 100644
--- a/source/Blocks/BlockRedstoneRepeater.cpp
+++ b/source/Blocks/BlockRedstoneRepeater.cpp
@@ -5,35 +5,35 @@
#include "../Redstone.h"
#include "../Player.h"
-cBlockRedstoneRepeaterHandler::cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+cBlockRedstoneRepeaterHandler::cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
-void cBlockRedstoneRepeaterHandler::OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir)
+void cBlockRedstoneRepeaterHandler::OnPlaced(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir)
{
cRedstone Redstone(a_World);
- Redstone.ChangeRedstone(a_X, a_Y, a_Z, false);
+ Redstone.ChangeRedstone(a_BlockX, a_BlockY, a_BlockZ, false);
}
-void cBlockRedstoneRepeaterHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z)
+void cBlockRedstoneRepeaterHandler::OnDestroyed(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
cRedstone Redstone(a_World);
- Redstone.ChangeRedstone(a_X, a_Y, a_Z, false);
+ Redstone.ChangeRedstone(a_BlockX, a_BlockY, a_BlockZ, false);
}
-void cBlockRedstoneRepeaterHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z)
+void cBlockRedstoneRepeaterHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- a_World->FastSetBlock(a_X, a_Y, a_Z, m_BlockID, ((a_World->GetBlockMeta(a_X, a_Y, a_Z) + 0x04) & 0x0f));
+ a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, ((a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) + 0x04) & 0x0f));
}
-void cBlockRedstoneRepeaterHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z)
+void cBlockRedstoneRepeaterHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- OnUse(a_World, a_Player, a_X, a_Y, a_Z);
+ OnUse(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ);
}
-void cBlockRedstoneRepeaterHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir)
+void cBlockRedstoneRepeaterHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir)
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cRedstone::RepeaterRotationToMetaData(a_Player->GetRotation()));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cRedstone::RepeaterRotationToMetaData(a_Player->GetRotation()));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
} \ No newline at end of file
diff --git a/source/Blocks/BlockRedstoneRepeater.h b/source/Blocks/BlockRedstoneRepeater.h
index dda3d31a7..8beb4b94a 100644
--- a/source/Blocks/BlockRedstoneRepeater.h
+++ b/source/Blocks/BlockRedstoneRepeater.h
@@ -12,12 +12,12 @@ class cBlockRedstoneRepeaterHandler :
public cBlockHandler
{
public:
- cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockID);
- virtual void OnPlaced(cWorld * a_World, int a_X, int a_Y, int a_Z, int a_Dir) override;
- virtual void OnDestroyed(cWorld * a_World, int a_X, int a_Y, int a_Z) override;
+ cBlockRedstoneRepeaterHandler(BLOCKTYPE a_BlockType);
+ virtual void OnPlaced(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, int a_Dir) override;
+ virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override;
- virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z) override;
- virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_X, int a_Y, int a_Z) override;
+ virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
@@ -33,7 +33,7 @@ public:
}
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override;
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override;
virtual bool DoesAllowBlockOnTop(void) override
@@ -42,9 +42,9 @@ public:
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- return a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR;
+ return a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ) != E_BLOCK_AIR;
}
diff --git a/source/Blocks/BlockRedstoneTorch.h b/source/Blocks/BlockRedstoneTorch.h
index 857c61761..ef4efaaab 100644
--- a/source/Blocks/BlockRedstoneTorch.h
+++ b/source/Blocks/BlockRedstoneTorch.h
@@ -13,8 +13,8 @@ class cBlockRedstoneTorchHandler :
public cBlockTorchHandler
{
public:
- cBlockRedstoneTorchHandler(BLOCKTYPE a_BlockID)
- : cBlockTorchHandler(a_BlockID)
+ cBlockRedstoneTorchHandler(BLOCKTYPE a_BlockType)
+ : cBlockTorchHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockSand.h b/source/Blocks/BlockSand.h
index 0cd4064ae..878770d22 100644
--- a/source/Blocks/BlockSand.h
+++ b/source/Blocks/BlockSand.h
@@ -11,8 +11,8 @@ class cBlockSandHandler :
public cBlockHandler
{
public:
- cBlockSandHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockSandHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockSapling.h b/source/Blocks/BlockSapling.h
index 0c133568e..447774f85 100644
--- a/source/Blocks/BlockSapling.h
+++ b/source/Blocks/BlockSapling.h
@@ -12,8 +12,8 @@ class cBlockSaplingHandler :
public cBlockHandler
{
public:
- cBlockSaplingHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockSaplingHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -25,9 +25,9 @@ public:
}
- virtual bool CanBeAt(cWorld *a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- return IsBlockTypeOfDirt(a_World->GetBlock(a_X, a_Y - 1, a_Z));
+ return IsBlockTypeOfDirt(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ));
}
@@ -37,17 +37,17 @@ public:
}
- void OnUpdate(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- NIBBLETYPE Meta = a_World->GetBlockMeta(a_X, a_Y, a_Z);
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if ((Meta & 0x08) != 0)
{
- a_World->GrowTree(a_X, a_Y, a_Z);
+ a_World->GrowTree(a_BlockX, a_BlockY, a_BlockZ);
}
else
{
- a_World->SetBlockMeta(a_X, a_Y, a_Z, Meta | 0x08);
+ a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta | 0x08);
}
}
diff --git a/source/Blocks/BlockSign.h b/source/Blocks/BlockSign.h
index 9c6bf3ec6..b6e773afb 100644
--- a/source/Blocks/BlockSign.h
+++ b/source/Blocks/BlockSign.h
@@ -14,13 +14,13 @@ class cBlockSignHandler :
public cBlockHandler
{
public:
- cBlockSignHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockSignHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
BLOCKTYPE Block;
NIBBLETYPE Meta;
@@ -35,8 +35,8 @@ public:
Block = E_BLOCK_WALLSIGN;
}
- a_World->SetBlock(a_X, a_Y, a_Z, Block, Meta);
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, Block, Meta);
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
diff --git a/source/Blocks/BlockSlab.h b/source/Blocks/BlockSlab.h
index 2e9a6faf4..45488480c 100644
--- a/source/Blocks/BlockSlab.h
+++ b/source/Blocks/BlockSlab.h
@@ -11,23 +11,23 @@ class cBlockSlabHandler :
public cBlockHandler
{
public:
- cBlockSlabHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockSlabHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
- char Count = ((m_BlockID == E_BLOCK_DOUBLE_STONE_SLAB) || (m_BlockID == E_BLOCK_DOUBLE_WOODEN_SLAB)) ? 2 : 1;
- a_Pickups.push_back(cItem(m_BlockID, Count, a_BlockMeta));
+ char Count = ((m_BlockType == E_BLOCK_DOUBLE_STONE_SLAB) || (m_BlockType == E_BLOCK_DOUBLE_WOODEN_SLAB)) ? 2 : 1;
+ a_Pickups.push_back(cItem(m_BlockType, Count, a_BlockMeta));
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, DirectionToMetaData( a_Dir, a_BlockMeta ));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, DirectionToMetaData( a_Dir, a_BlockMeta ));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
@@ -44,7 +44,7 @@ public:
virtual const char * GetStepSound(void) override
{
- return ((m_BlockID == E_BLOCK_WOODEN_SLAB) || (m_BlockID == E_BLOCK_DOUBLE_WOODEN_SLAB)) ? "step.wood" : "step.stone";
+ return ((m_BlockType == E_BLOCK_WOODEN_SLAB) || (m_BlockType == E_BLOCK_DOUBLE_WOODEN_SLAB)) ? "step.wood" : "step.stone";
}
} ;
diff --git a/source/Blocks/BlockSnow.h b/source/Blocks/BlockSnow.h
index 9a1a4170c..7d29c67f2 100644
--- a/source/Blocks/BlockSnow.h
+++ b/source/Blocks/BlockSnow.h
@@ -11,8 +11,8 @@ class cBlockSnowHandler :
public cBlockHandler
{
public:
- cBlockSnowHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockSnowHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -29,9 +29,10 @@ public:
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- return (a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR);
+ BLOCKTYPE UnderlyingBlock = a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ);
+ return g_BlockIsSnowable[UnderlyingBlock];
}
diff --git a/source/Blocks/BlockStairs.h b/source/Blocks/BlockStairs.h
index 4d0007bc5..71df6f00e 100644
--- a/source/Blocks/BlockStairs.h
+++ b/source/Blocks/BlockStairs.h
@@ -5,17 +5,17 @@
class cBlockStairsHandler : public cBlockHandler
{
public:
- cBlockStairsHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockStairsHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
- virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cStairs::RotationToMetaData(a_Player->GetRotation(), a_Dir));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cStairs::RotationToMetaData(a_Player->GetRotation(), a_Dir));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
//TODO: step sound
diff --git a/source/Blocks/BlockStems.h b/source/Blocks/BlockStems.h
index 468a6f212..ba93097f9 100644
--- a/source/Blocks/BlockStems.h
+++ b/source/Blocks/BlockStems.h
@@ -13,27 +13,37 @@ class cBlockStemsHandler :
public cBlockHandler
{
public:
- cBlockStemsHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockStemsHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
- int ItemType = (m_BlockID == E_BLOCK_MELON_STEM) ? E_ITEM_MELON_SEEDS : E_ITEM_PUMPKIN_SEEDS;
+ int ItemType = (m_BlockType == E_BLOCK_MELON_STEM) ? E_ITEM_MELON_SEEDS : E_ITEM_PUMPKIN_SEEDS;
a_Pickups.push_back(cItem(ItemType, 1, 0));
}
- void OnUpdate(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- // TODO: Handle Growing here
+ NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ if (Meta >= 7)
+ {
+ // Grow the produce:
+ a_World->GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, m_BlockType);
+ }
+ else
+ {
+ // Grow the stem:
+ a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta + 1);
+ }
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- return a_World->GetBlock(a_X, a_Y - 1, a_Z) == E_BLOCK_FARMLAND;
+ return a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ) == E_BLOCK_FARMLAND;
}
diff --git a/source/Blocks/BlockStone.h b/source/Blocks/BlockStone.h
index c4faf2498..69809c078 100644
--- a/source/Blocks/BlockStone.h
+++ b/source/Blocks/BlockStone.h
@@ -13,8 +13,8 @@ class cBlockStoneHandler :
public cBlockHandler
{
public:
- cBlockStoneHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockStoneHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockSugarcane.h b/source/Blocks/BlockSugarcane.h
index 28ffd8aa6..9470900f0 100644
--- a/source/Blocks/BlockSugarcane.h
+++ b/source/Blocks/BlockSugarcane.h
@@ -11,8 +11,8 @@ class cBlockSugarcaneHandler :
public cBlockHandler
{
public:
- cBlockSugarcaneHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockSugarcaneHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -23,16 +23,16 @@ public:
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- switch (a_World->GetBlock(a_X, a_Y - 1, a_Z))
+ switch (a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ))
{
case E_BLOCK_DIRT:
case E_BLOCK_GRASS:
case E_BLOCK_FARMLAND:
case E_BLOCK_SAND:
{
- return a_World->IsBlockDirectlyWatered(a_X, a_Y - 1, a_Z);
+ return a_World->IsBlockDirectlyWatered(a_BlockX, a_BlockY - 1, a_BlockZ);
}
case E_BLOCK_SUGARCANE:
{
@@ -43,17 +43,18 @@ public:
}
- void OnUpdate(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- // TODO: Handle Growing here
+ a_World->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, 1);
}
-
+
virtual bool CanBePlacedOnSide() override
{
return false;
}
+
virtual const char * GetStepSound(void) override
{
return "step.grass";
diff --git a/source/Blocks/BlockTallGrass.h b/source/Blocks/BlockTallGrass.h
index 20714832f..702ebf14c 100644
--- a/source/Blocks/BlockTallGrass.h
+++ b/source/Blocks/BlockTallGrass.h
@@ -11,8 +11,8 @@ class cBlockTallGrassHandler :
public cBlockHandler
{
public:
- cBlockTallGrassHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockTallGrassHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -34,9 +34,9 @@ public:
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- return a_World->GetBlock(a_X, a_Y - 1, a_Z) != E_BLOCK_AIR;
+ return a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ) != E_BLOCK_AIR;
}
diff --git a/source/Blocks/BlockTorch.h b/source/Blocks/BlockTorch.h
index e65a973d2..2eb09f3ec 100644
--- a/source/Blocks/BlockTorch.h
+++ b/source/Blocks/BlockTorch.h
@@ -13,17 +13,17 @@ class cBlockTorchHandler :
public cBlockHandler
{
public:
- cBlockTorchHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockTorchHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- if (!TorchCanBePlacedAt(a_World, a_X, a_Y, a_Z, a_Dir))
+ if (!TorchCanBePlacedAt(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Dir))
{
- a_Dir = FindSuitableDirection(a_World, a_X, a_Y, a_Z);
+ a_Dir = FindSuitableDirection(a_World, a_BlockX, a_BlockY, a_BlockZ);
if (a_Dir == BLOCK_FACE_BOTTOM)
{
@@ -31,8 +31,8 @@ public:
}
}
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cTorch::DirectionToMetaData(a_Dir));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cTorch::DirectionToMetaData(a_Dir));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
@@ -114,7 +114,7 @@ public:
}
- static bool TorchCanBePlacedAt(cWorld * a_World, int a_X, int a_Y, int a_Z, char a_Dir)
+ static bool TorchCanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir)
{
// TODO: If placing a torch from below, check all 4 XZ neighbors, place it on that neighbor instead
// How to propagate that change up?
@@ -125,18 +125,18 @@ public:
return false;
}
- AddDirection( a_X, a_Y, a_Z, a_Dir, true );
+ AddDirection( a_BlockX, a_BlockY, a_BlockZ, a_Dir, true );
- return CanBePlacedOn(a_World->GetBlock( a_X, a_Y, a_Z ), a_Dir);
+ return CanBePlacedOn(a_World->GetBlock( a_BlockX, a_BlockY, a_BlockZ ), a_Dir);
}
/// Finds a suitable Direction for the Torch. Returns BLOCK_FACE_BOTTOM on failure
- static char FindSuitableDirection(cWorld * a_World, int a_X, int a_Y, int a_Z)
+ static char FindSuitableDirection(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{
for (int i = 1; i <= 5; i++)
{
- if (TorchCanBePlacedAt(a_World, a_X, a_Y, a_Z, i))
+ if (TorchCanBePlacedAt(a_World, a_BlockX, a_BlockY, a_BlockZ, i))
{
return i;
}
@@ -145,26 +145,26 @@ public:
}
- virtual bool CanBePlacedAt(cWorld * a_World, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual bool CanBePlacedAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- if(TorchCanBePlacedAt(a_World, a_X, a_Y, a_Z, a_Dir))
+ if(TorchCanBePlacedAt(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Dir))
return true;
- return FindSuitableDirection(a_World, a_X, a_Y, a_Z) != BLOCK_FACE_BOTTOM;
+ return FindSuitableDirection(a_World, a_BlockX, a_BlockY, a_BlockZ) != BLOCK_FACE_BOTTOM;
}
- virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
+ virtual bool CanBeAt(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
- char Dir = cTorch::MetaDataToDirection(a_World->GetBlockMeta( a_X, a_Y, a_Z));
- return TorchCanBePlacedAt(a_World, a_X, a_Y, a_Z, Dir);
+ char Dir = cTorch::MetaDataToDirection(a_World->GetBlockMeta( a_BlockX, a_BlockY, a_BlockZ));
+ return TorchCanBePlacedAt(a_World, a_BlockX, a_BlockY, a_BlockZ, Dir);
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Always drop meta = 0
- a_Pickups.push_back(cItem(m_BlockID, 1, 0));
+ a_Pickups.push_back(cItem(m_BlockType, 1, 0));
}
diff --git a/source/Blocks/BlockVine.h b/source/Blocks/BlockVine.h
index f489a5c5c..3485f29c5 100644
--- a/source/Blocks/BlockVine.h
+++ b/source/Blocks/BlockVine.h
@@ -12,8 +12,8 @@ class cBlockVineHandler :
public cBlockHandler
{
public:
- cBlockVineHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockVineHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
@@ -24,10 +24,10 @@ public:
}
- virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) override
+ virtual void PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
{
- a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cVine::DirectionToMetaData(a_Dir));
- OnPlacedByPlayer(a_World, a_Player, a_X, a_Y, a_Z, a_Dir);
+ a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, cVine::DirectionToMetaData(a_Dir));
+ OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir);
}
diff --git a/source/Blocks/BlockWood.h b/source/Blocks/BlockWood.h
index d3fcacf7d..907fb587c 100644
--- a/source/Blocks/BlockWood.h
+++ b/source/Blocks/BlockWood.h
@@ -10,8 +10,8 @@
class cBlockWoodHandler : public cBlockHandler
{
public:
- cBlockWoodHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockWoodHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}
diff --git a/source/Blocks/BlockWorkbench.h b/source/Blocks/BlockWorkbench.h
index f6158b979..c5102326e 100644
--- a/source/Blocks/BlockWorkbench.h
+++ b/source/Blocks/BlockWorkbench.h
@@ -13,8 +13,8 @@ class cBlockWorkbenchHandler:
public cBlockHandler
{
public:
- cBlockWorkbenchHandler(BLOCKTYPE a_BlockID)
- : cBlockHandler(a_BlockID)
+ cBlockWorkbenchHandler(BLOCKTYPE a_BlockType)
+ : cBlockHandler(a_BlockType)
{
}