summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/Bindings.cpp108
-rw-r--r--source/Bindings.h2
-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
-rw-r--r--source/Chunk.cpp32
-rw-r--r--source/Chunk.h7
-rw-r--r--source/ChunkMap.h4
-rw-r--r--source/Defines.h36
-rw-r--r--source/FireSimulator.cpp32
-rw-r--r--source/FireSimulator.h8
-rw-r--r--source/FluidSimulator.cpp30
-rw-r--r--source/FluidSimulator.h10
-rw-r--r--source/Items/ItemDye.h15
-rw-r--r--source/Items/ItemHandler.cpp2
-rw-r--r--source/Items/ItemHandler.h2
-rw-r--r--source/Items/ItemPickaxe.h4
-rw-r--r--source/Items/ItemShears.h6
-rw-r--r--source/Items/ItemShovel.h4
-rw-r--r--source/Items/ItemSword.h4
-rw-r--r--source/LavaSimulator.cpp4
-rw-r--r--source/LavaSimulator.h2
-rw-r--r--source/LuaChunk.h8
-rw-r--r--source/RedstoneSimulator.h2
-rw-r--r--source/SandSimulator.cpp16
-rw-r--r--source/SandSimulator.h4
-rw-r--r--source/Simulator.h2
-rw-r--r--source/WaterSimulator.cpp4
-rw-r--r--source/WaterSimulator.h2
-rw-r--r--source/World.cpp22
-rw-r--r--source/World.h8
75 files changed, 675 insertions, 541 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 38655ec08..27ed6a0a3 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 10/03/12 09:15:14.
+** Generated automatically by tolua++-1.0.92 on 10/03/12 10:03:23.
*/
#ifndef __cplusplus
@@ -2874,9 +2874,9 @@ static int tolua_AllToLua_IsValidBlock00(lua_State* tolua_S)
else
#endif
{
- int a_BlockID = ((int) tolua_tonumber(tolua_S,1,0));
+ int a_BlockType = ((int) tolua_tonumber(tolua_S,1,0));
{
- bool tolua_ret = (bool) IsValidBlock(a_BlockID);
+ bool tolua_ret = (bool) IsValidBlock(a_BlockType);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
@@ -12181,9 +12181,9 @@ static int tolua_AllToLua_cWorld_GrowTreeByBiome00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
-/* method: GrowPlant of class cWorld */
-#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowPlant00
-static int tolua_AllToLua_cWorld_GrowPlant00(lua_State* tolua_S)
+/* method: GrowRipePlant of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowRipePlant00
+static int tolua_AllToLua_cWorld_GrowRipePlant00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
@@ -12205,17 +12205,56 @@ static int tolua_AllToLua_cWorld_GrowPlant00(lua_State* tolua_S)
int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
bool a_IsByBonemeal = ((bool) tolua_toboolean(tolua_S,5,false));
#ifndef TOLUA_RELEASE
- if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowPlant'", NULL);
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowRipePlant'", NULL);
#endif
{
- bool tolua_ret = (bool) self->GrowPlant(a_BlockX,a_BlockY,a_BlockZ,a_IsByBonemeal);
+ bool tolua_ret = (bool) self->GrowRipePlant(a_BlockX,a_BlockY,a_BlockZ,a_IsByBonemeal);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
- tolua_error(tolua_S,"#ferror in function 'GrowPlant'.",&tolua_err);
+ tolua_error(tolua_S,"#ferror in function 'GrowRipePlant'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GrowCactus of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowCactus00
+static int tolua_AllToLua_cWorld_GrowCactus00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+ int a_NumBlocksToGrow = ((int) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowCactus'", NULL);
+#endif
+ {
+ self->GrowCactus(a_BlockX,a_BlockY,a_BlockZ,a_NumBlocksToGrow);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GrowCactus'.",&tolua_err);
return 0;
#endif
}
@@ -12260,6 +12299,45 @@ static int tolua_AllToLua_cWorld_GrowMelonPumpkin00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: GrowSugarcane of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowSugarcane00
+static int tolua_AllToLua_cWorld_GrowSugarcane00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+ int a_NumBlocksToGrow = ((int) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowSugarcane'", NULL);
+#endif
+ {
+ self->GrowSugarcane(a_BlockX,a_BlockY,a_BlockZ,a_NumBlocksToGrow);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GrowSugarcane'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: GetBiomeAt of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBiomeAt00
static int tolua_AllToLua_cWorld_GetBiomeAt00(lua_State* tolua_S)
@@ -19440,13 +19518,13 @@ static int tolua_AllToLua_cLuaChunk_FillBlocks00(lua_State* tolua_S)
#endif
{
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
- char a_BlockID = ((char) tolua_tonumber(tolua_S,2,0));
+ char a_BlockType = ((char) tolua_tonumber(tolua_S,2,0));
unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillBlocks'", NULL);
#endif
{
- self->FillBlocks(a_BlockID,a_BlockMeta);
+ self->FillBlocks(a_BlockType,a_BlockMeta);
}
}
return 0;
@@ -19481,13 +19559,13 @@ static int tolua_AllToLua_cLuaChunk_SetBlock00(lua_State* tolua_S)
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
int a_Y = ((int) tolua_tonumber(tolua_S,3,0));
int a_Z = ((int) tolua_tonumber(tolua_S,4,0));
- char a_BlockID = ((char) tolua_tonumber(tolua_S,5,0));
+ char a_BlockType = ((char) tolua_tonumber(tolua_S,5,0));
unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,6,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlock'", NULL);
#endif
{
- self->SetBlock(a_X,a_Y,a_Z,a_BlockID,a_BlockMeta);
+ self->SetBlock(a_X,a_Y,a_Z,a_BlockType,a_BlockMeta);
}
}
return 0;
@@ -22025,8 +22103,10 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"GrowTree",tolua_AllToLua_cWorld_GrowTree00);
tolua_function(tolua_S,"GrowTreeFromSapling",tolua_AllToLua_cWorld_GrowTreeFromSapling00);
tolua_function(tolua_S,"GrowTreeByBiome",tolua_AllToLua_cWorld_GrowTreeByBiome00);
- tolua_function(tolua_S,"GrowPlant",tolua_AllToLua_cWorld_GrowPlant00);
+ tolua_function(tolua_S,"GrowRipePlant",tolua_AllToLua_cWorld_GrowRipePlant00);
+ tolua_function(tolua_S,"GrowCactus",tolua_AllToLua_cWorld_GrowCactus00);
tolua_function(tolua_S,"GrowMelonPumpkin",tolua_AllToLua_cWorld_GrowMelonPumpkin00);
+ tolua_function(tolua_S,"GrowSugarcane",tolua_AllToLua_cWorld_GrowSugarcane00);
tolua_function(tolua_S,"GetBiomeAt",tolua_AllToLua_cWorld_GetBiomeAt00);
tolua_function(tolua_S,"GetName",tolua_AllToLua_cWorld_GetName00);
tolua_function(tolua_S,"SaveAllChunks",tolua_AllToLua_cWorld_SaveAllChunks00);
diff --git a/source/Bindings.h b/source/Bindings.h
index 2b5822320..56b73ab50 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 10/03/12 09:15:15.
+** Generated automatically by tolua++-1.0.92 on 10/03/12 10:03:23.
*/
/* Exported function */
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)
{
}
diff --git a/source/Chunk.cpp b/source/Chunk.cpp
index ec0ad01e0..01a6640e2 100644
--- a/source/Chunk.cpp
+++ b/source/Chunk.cpp
@@ -482,22 +482,7 @@ void cChunk::TickBlocks(MTRand & a_TickRandom)
BLOCKTYPE ID = m_BlockTypes[Index];
switch( ID )
{
- case E_BLOCK_CROPS:
- {
- NIBBLETYPE Meta = GetMeta(Index);
- if (Meta < 7)
- {
- FastSetBlock(m_BlockTickX, m_BlockTickY, m_BlockTickZ, E_BLOCK_CROPS, ++Meta);
- }
- break;
- }
-
- case E_BLOCK_PUMPKIN_STEM:
- case E_BLOCK_MELON_STEM: TickMelonPumpkin(m_BlockTickX, m_BlockTickY, m_BlockTickZ, Index, ID, a_TickRandom); break;
- case E_BLOCK_FARMLAND: TickFarmland (m_BlockTickX, m_BlockTickY, m_BlockTickZ); break;
- case E_BLOCK_SUGARCANE: GrowSugarcane (m_BlockTickX, m_BlockTickY, m_BlockTickZ, 1); break;
- case E_BLOCK_CACTUS: GrowCactus (m_BlockTickX, m_BlockTickY, m_BlockTickZ, 1); break;
-
+ case E_BLOCK_FARMLAND: TickFarmland (m_BlockTickX, m_BlockTickY, m_BlockTickZ); break;
default:
{
@@ -514,21 +499,6 @@ void cChunk::TickBlocks(MTRand & a_TickRandom)
-void cChunk::TickMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, int a_BlockIdx, BLOCKTYPE a_BlockType, MTRand & a_TickRandom)
-{
- NIBBLETYPE Meta = GetMeta(a_BlockIdx);
- if (Meta < 7)
- {
- FastSetBlock(m_BlockTickX, m_BlockTickY, m_BlockTickZ, a_BlockType, ++Meta);
- return;
- }
- GrowMelonPumpkin(a_RelX, a_RelY, a_RelZ, a_BlockType, a_TickRandom);
-}
-
-
-
-
-
void cChunk::TickFarmland(int a_RelX, int a_RelY, int a_RelZ)
{
// TODO: Rain hydrates blocks, too. Check world weather, don't search for water if raining.
diff --git a/source/Chunk.h b/source/Chunk.h
index a76ec4e58..480dea796 100644
--- a/source/Chunk.h
+++ b/source/Chunk.h
@@ -279,10 +279,9 @@ private:
/// Checks the block scheduled for checking in m_ToTickBlocks[]
void CheckBlocks(void);
- void TickBlocks (MTRand & a_TickRandom);
- void TickGrass (int a_RelX, int a_RelY, int a_RelZ, MTRand & a_TickRandom);
- void TickMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, int a_BlockIdx, BLOCKTYPE a_BlockType, MTRand & a_TickRandom);
- void TickFarmland (int a_RelX, int a_RelY, int a_RelZ);
+ void TickBlocks (MTRand & a_TickRandom);
+ void TickGrass (int a_RelX, int a_RelY, int a_RelZ, MTRand & a_TickRandom);
+ void TickFarmland(int a_RelX, int a_RelY, int a_RelZ);
/// Grows sugarcane by the specified number of blocks, but no more than 3 blocks high (used by both bonemeal and ticking)
void GrowSugarcane (int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks);
diff --git a/source/ChunkMap.h b/source/ChunkMap.h
index 87873cac2..165e41f10 100644
--- a/source/ChunkMap.h
+++ b/source/ChunkMap.h
@@ -222,10 +222,10 @@ public:
/// Grows a melon or a pumpkin next to the block specified (assumed to be the stem)
void GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, MTRand & a_Rand);
- /// Grows a sugarcane present at the block specified by the amount of blocks specified, up to the max height of 3
+ /// Grows a sugarcane present at the block specified by the amount of blocks specified, up to the max height specified in the config
void GrowSugarcane(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow);
- /// Grows a cactus present at the block specified by the amount of blocks specified, up to the max height of 3
+ /// Grows a cactus present at the block specified by the amount of blocks specified, up to the max height specified in the config
void GrowCactus(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow);
/// Sets the blockticking to start at the specified block. Only one blocktick per chunk may be set, second call overwrites the first call
diff --git a/source/Defines.h b/source/Defines.h
index e2b5a0501..4c6aef8cd 100644
--- a/source/Defines.h
+++ b/source/Defines.h
@@ -44,14 +44,14 @@ enum
-inline bool IsValidBlock( int a_BlockID ) //tolua_export
+inline bool IsValidBlock( int a_BlockType ) //tolua_export
{ //tolua_export
- if( a_BlockID > -1 &&
- a_BlockID <= 126 && //items to 109 are valid for Beta1.8.1.. 1.2.5 is up to 126
- //a_BlockID != 29 && allow pistons
- //a_BlockID != 33 && allow pistons
- a_BlockID != 34 &&
- a_BlockID != 36 )
+ if( a_BlockType > -1 &&
+ a_BlockType <= 126 && //items to 109 are valid for Beta1.8.1.. 1.2.5 is up to 126
+ //a_BlockType != 29 && allow pistons
+ //a_BlockType != 33 && allow pistons
+ a_BlockType != 34 &&
+ a_BlockType != 36 )
{
return true;
}
@@ -82,29 +82,29 @@ inline bool IsValidItem( int a_ItemID ) //tolua_export
-inline bool IsBlockWater(BLOCKTYPE a_BlockID)
+inline bool IsBlockWater(BLOCKTYPE a_BlockType)
{
- return (a_BlockID == E_BLOCK_WATER || a_BlockID == E_BLOCK_STATIONARY_WATER);
+ return (a_BlockType == E_BLOCK_WATER || a_BlockType == E_BLOCK_STATIONARY_WATER);
}
-inline bool IsBlockLava(BLOCKTYPE a_BlockID)
+inline bool IsBlockLava(BLOCKTYPE a_BlockType)
{
- return (a_BlockID == E_BLOCK_LAVA || a_BlockID == E_BLOCK_STATIONARY_LAVA);
+ return (a_BlockType == E_BLOCK_LAVA || a_BlockType == E_BLOCK_STATIONARY_LAVA);
}
-inline bool IsBlockLiquid(BLOCKTYPE a_BlockID)
+inline bool IsBlockLiquid(BLOCKTYPE a_BlockType)
{
- return IsBlockWater(a_BlockID) || IsBlockLava(a_BlockID);
+ return IsBlockWater(a_BlockType) || IsBlockLava(a_BlockType);
}
-inline bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockID)
+inline bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockType)
{
- switch (a_BlockID)
+ switch (a_BlockType)
{
case E_BLOCK_DIRT:
case E_BLOCK_GRASS:
@@ -342,10 +342,10 @@ namespace ItemCategory
//tolua_end
-inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockID)
+inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType)
{
- if(!IsValidBlock(a_BlockID)) return false;
- return g_BlockRequiresSpecialTool[a_BlockID];
+ if(!IsValidBlock(a_BlockType)) return false;
+ return g_BlockRequiresSpecialTool[a_BlockType];
}
diff --git a/source/FireSimulator.cpp b/source/FireSimulator.cpp
index 662c4f2d0..1dc104d0c 100644
--- a/source/FireSimulator.cpp
+++ b/source/FireSimulator.cpp
@@ -48,10 +48,10 @@ void cFireSimulator::Simulate( float a_Dt )
}
-bool cFireSimulator::IsAllowedBlock( BLOCKTYPE a_BlockID )
+bool cFireSimulator::IsAllowedBlock( BLOCKTYPE a_BlockType )
{
- return a_BlockID == E_BLOCK_FIRE
- || IsBlockLava(a_BlockID);
+ return a_BlockType == E_BLOCK_FIRE
+ || IsBlockLava(a_BlockType);
}
void cFireSimulator::AddBlock(int a_X, int a_Y, int a_Z)
@@ -78,26 +78,26 @@ void cFireSimulator::_AddBlock(int a_X, int a_Y, int a_Z)
}
-bool cFireSimulator::IsForeverBurnable( BLOCKTYPE a_BlockID )
+bool cFireSimulator::IsForeverBurnable( BLOCKTYPE a_BlockType )
{
- return a_BlockID == E_BLOCK_BLOODSTONE;
+ return a_BlockType == E_BLOCK_BLOODSTONE;
}
-bool cFireSimulator::IsBurnable( BLOCKTYPE a_BlockID )
+bool cFireSimulator::IsBurnable( BLOCKTYPE a_BlockType )
{
- return a_BlockID == E_BLOCK_PLANKS
- || a_BlockID == E_BLOCK_LEAVES
- || a_BlockID == E_BLOCK_LOG
- || a_BlockID == E_BLOCK_WOOL
- || a_BlockID == E_BLOCK_BOOKCASE
- || a_BlockID == E_BLOCK_FENCE
- || a_BlockID == E_BLOCK_TNT
- || a_BlockID == E_BLOCK_VINES;
+ return a_BlockType == E_BLOCK_PLANKS
+ || a_BlockType == E_BLOCK_LEAVES
+ || a_BlockType == E_BLOCK_LOG
+ || a_BlockType == E_BLOCK_WOOL
+ || a_BlockType == E_BLOCK_BOOKCASE
+ || a_BlockType == E_BLOCK_FENCE
+ || a_BlockType == E_BLOCK_TNT
+ || a_BlockType == E_BLOCK_VINES;
}
-bool cFireSimulator::FiresForever( BLOCKTYPE a_BlockID )
+bool cFireSimulator::FiresForever( BLOCKTYPE a_BlockType )
{
- return a_BlockID != E_BLOCK_FIRE;
+ return a_BlockType != E_BLOCK_FIRE;
}
bool cFireSimulator::BurnBlockAround(int a_X, int a_Y, int a_Z)
diff --git a/source/FireSimulator.h b/source/FireSimulator.h
index f879585ab..90e6a6062 100644
--- a/source/FireSimulator.h
+++ b/source/FireSimulator.h
@@ -23,11 +23,11 @@ public:
virtual void Simulate( float a_Dt ) override;
- virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override;
+ virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override;
- virtual bool IsBurnable( BLOCKTYPE a_BlockID );
- virtual bool IsForeverBurnable( BLOCKTYPE a_BlockID );
- virtual bool FiresForever( BLOCKTYPE a_BlockID );
+ virtual bool IsBurnable( BLOCKTYPE a_BlockType );
+ virtual bool IsForeverBurnable( BLOCKTYPE a_BlockType );
+ virtual bool FiresForever( BLOCKTYPE a_BlockType );
protected:
virtual void AddBlock(int a_X, int a_Y, int a_Z) override;
diff --git a/source/FluidSimulator.cpp b/source/FluidSimulator.cpp
index 40fc1e606..8a6a760f3 100644
--- a/source/FluidSimulator.cpp
+++ b/source/FluidSimulator.cpp
@@ -436,30 +436,30 @@ void cFluidSimulator::Simulate( float a_Dt )
-bool cFluidSimulator::IsPassableForFluid(BLOCKTYPE a_BlockID)
+bool cFluidSimulator::IsPassableForFluid(BLOCKTYPE a_BlockType)
{
- return a_BlockID == E_BLOCK_AIR
- || a_BlockID == E_BLOCK_FIRE
- || IsAllowedBlock(a_BlockID)
- || CanWashAway(a_BlockID);
+ return a_BlockType == E_BLOCK_AIR
+ || a_BlockType == E_BLOCK_FIRE
+ || IsAllowedBlock(a_BlockType)
+ || CanWashAway(a_BlockType);
}
-bool cFluidSimulator::IsStationaryBlock (BLOCKTYPE a_BlockID)
+bool cFluidSimulator::IsStationaryBlock (BLOCKTYPE a_BlockType)
{
- return a_BlockID == m_StationaryFluidBlock;
+ return a_BlockType == m_StationaryFluidBlock;
}
-bool cFluidSimulator::CanWashAway( BLOCKTYPE a_BlockID )
+bool cFluidSimulator::CanWashAway( BLOCKTYPE a_BlockType )
{
- switch( a_BlockID )
+ switch( a_BlockType )
{
case E_BLOCK_YELLOW_FLOWER:
case E_BLOCK_RED_ROSE:
@@ -476,13 +476,13 @@ bool cFluidSimulator::CanWashAway( BLOCKTYPE a_BlockID )
-bool cFluidSimulator::IsSolidBlock( BLOCKTYPE a_BlockID )
+bool cFluidSimulator::IsSolidBlock( BLOCKTYPE a_BlockType )
{
- return !(a_BlockID == E_BLOCK_AIR
- || a_BlockID == E_BLOCK_FIRE
- || IsBlockLava(a_BlockID)
- || IsBlockWater(a_BlockID)
- || CanWashAway(a_BlockID));
+ return !(a_BlockType == E_BLOCK_AIR
+ || a_BlockType == E_BLOCK_FIRE
+ || IsBlockLava(a_BlockType)
+ || IsBlockWater(a_BlockType)
+ || CanWashAway(a_BlockType));
}
diff --git a/source/FluidSimulator.h b/source/FluidSimulator.h
index 20d86b1b8..09d9520ef 100644
--- a/source/FluidSimulator.h
+++ b/source/FluidSimulator.h
@@ -29,11 +29,11 @@ public:
//Gets the flowing direction. if a_Over is true also the block over the current block affects the direction (standard)
Direction GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a_Over = true);
- virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) = 0;
- virtual bool IsStationaryBlock( BLOCKTYPE a_BlockID);
- virtual bool IsPassableForFluid( BLOCKTYPE a_BlockID );
- bool CanWashAway( BLOCKTYPE a_BlockID );
- bool IsSolidBlock(BLOCKTYPE a_BlockID);
+ virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) = 0;
+ virtual bool IsStationaryBlock( BLOCKTYPE a_BlockType);
+ virtual bool IsPassableForFluid( BLOCKTYPE a_BlockType );
+ bool CanWashAway( BLOCKTYPE a_BlockType );
+ bool IsSolidBlock(BLOCKTYPE a_BlockType);
protected:
virtual void AddBlock( int a_X, int a_Y, int a_Z);
char GetHighestLevelAround( int a_X, int a_Y, int a_Z );
diff --git a/source/Items/ItemDye.h b/source/Items/ItemDye.h
index 5b21a501c..16e850719 100644
--- a/source/Items/ItemDye.h
+++ b/source/Items/ItemDye.h
@@ -5,7 +5,12 @@
#include "../World.h"
#include "../Player.h"
-class cItemDyeHandler : public cItemHandler
+
+
+
+
+class cItemDyeHandler :
+ public cItemHandler
{
public:
cItemDyeHandler(int a_ItemID)
@@ -20,7 +25,7 @@ public:
// Handle growing the plants:
if (a_Item->m_ItemHealth == E_META_DYE_WHITE)
{
- if(a_World->GrowPlant(a_X, a_Y, a_Z, true))
+ if (a_World->GrowRipePlant(a_X, a_Y, a_Z, true))
{
if (a_Player->GetGameMode() == eGameMode_Survival)
{
@@ -32,4 +37,8 @@ public:
}
return false;
}
-}; \ No newline at end of file
+} ;
+
+
+
+
diff --git a/source/Items/ItemHandler.cpp b/source/Items/ItemHandler.cpp
index 49ed865e7..44177760a 100644
--- a/source/Items/ItemHandler.cpp
+++ b/source/Items/ItemHandler.cpp
@@ -334,7 +334,7 @@ bool cItemHandler::IsPlaceable()
-bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockID)
+bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType)
{
return false;
}
diff --git a/source/Items/ItemHandler.h b/source/Items/ItemHandler.h
index 67935ecb4..23aa0448d 100644
--- a/source/Items/ItemHandler.h
+++ b/source/Items/ItemHandler.h
@@ -64,7 +64,7 @@ public:
//Returns the block meta on placement
virtual NIBBLETYPE GetBlockMeta(short a_ItemDamage);
// Returns whether this tool/item can harvest a specific block (e.g. wooden pickaxe can harvest stone, but wood canīt) DEFAULT: False
- virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID);
+ virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType);
static cItemHandler *GetItemHandler(int a_ItemID);
diff --git a/source/Items/ItemPickaxe.h b/source/Items/ItemPickaxe.h
index 158aca44f..68a55470a 100644
--- a/source/Items/ItemPickaxe.h
+++ b/source/Items/ItemPickaxe.h
@@ -32,9 +32,9 @@ public:
}
}
- virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
+ virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
{
- switch(a_BlockID)
+ switch(a_BlockType)
{
case E_BLOCK_OBSIDIAN:
return PickaxeLevel() >= 4;
diff --git a/source/Items/ItemShears.h b/source/Items/ItemShears.h
index 2f3476735..7e2ad61fe 100644
--- a/source/Items/ItemShears.h
+++ b/source/Items/ItemShears.h
@@ -34,9 +34,9 @@ public:
}
- virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
+ virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
{
- return a_BlockID == E_BLOCK_COBWEB
- || a_BlockID == E_BLOCK_VINES;
+ return a_BlockType == E_BLOCK_COBWEB
+ || a_BlockType == E_BLOCK_VINES;
}
}; \ No newline at end of file
diff --git a/source/Items/ItemShovel.h b/source/Items/ItemShovel.h
index f5a65795a..f07820f8f 100644
--- a/source/Items/ItemShovel.h
+++ b/source/Items/ItemShovel.h
@@ -34,8 +34,8 @@ public:
return false;
}
- virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
+ virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
{
- return a_BlockID == E_BLOCK_SNOW;
+ return a_BlockType == E_BLOCK_SNOW;
}
}; \ No newline at end of file
diff --git a/source/Items/ItemSword.h b/source/Items/ItemSword.h
index eb4aa0ef9..4eec4c5a0 100644
--- a/source/Items/ItemSword.h
+++ b/source/Items/ItemSword.h
@@ -14,8 +14,8 @@ public:
}
- virtual bool CanHarvestBlock(BLOCKTYPE a_BlockID) override
+ virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
{
- return a_BlockID == E_BLOCK_COBWEB;
+ return a_BlockType == E_BLOCK_COBWEB;
}
}; \ No newline at end of file
diff --git a/source/LavaSimulator.cpp b/source/LavaSimulator.cpp
index 4c3636f09..726cc37e4 100644
--- a/source/LavaSimulator.cpp
+++ b/source/LavaSimulator.cpp
@@ -14,7 +14,7 @@ cLavaSimulator::cLavaSimulator(cWorld *a_World)
}
-bool cLavaSimulator::IsAllowedBlock(BLOCKTYPE a_BlockID)
+bool cLavaSimulator::IsAllowedBlock(BLOCKTYPE a_BlockType)
{
- return IsBlockLava(a_BlockID);
+ return IsBlockLava(a_BlockType);
} \ No newline at end of file
diff --git a/source/LavaSimulator.h b/source/LavaSimulator.h
index 43831ca17..d85b335b7 100644
--- a/source/LavaSimulator.h
+++ b/source/LavaSimulator.h
@@ -6,7 +6,7 @@ class cLavaSimulator : public cFluidSimulator
public:
cLavaSimulator( cWorld* a_World );
- virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override;
+ virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override;
}; \ No newline at end of file
diff --git a/source/LuaChunk.h b/source/LuaChunk.h
index dc6f2a0f2..c7fa071eb 100644
--- a/source/LuaChunk.h
+++ b/source/LuaChunk.h
@@ -30,16 +30,16 @@ public:
//tolua_begin
// Block functions
- void FillBlocks( char a_BlockID, unsigned char a_BlockMeta )
+ void FillBlocks( char a_BlockType, unsigned char a_BlockMeta )
{
const NIBBLETYPE CompressedMeta = a_BlockMeta | a_BlockMeta << 4;
- memset( m_BlockTypes, a_BlockID, sizeof( cChunkDef::BlockTypes ) );
+ memset( m_BlockTypes, a_BlockType, sizeof( cChunkDef::BlockTypes ) );
memset( m_BlockMeta, CompressedMeta, sizeof( cChunkDef::BlockNibbles ) );
}
- void SetBlock( int a_X, int a_Y, int a_Z, char a_BlockID, unsigned char a_BlockMeta )
+ void SetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, unsigned char a_BlockMeta )
{
- cChunkDef::SetBlock( m_BlockTypes, a_X, a_Y, a_Z, a_BlockID );
+ cChunkDef::SetBlock( m_BlockTypes, a_X, a_Y, a_Z, a_BlockType );
cChunkDef::SetNibble( m_BlockMeta, a_X, a_Y, a_Z, a_BlockMeta );
}
diff --git a/source/RedstoneSimulator.h b/source/RedstoneSimulator.h
index 13f716cec..2235e200b 100644
--- a/source/RedstoneSimulator.h
+++ b/source/RedstoneSimulator.h
@@ -11,7 +11,7 @@ public:
~cRedstoneSimulator();
virtual void Simulate( float a_Dt ) override;
- virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override { return true; }
+ virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override { return true; }
virtual void WakeUp( int a_X, int a_Y, int a_Z ) override;
diff --git a/source/SandSimulator.cpp b/source/SandSimulator.cpp
index f8cfdad37..a2e1dc4cb 100644
--- a/source/SandSimulator.cpp
+++ b/source/SandSimulator.cpp
@@ -61,10 +61,10 @@ void cSandSimulator::Simulate( float a_Dt )
-bool cSandSimulator::IsAllowedBlock( BLOCKTYPE a_BlockID )
+bool cSandSimulator::IsAllowedBlock( BLOCKTYPE a_BlockType )
{
- return a_BlockID == E_BLOCK_SAND
- || a_BlockID == E_BLOCK_GRAVEL;
+ return a_BlockType == E_BLOCK_SAND
+ || a_BlockType == E_BLOCK_GRAVEL;
}
@@ -93,10 +93,10 @@ void cSandSimulator::AddBlock(int a_X, int a_Y, int a_Z)
-bool cSandSimulator::IsPassable( BLOCKTYPE a_BlockID )
+bool cSandSimulator::IsPassable( BLOCKTYPE a_BlockType )
{
- return a_BlockID == E_BLOCK_AIR
- || IsBlockWater(a_BlockID)
- || IsBlockLava(a_BlockID)
- || a_BlockID == E_BLOCK_FIRE;
+ return a_BlockType == E_BLOCK_AIR
+ || IsBlockWater(a_BlockType)
+ || IsBlockLava(a_BlockType)
+ || a_BlockType == E_BLOCK_FIRE;
}
diff --git a/source/SandSimulator.h b/source/SandSimulator.h
index 37db2d40f..ff39d62b2 100644
--- a/source/SandSimulator.h
+++ b/source/SandSimulator.h
@@ -23,8 +23,8 @@ public:
virtual void Simulate( float a_Dt ) override;
- virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override;
- virtual bool IsPassable( BLOCKTYPE a_BlockID );
+ virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override;
+ virtual bool IsPassable( BLOCKTYPE a_BlockType );
protected:
virtual void AddBlock(int a_X, int a_Y, int a_Z) override;
diff --git a/source/Simulator.h b/source/Simulator.h
index af823b00b..00e1b5a0c 100644
--- a/source/Simulator.h
+++ b/source/Simulator.h
@@ -11,7 +11,7 @@ public:
virtual void Simulate( float a_Dt ) = 0;
virtual void WakeUp( int a_X, int a_Y, int a_Z );
- virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) = 0;
+ virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) = 0;
protected:
virtual void AddBlock(int a_X, int a_Y, int a_Z) = 0;
diff --git a/source/WaterSimulator.cpp b/source/WaterSimulator.cpp
index 66acaea6a..c63135419 100644
--- a/source/WaterSimulator.cpp
+++ b/source/WaterSimulator.cpp
@@ -15,8 +15,8 @@ cWaterSimulator::cWaterSimulator(cWorld *a_World)
}
-bool cWaterSimulator::IsAllowedBlock(BLOCKTYPE a_BlockID)
+bool cWaterSimulator::IsAllowedBlock(BLOCKTYPE a_BlockType)
{
- return IsBlockWater(a_BlockID);
+ return IsBlockWater(a_BlockType);
}
diff --git a/source/WaterSimulator.h b/source/WaterSimulator.h
index 04a208368..4bc35b8f7 100644
--- a/source/WaterSimulator.h
+++ b/source/WaterSimulator.h
@@ -6,6 +6,6 @@ class cWaterSimulator : public cFluidSimulator
public:
cWaterSimulator( cWorld* a_World );
- virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override;
+ virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override;
}; \ No newline at end of file
diff --git a/source/World.cpp b/source/World.cpp
index 8bb14eb53..3a4cf789e 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -860,7 +860,7 @@ void cWorld::GrowTreeImage(const sSetBlockVector & a_Blocks)
-bool cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal)
+bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal)
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
@@ -966,7 +966,7 @@ bool cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBone
SpawnMeta = E_META_TALL_GRASS_GRASS;
break;
}
- } // switch (random spawn block)
+ } // switch (random spawn block type)
FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, SpawnType, SpawnMeta);
} // for i - 50 times
return true;
@@ -999,6 +999,15 @@ bool cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBone
+void cWorld::GrowCactus(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow)
+{
+ m_ChunkMap->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow);
+}
+
+
+
+
+
void cWorld::GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockType)
{
MTRand Rand;
@@ -1009,6 +1018,15 @@ void cWorld::GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, char a_B
+void cWorld::GrowSugarcane(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow)
+{
+ m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow);
+}
+
+
+
+
+
int cWorld::GetBiomeAt (int a_BlockX, int a_BlockZ)
{
return m_ChunkMap->GetBiomeAt(a_BlockX, a_BlockZ);
diff --git a/source/World.h b/source/World.h
index 302461495..16c80bd82 100644
--- a/source/World.h
+++ b/source/World.h
@@ -300,11 +300,17 @@ public:
void GrowTreeImage(const sSetBlockVector & a_Blocks);
/// Grows the plant at the specified block to its ripe stage (bonemeal used); returns false if the block is not growable. If a_IsBonemeal is true, block is not grown if not allowed in world.ini
- bool GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal = false); // tolua_export
+ bool GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal = false); // tolua_export
+ /// Grows a cactus present at the block specified by the amount of blocks specified, up to the max height specified in the config
+ void GrowCactus(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow); // tolua_export
+
/// Grows a melon or a pumpkin next to the block specified (assumed to be the stem)
void GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockType); // tolua_export
+ /// Grows a sugarcane present at the block specified by the amount of blocks specified, up to the max height specified in the config
+ void GrowSugarcane(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow); // tolua_export
+
int GetBiomeAt (int a_BlockX, int a_BlockZ); // tolua_export
const AString & GetName(void) const { return m_WorldName; } //tolua_export