Changed pointers to references
This commit is contained in:
parent
fec17409d2
commit
c6304b2b4f
@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
void cBlockBedHandler::OnPlacedByPlayer(
|
||||
cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||
@ -15,7 +15,7 @@ void cBlockBedHandler::OnPlacedByPlayer(
|
||||
if (a_BlockMeta < 8)
|
||||
{
|
||||
Vector3i Direction = MetaDataToDirection(a_BlockMeta);
|
||||
a_ChunkInterface->SetBlock(a_WorldInterface,a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z, E_BLOCK_BED, a_BlockMeta | 0x8);
|
||||
a_ChunkInterface.SetBlock(a_WorldInterface,a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z, E_BLOCK_BED, a_BlockMeta | 0x8);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,26 +23,26 @@ void cBlockBedHandler::OnPlacedByPlayer(
|
||||
|
||||
|
||||
|
||||
void cBlockBedHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cBlockBedHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
NIBBLETYPE OldMeta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
|
||||
Vector3i ThisPos( a_BlockX, a_BlockY, a_BlockZ );
|
||||
Vector3i Direction = MetaDataToDirection( OldMeta & 0x7 );
|
||||
if (OldMeta & 0x8)
|
||||
{
|
||||
// Was pillow
|
||||
if (a_ChunkInterface->GetBlock(ThisPos - Direction) == E_BLOCK_BED)
|
||||
if (a_ChunkInterface.GetBlock(ThisPos - Direction) == E_BLOCK_BED)
|
||||
{
|
||||
a_ChunkInterface->FastSetBlock(ThisPos - Direction, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(ThisPos - Direction, E_BLOCK_AIR, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Was foot end
|
||||
if (a_ChunkInterface->GetBlock(ThisPos + Direction) == E_BLOCK_BED)
|
||||
if (a_ChunkInterface.GetBlock(ThisPos + Direction) == E_BLOCK_BED)
|
||||
{
|
||||
a_ChunkInterface->FastSetBlock(ThisPos + Direction, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(ThisPos + Direction, E_BLOCK_AIR, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -51,30 +51,30 @@ void cBlockBedHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInt
|
||||
|
||||
|
||||
|
||||
void cBlockBedHandler::OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
|
||||
void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
|
||||
{
|
||||
if (a_WorldInterface->GetDimension() != dimOverworld)
|
||||
if (a_WorldInterface.GetDimension() != dimOverworld)
|
||||
{
|
||||
Vector3i Coords(a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_WorldInterface->DoExplosionAt(5, a_BlockX, a_BlockY, a_BlockZ, true, esBed, &Coords);
|
||||
a_WorldInterface.DoExplosionAt(5, a_BlockX, a_BlockY, a_BlockZ, true, esBed, &Coords);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a_WorldInterface->GetTimeOfDay() > 13000)
|
||||
if (a_WorldInterface.GetTimeOfDay() > 13000)
|
||||
{
|
||||
NIBBLETYPE Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
if (Meta & 0x8)
|
||||
{
|
||||
// Is pillow
|
||||
a_WorldInterface->GetBroadcastManager()->BroadcastUseBed(*a_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_WorldInterface.GetBroadcastManager().BroadcastUseBed(*a_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Is foot end
|
||||
Vector3i Direction = MetaDataToDirection( Meta & 0x7 );
|
||||
if (a_ChunkInterface->GetBlock(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z) == E_BLOCK_BED) // Must always use pillow location for sleeping
|
||||
if (a_ChunkInterface.GetBlock(a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z) == E_BLOCK_BED) // Must always use pillow location for sleeping
|
||||
{
|
||||
a_WorldInterface->GetBroadcastManager()->BroadcastUseBed(*a_Player, a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z);
|
||||
a_WorldInterface.GetBroadcastManager().BroadcastUseBed(*a_Player, a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -20,9 +20,9 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnPlacedByPlayer(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
|
||||
virtual void OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
|
||||
virtual void OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
|
@ -16,16 +16,16 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
// Set p the ON bit to on
|
||||
NIBBLETYPE Meta = (a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x08);
|
||||
NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) | 0x08);
|
||||
|
||||
a_ChunkInterface->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
||||
a_WorldInterface->GetBroadcastManager()->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
||||
a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
|
||||
|
||||
// Queue a button reset (unpress)
|
||||
a_ChunkInterface->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), m_BlockType == E_BLOCK_STONE_BUTTON ? 20 : 30, m_BlockType, a_WorldInterface);
|
||||
a_ChunkInterface.QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x07), m_BlockType == E_BLOCK_STONE_BUTTON ? 20 : 30, m_BlockType, a_WorldInterface);
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -93,7 +93,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
NIBBLETYPE Meta;
|
||||
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -49,7 +49,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -37,7 +37,7 @@ public:
|
||||
|
||||
// Check if this forms a doublechest, if so, need to adjust the meta:
|
||||
cBlockArea Area;
|
||||
if (!Area.Read(a_ChunkInterface, a_BlockX - 1, a_BlockX + 1, a_BlockY, a_BlockY, a_BlockZ - 1, a_BlockZ + 1))
|
||||
if (!Area.Read(&a_ChunkInterface, a_BlockX - 1, a_BlockX + 1, a_BlockY, a_BlockY, a_BlockZ - 1, a_BlockZ + 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -66,7 +66,7 @@ public:
|
||||
|
||||
|
||||
virtual void OnPlacedByPlayer(
|
||||
cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||
@ -74,7 +74,7 @@ public:
|
||||
{
|
||||
// Check if this forms a doublechest, if so, need to adjust the meta:
|
||||
cBlockArea Area;
|
||||
if (!Area.Read(a_ChunkInterface, a_BlockX - 1, a_BlockX + 1, a_BlockY, a_BlockY, a_BlockZ - 1, a_BlockZ + 1))
|
||||
if (!Area.Read(&a_ChunkInterface, a_BlockX - 1, a_BlockX + 1, a_BlockY, a_BlockY, a_BlockZ - 1, a_BlockZ + 1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -110,16 +110,16 @@ public:
|
||||
return "step.wood";
|
||||
}
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return CanBeAt(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
cBlockArea Area;
|
||||
if (!Area.Read(a_ChunkInterface, a_BlockX - 2, a_BlockX + 2, a_BlockY, a_BlockY, a_BlockZ - 2, a_BlockZ + 2))
|
||||
if (!Area.Read(&a_ChunkInterface, a_BlockX - 2, a_BlockX + 2, a_BlockY, a_BlockY, a_BlockZ - 2, a_BlockZ + 2))
|
||||
{
|
||||
// Cannot read the surroundings, probably at the edge of loaded chunks. Disallow.
|
||||
return false;
|
||||
@ -211,13 +211,13 @@ public:
|
||||
|
||||
|
||||
/// If there's a chest in the a_Area in the specified coords, modifies its meta to a_NewMeta and returns true.
|
||||
bool CheckAndAdjustNeighbor(cChunkInterface * a_ChunkInterface, const cBlockArea & a_Area, int a_RelX, int a_RelZ, NIBBLETYPE a_NewMeta)
|
||||
bool CheckAndAdjustNeighbor(cChunkInterface & a_ChunkInterface, const cBlockArea & a_Area, int a_RelX, int a_RelZ, NIBBLETYPE a_NewMeta)
|
||||
{
|
||||
if (a_Area.GetRelBlockType(a_RelX, 0, a_RelZ) != E_BLOCK_CHEST)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
a_ChunkInterface->SetBlockMeta(a_Area.GetOriginX() + a_RelX, a_Area.GetOriginY(), a_Area.GetOriginZ() + a_RelZ, a_NewMeta);
|
||||
a_ChunkInterface.SetBlockMeta(a_Area.GetOriginX() + a_RelX, a_Area.GetOriginY(), a_Area.GetOriginZ() + a_RelZ, a_NewMeta);
|
||||
return true;
|
||||
}
|
||||
} ;
|
||||
|
@ -18,11 +18,11 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
Meta ^= 0x04; // Toggle 3rd (addition/subtraction) bit with XOR
|
||||
a_ChunkInterface->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
||||
}
|
||||
|
||||
|
||||
@ -39,14 +39,14 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND));
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_SAND);
|
||||
}
|
||||
|
@ -17,24 +17,24 @@ cBlockDoorHandler::cBlockDoorHandler(BLOCKTYPE a_BlockType)
|
||||
|
||||
|
||||
|
||||
void cBlockDoorHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cBlockDoorHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
NIBBLETYPE OldMeta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
|
||||
if (OldMeta & 8)
|
||||
{
|
||||
// Was upper part of door
|
||||
if (IsDoor(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)))
|
||||
if (IsDoor(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)))
|
||||
{
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Was lower part
|
||||
if (IsDoor(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)))
|
||||
if (IsDoor(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)))
|
||||
{
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -43,9 +43,9 @@ void cBlockDoorHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldIn
|
||||
|
||||
|
||||
|
||||
void cBlockDoorHandler::OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
|
||||
void cBlockDoorHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
|
||||
{
|
||||
if (a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_WOODEN_DOOR)
|
||||
if (a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_WOODEN_DOOR)
|
||||
{
|
||||
ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
@ -56,7 +56,7 @@ void cBlockDoorHandler::OnUse(cChunkInterface * a_ChunkInterface, cWorldInterfac
|
||||
|
||||
|
||||
void cBlockDoorHandler::OnPlacedByPlayer(
|
||||
cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||
@ -64,15 +64,15 @@ void cBlockDoorHandler::OnPlacedByPlayer(
|
||||
{
|
||||
NIBBLETYPE a_TopBlockMeta = 8;
|
||||
if (
|
||||
((a_BlockMeta == 0) && (a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) == m_BlockType)) ||
|
||||
((a_BlockMeta == 1) && (a_ChunkInterface->GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) == m_BlockType)) ||
|
||||
((a_BlockMeta == 2) && (a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) == m_BlockType)) ||
|
||||
((a_BlockMeta == 3) && (a_ChunkInterface->GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) == m_BlockType))
|
||||
((a_BlockMeta == 0) && (a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) == m_BlockType)) ||
|
||||
((a_BlockMeta == 1) && (a_ChunkInterface.GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) == m_BlockType)) ||
|
||||
((a_BlockMeta == 2) && (a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) == m_BlockType)) ||
|
||||
((a_BlockMeta == 3) && (a_ChunkInterface.GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) == m_BlockType))
|
||||
)
|
||||
{
|
||||
a_TopBlockMeta = 9;
|
||||
}
|
||||
a_ChunkInterface->SetBlock(a_WorldInterface, a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_TopBlockMeta);
|
||||
a_ChunkInterface.SetBlock(a_WorldInterface, a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_TopBlockMeta);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,13 +14,13 @@ class cBlockDoorHandler :
|
||||
public:
|
||||
cBlockDoorHandler(BLOCKTYPE a_BlockType);
|
||||
|
||||
virtual void OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
|
||||
virtual const char * GetStepSound(void) override;
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -33,8 +33,8 @@ public:
|
||||
}
|
||||
|
||||
if (
|
||||
!CanReplaceBlock(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ)) ||
|
||||
!CanReplaceBlock(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ))
|
||||
!CanReplaceBlock(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ)) ||
|
||||
!CanReplaceBlock(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ))
|
||||
)
|
||||
{
|
||||
return false;
|
||||
@ -53,7 +53,7 @@ public:
|
||||
|
||||
|
||||
virtual void OnPlacedByPlayer(
|
||||
cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||
@ -66,7 +66,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
|
||||
}
|
||||
@ -136,32 +136,32 @@ public:
|
||||
|
||||
|
||||
/// Changes the door at the specified coords from open to close or vice versa
|
||||
static void ChangeDoor(cChunkInterface * a_ChunkInterface, int a_X, int a_Y, int a_Z)
|
||||
static void ChangeDoor(cChunkInterface & a_ChunkInterface, int a_X, int a_Y, int a_Z)
|
||||
{
|
||||
NIBBLETYPE OldMetaData = a_ChunkInterface->GetBlockMeta(a_X, a_Y, a_Z);
|
||||
NIBBLETYPE OldMetaData = a_ChunkInterface.GetBlockMeta(a_X, a_Y, a_Z);
|
||||
|
||||
a_ChunkInterface->SetBlockMeta(a_X, a_Y, a_Z, ChangeStateMetaData(OldMetaData));
|
||||
a_ChunkInterface.SetBlockMeta(a_X, a_Y, a_Z, ChangeStateMetaData(OldMetaData));
|
||||
|
||||
if (OldMetaData & 8)
|
||||
{
|
||||
// Current block is top of the door
|
||||
BLOCKTYPE BottomBlock = a_ChunkInterface->GetBlock(a_X, a_Y - 1, a_Z);
|
||||
NIBBLETYPE BottomMeta = a_ChunkInterface->GetBlockMeta(a_X, a_Y - 1, a_Z);
|
||||
BLOCKTYPE BottomBlock = a_ChunkInterface.GetBlock(a_X, a_Y - 1, a_Z);
|
||||
NIBBLETYPE BottomMeta = a_ChunkInterface.GetBlockMeta(a_X, a_Y - 1, a_Z);
|
||||
|
||||
if (IsDoor(BottomBlock) && !(BottomMeta & 8))
|
||||
{
|
||||
a_ChunkInterface->SetBlockMeta(a_X, a_Y - 1, a_Z, ChangeStateMetaData(BottomMeta));
|
||||
a_ChunkInterface.SetBlockMeta(a_X, a_Y - 1, a_Z, ChangeStateMetaData(BottomMeta));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Current block is bottom of the door
|
||||
BLOCKTYPE TopBlock = a_ChunkInterface->GetBlock(a_X, a_Y + 1, a_Z);
|
||||
NIBBLETYPE TopMeta = a_ChunkInterface->GetBlockMeta(a_X, a_Y + 1, a_Z);
|
||||
BLOCKTYPE TopBlock = a_ChunkInterface.GetBlock(a_X, a_Y + 1, a_Z);
|
||||
NIBBLETYPE TopMeta = a_ChunkInterface.GetBlockMeta(a_X, a_Y + 1, a_Z);
|
||||
|
||||
if (IsDoor(TopBlock) && (TopMeta & 8))
|
||||
{
|
||||
a_ChunkInterface->SetBlockMeta(a_X, a_Y + 1, a_Z, ChangeStateMetaData(TopMeta));
|
||||
a_ChunkInterface.SetBlockMeta(a_X, a_Y + 1, a_Z, ChangeStateMetaData(TopMeta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
}
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -15,9 +15,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
a_ChunkInterface->UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_ChunkInterface.UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
virtual bool IsUseable() override
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -30,20 +30,20 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
NIBBLETYPE OldMetaData = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE OldMetaData = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetYaw());
|
||||
OldMetaData ^= 4; // Toggle the gate
|
||||
if ((OldMetaData & 1) == (NewMetaData & 1))
|
||||
{
|
||||
// Standing in front of the gate - apply new direction
|
||||
a_ChunkInterface->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, (OldMetaData & 4) | (NewMetaData & 3));
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, (OldMetaData & 4) | (NewMetaData & 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Standing aside - use last direction
|
||||
a_ChunkInterface->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, OldMetaData);
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, OldMetaData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
/// Portal boundary and direction variables
|
||||
int XZP, XZM, Dir; // For wont of a better name...
|
||||
|
||||
virtual void OnPlaced(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
|
||||
virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
/*
|
||||
PORTAL FINDING ALGORITH
|
||||
@ -60,9 +60,9 @@ public:
|
||||
|
||||
/// Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border
|
||||
/// Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding
|
||||
int FindObsidianCeiling(int X, int Y, int Z, cChunkInterface * a_ChunkInterface, int MaxY = 0)
|
||||
int FindObsidianCeiling(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, int MaxY = 0)
|
||||
{
|
||||
if (a_ChunkInterface->GetBlock(X, Y, Z) != E_BLOCK_OBSIDIAN)
|
||||
if (a_ChunkInterface.GetBlock(X, Y, Z) != E_BLOCK_OBSIDIAN)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -70,7 +70,7 @@ public:
|
||||
|
||||
for (int newY = Y + 1; newY < cChunkDef::Height; newY++)
|
||||
{
|
||||
BLOCKTYPE Block = a_ChunkInterface->GetBlock(X, newY, Z);
|
||||
BLOCKTYPE Block = a_ChunkInterface.GetBlock(X, newY, Z);
|
||||
if ((Block == E_BLOCK_AIR) || (Block == E_BLOCK_FIRE))
|
||||
{
|
||||
continue;
|
||||
@ -97,11 +97,11 @@ public:
|
||||
}
|
||||
|
||||
/// Evaluates if coords have a valid border on top, based on MaxY
|
||||
int EvaluatePortalBorder(int X, int FoundObsidianY, int Z, int MaxY, cChunkInterface * a_ChunkInterface)
|
||||
int EvaluatePortalBorder(int X, int FoundObsidianY, int Z, int MaxY, cChunkInterface & a_ChunkInterface)
|
||||
{
|
||||
for (int checkBorder = FoundObsidianY + 1; checkBorder <= MaxY - 1; checkBorder++) // FoundObsidianY + 1: FoundObsidianY has already been checked in FindObsidianCeiling; MaxY - 1: portal doesn't need corners
|
||||
{
|
||||
if (a_ChunkInterface->GetBlock(X, checkBorder, Z) != E_BLOCK_OBSIDIAN)
|
||||
if (a_ChunkInterface.GetBlock(X, checkBorder, Z) != E_BLOCK_OBSIDIAN)
|
||||
{
|
||||
// Base obsidian, base + 1 obsidian, base + x NOT obsidian -> not complete portal
|
||||
return 0;
|
||||
@ -112,7 +112,7 @@ public:
|
||||
}
|
||||
|
||||
/// Finds entire frame in any direction with the coordinates of a base block and fills hole with nether portal (START HERE)
|
||||
void FindAndSetPortalFrame(int X, int Y, int Z, cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface)
|
||||
void FindAndSetPortalFrame(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface)
|
||||
{
|
||||
int MaxY = FindObsidianCeiling(X, Y, Z, a_ChunkInterface); // Get topmost obsidian block as reference for all other checks
|
||||
int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add/subtract one as we've checked the original already the line above
|
||||
@ -136,11 +136,11 @@ public:
|
||||
{
|
||||
if (Dir == 1)
|
||||
{
|
||||
a_ChunkInterface->SetBlock(a_WorldInterface, Width, Height, Z, E_BLOCK_NETHER_PORTAL, Dir);
|
||||
a_ChunkInterface.SetBlock(a_WorldInterface, Width, Height, Z, E_BLOCK_NETHER_PORTAL, Dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
a_ChunkInterface->SetBlock(a_WorldInterface, X, Height, Width, E_BLOCK_NETHER_PORTAL, Dir);
|
||||
a_ChunkInterface.SetBlock(a_WorldInterface, X, Height, Width, E_BLOCK_NETHER_PORTAL, Dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -150,11 +150,11 @@ public:
|
||||
|
||||
/// Evaluates if coordinates are a portal going XP/XM; returns true if so, and writes boundaries to variable
|
||||
/// Takes coordinates of base block and Y coord of target obsidian ceiling
|
||||
bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface * a_ChunkInterface)
|
||||
bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface & a_ChunkInterface)
|
||||
{
|
||||
Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction)
|
||||
bool FoundFrameXP = false, FoundFrameXM = false;
|
||||
for (; ((a_ChunkInterface->GetBlock(X1, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface->GetBlock(X1, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X1++) // Check XP for obsidian blocks, exempting corners
|
||||
for (; ((a_ChunkInterface.GetBlock(X1, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X1, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X1++) // Check XP for obsidian blocks, exempting corners
|
||||
{
|
||||
int Value = FindObsidianCeiling(X1, Y, Z, a_ChunkInterface, MaxY);
|
||||
int ValueTwo = FindObsidianCeiling(X1, Y + 1, Z, a_ChunkInterface, MaxY); // For corners without obsidian
|
||||
@ -168,7 +168,7 @@ public:
|
||||
return false; // Not valid slice, no portal can be formed
|
||||
}
|
||||
} XZP = X1 - 1; // Set boundary of frame interior, note that for some reason, the loop of X and the loop of Z go to different numbers, hence -1 here and -2 there
|
||||
for (; ((a_ChunkInterface->GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface->GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM)
|
||||
for (; ((a_ChunkInterface.GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM)
|
||||
{
|
||||
int Value = FindObsidianCeiling(X2, Y, Z, a_ChunkInterface, MaxY);
|
||||
int ValueTwo = FindObsidianCeiling(X2, Y + 1, Z, a_ChunkInterface, MaxY);
|
||||
@ -186,11 +186,11 @@ public:
|
||||
}
|
||||
|
||||
/// Evaluates if coords are a portal going ZP/ZM; returns true if so, and writes boundaries to variable
|
||||
bool FindPortalSliceZ(int X, int Y, int Z1, int Z2, int MaxY, cChunkInterface * a_ChunkInterface)
|
||||
bool FindPortalSliceZ(int X, int Y, int Z1, int Z2, int MaxY, cChunkInterface & a_ChunkInterface)
|
||||
{
|
||||
Dir = 2;
|
||||
bool FoundFrameZP = false, FoundFrameZM = false;
|
||||
for (; ((a_ChunkInterface->GetBlock(X, Y, Z1) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface->GetBlock(X, Y + 1, Z1) == E_BLOCK_OBSIDIAN)); Z1++)
|
||||
for (; ((a_ChunkInterface.GetBlock(X, Y, Z1) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X, Y + 1, Z1) == E_BLOCK_OBSIDIAN)); Z1++)
|
||||
{
|
||||
int Value = FindObsidianCeiling(X, Y, Z1, a_ChunkInterface, MaxY);
|
||||
int ValueTwo = FindObsidianCeiling(X, Y + 1, Z1, a_ChunkInterface, MaxY);
|
||||
@ -204,7 +204,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
} XZP = Z1 - 2;
|
||||
for (; ((a_ChunkInterface->GetBlock(X, Y, Z2) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface->GetBlock(X, Y + 1, Z2) == E_BLOCK_OBSIDIAN)); Z2--)
|
||||
for (; ((a_ChunkInterface.GetBlock(X, Y, Z2) == E_BLOCK_OBSIDIAN) || (a_ChunkInterface.GetBlock(X, Y + 1, Z2) == E_BLOCK_OBSIDIAN)); Z2--)
|
||||
{
|
||||
int Value = FindObsidianCeiling(X, Y, Z2, a_ChunkInterface, MaxY);
|
||||
int ValueTwo = FindObsidianCeiling(X, Y + 1, Z2, a_ChunkInterface, MaxY);
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ));
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void Check(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
|
||||
virtual void Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
|
||||
{
|
||||
switch (m_BlockType)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -244,7 +244,7 @@ cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockType)
|
||||
|
||||
|
||||
bool cBlockHandler::GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -268,7 +268,7 @@ void cBlockHandler::OnUpdate(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::OnPlacedByPlayer(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
void cBlockHandler::OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ void cBlockHandler::OnDestroyedByPlayer(cWorld *a_World, cPlayer * a_Player, int
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::OnPlaced(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
void cBlockHandler::OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
// Notify the neighbors
|
||||
NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ);
|
||||
@ -299,7 +299,7 @@ void cBlockHandler::OnPlaced(cChunkInterface * a_ChunkInterface, cWorldInterface
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cBlockHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
// Notify the neighbors
|
||||
NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ);
|
||||
@ -314,11 +314,11 @@ void cBlockHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterf
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::NeighborChanged(cChunkInterface *a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
if ((a_BlockY >= 0) && (a_BlockY < cChunkDef::Height))
|
||||
{
|
||||
GetBlockHandler(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
GetBlockHandler(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,7 +326,7 @@ void cBlockHandler::NeighborChanged(cChunkInterface *a_ChunkInterface, int a_Blo
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::OnNeighborChanged(cChunkInterface *a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cBlockHandler::OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ void cBlockHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_BlockX,
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
|
||||
void cBlockHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
|
||||
{
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ const char * cBlockHandler::GetStepSound()
|
||||
|
||||
|
||||
|
||||
bool cBlockHandler::CanBeAt(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, const cChunk & a_Chunk)
|
||||
bool cBlockHandler::CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, const cChunk & a_Chunk)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -445,7 +445,7 @@ bool cBlockHandler::DoesDropOnUnsuitable(void)
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::Check(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk)
|
||||
void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk)
|
||||
{
|
||||
if (!CanBeAt(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk))
|
||||
{
|
||||
|
@ -33,18 +33,18 @@ public:
|
||||
Called by cItemHandler::GetPlacementBlockTypeMeta() if the item is a block
|
||||
*/
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
);
|
||||
|
||||
/// Called by cWorld::SetBlock() after the block has been set
|
||||
virtual void OnPlaced(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
|
||||
/// Called by cClientHandle::HandlePlaceBlock() after the player has placed a new block. Called after OnPlaced().
|
||||
virtual void OnPlacedByPlayer(
|
||||
cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||
@ -54,19 +54,19 @@ public:
|
||||
virtual void OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
|
||||
/// Called before a block gets destroyed / replaced with air
|
||||
virtual void OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
|
||||
/// Called when a direct neighbor of this block has been changed (The position is the own position, not the neighbor position)
|
||||
virtual void OnNeighborChanged(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
|
||||
/// Notifies all neighbors of the given block about a change
|
||||
static void NeighborChanged(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
static void NeighborChanged(cChunkInterface & a_ChunkInterface, 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_BlockX, int a_BlockY, int a_BlockZ);
|
||||
|
||||
/// Called if the user right clicks the block and the block is useable
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
|
||||
|
||||
/// <summary>Called when the item is mined to convert it into pickups. Pickups may specify multiple items. Appends items to a_Pickups, preserves its original contents</summary>
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta);
|
||||
@ -78,7 +78,7 @@ public:
|
||||
virtual const char * GetStepSound(void);
|
||||
|
||||
/// Checks if the block can stay at the specified relative coords in the chunk
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk);
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk);
|
||||
|
||||
/** Checks if the block can be placed at this point.
|
||||
Default: CanBeAt(...)
|
||||
@ -113,7 +113,7 @@ public:
|
||||
By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()),
|
||||
and wakes up all simulators on the block.
|
||||
*/
|
||||
virtual void Check(cChunkInterface * ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk);
|
||||
virtual void Check(cChunkInterface & ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk);
|
||||
|
||||
/// <summary>Rotates a given block meta counter-clockwise. Default: no change</summary>
|
||||
/// <returns>Block meta following rotation</returns>
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -24,10 +24,10 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, 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_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_WATER, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_WATER, 0);
|
||||
// This is called later than the real destroying of this ice block
|
||||
}
|
||||
} ;
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
|
||||
/// Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure
|
||||
static char FindSuitableBlockFace(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
static char FindSuitableBlockFace(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
for (int Face = 2; Face <= 5; Face++)
|
||||
{
|
||||
@ -81,7 +81,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
static bool LadderCanBePlacedAt(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace)
|
||||
static bool LadderCanBePlacedAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace)
|
||||
{
|
||||
if ((a_BlockFace == BLOCK_FACE_BOTTOM) || (a_BlockFace == BLOCK_FACE_TOP))
|
||||
{
|
||||
@ -90,11 +90,11 @@ public:
|
||||
|
||||
AddFaceDirection( a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true);
|
||||
|
||||
return g_BlockIsSolid[a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ)];
|
||||
return g_BlockIsSolid[a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ)];
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface,int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface,int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
// TODO: Use AdjustCoordsByMeta(), then cChunk::UnboundedRelGetBlock() and finally some comparison
|
||||
char BlockFace = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
|
||||
|
@ -53,27 +53,27 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
cBlockHandler::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
|
||||
//0.5% chance of dropping an apple
|
||||
NIBBLETYPE Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE Meta = a_ChunkInterface.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_WorldInterface->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_WorldInterface.SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnNeighborChanged(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_ChunkInterface->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,13 +15,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
// Flip the ON bit on/off using the XOR bitwise operation
|
||||
NIBBLETYPE Meta = (a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08);
|
||||
NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08);
|
||||
|
||||
a_ChunkInterface->SetBlock(a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_LEVER, Meta); // SetMeta doesn't work for unpowering levers, so setblock
|
||||
a_WorldInterface->GetBroadcastManager()->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
|
||||
a_ChunkInterface.SetBlock(a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_LEVER, Meta); // SetMeta doesn't work for unpowering levers, so setblock
|
||||
a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -94,7 +94,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
NIBBLETYPE Meta;
|
||||
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_SOULSAND));
|
||||
}
|
||||
|
@ -33,18 +33,18 @@ cBlockPistonHandler::cBlockPistonHandler(BLOCKTYPE a_BlockType)
|
||||
|
||||
|
||||
|
||||
void cBlockPistonHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cBlockPistonHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
NIBBLETYPE OldMeta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
|
||||
int newX = a_BlockX;
|
||||
int newY = a_BlockY;
|
||||
int newZ = a_BlockZ;
|
||||
AddPistonDir(newX, newY, newZ, OldMeta & ~(8), 1);
|
||||
|
||||
if (a_ChunkInterface->GetBlock(newX, newY, newZ) == E_BLOCK_PISTON_EXTENSION)
|
||||
if (a_ChunkInterface.GetBlock(newX, newY, newZ) == E_BLOCK_PISTON_EXTENSION)
|
||||
{
|
||||
a_ChunkInterface->SetBlock(a_WorldInterface, newX, newY, newZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.SetBlock(a_WorldInterface, newX, newY, newZ, E_BLOCK_AIR, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ void cBlockPistonHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorld
|
||||
|
||||
|
||||
bool cBlockPistonHandler::GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -13,10 +13,10 @@ class cBlockPistonHandler :
|
||||
public:
|
||||
cBlockPistonHandler(BLOCKTYPE a_BlockType);
|
||||
|
||||
virtual void OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
}
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -39,7 +39,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if ((a_RelY - 1 < 0) || (a_RelY + 1 > cChunkDef::Height))
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void OnPlacedByPlayer(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
|
||||
virtual void OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Check whether the pumpkin is a part of a golem or a snowman
|
||||
|
||||
@ -24,16 +24,16 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
BLOCKTYPE BlockY1 = a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ);
|
||||
BLOCKTYPE BlockY2 = a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 2, a_BlockZ);
|
||||
BLOCKTYPE BlockY1 = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ);
|
||||
BLOCKTYPE BlockY2 = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY - 2, a_BlockZ);
|
||||
|
||||
// Check for a snow golem:
|
||||
if ((BlockY1 == E_BLOCK_SNOW_BLOCK) && (BlockY2 == E_BLOCK_SNOW_BLOCK))
|
||||
{
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_WorldInterface->SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtSnowGolem);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_WorldInterface.SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtSnowGolem);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -46,40 +46,40 @@ public:
|
||||
|
||||
// Now check both orientations for hands:
|
||||
if (
|
||||
(a_ChunkInterface->GetBlock(a_BlockX + 1, a_BlockY - 1, a_BlockZ) == E_BLOCK_IRON_BLOCK) &&
|
||||
(a_ChunkInterface->GetBlock(a_BlockX - 1, a_BlockY - 1, a_BlockZ) == E_BLOCK_IRON_BLOCK)
|
||||
(a_ChunkInterface.GetBlock(a_BlockX + 1, a_BlockY - 1, a_BlockZ) == E_BLOCK_IRON_BLOCK) &&
|
||||
(a_ChunkInterface.GetBlock(a_BlockX - 1, a_BlockY - 1, a_BlockZ) == E_BLOCK_IRON_BLOCK)
|
||||
)
|
||||
{
|
||||
// Remove the iron blocks:
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX + 1, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX - 1, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX + 1, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX - 1, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
|
||||
// Spawn the golem:
|
||||
a_WorldInterface->SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtIronGolem);
|
||||
a_WorldInterface.SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtIronGolem);
|
||||
}
|
||||
else if (
|
||||
(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ + 1) == E_BLOCK_IRON_BLOCK) &&
|
||||
(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ - 1) == E_BLOCK_IRON_BLOCK)
|
||||
(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ + 1) == E_BLOCK_IRON_BLOCK) &&
|
||||
(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ - 1) == E_BLOCK_IRON_BLOCK)
|
||||
)
|
||||
{
|
||||
// Remove the iron blocks:
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ + 1, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ - 1, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ + 1, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ - 1, E_BLOCK_AIR, 0);
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||
|
||||
// Spawn the golem:
|
||||
a_WorldInterface->SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtIronGolem);
|
||||
a_WorldInterface.SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtIronGolem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
}
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -42,7 +42,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnPlaced(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
|
||||
virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
super::OnPlaced(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
super::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
|
||||
@ -76,12 +76,12 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnNeighborChanged(cChunkInterface *a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
if (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ) && (Meta != FindMeta(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ)))
|
||||
{
|
||||
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, FindMeta(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ));
|
||||
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, FindMeta(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ));
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
{
|
||||
@ -136,7 +136,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
NIBBLETYPE FindMeta(cChunkInterface *a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
NIBBLETYPE FindMeta(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
NIBBLETYPE Meta = 0;
|
||||
char RailsCnt = 0;
|
||||
@ -211,13 +211,13 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool IsUnstable(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
bool IsUnstable(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
if (!IsBlockRail(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
|
||||
if (!IsBlockRail(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
NIBBLETYPE Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
switch (Meta)
|
||||
{
|
||||
case E_META_RAIL_ZM_ZP:
|
||||
@ -344,31 +344,31 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool IsNotConnected(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Pure = 0)
|
||||
bool IsNotConnected(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Pure = 0)
|
||||
{
|
||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false);
|
||||
NIBBLETYPE Meta;
|
||||
if (!IsBlockRail(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
|
||||
if (!IsBlockRail(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
|
||||
{
|
||||
if (!IsBlockRail(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)) || (a_Pure != E_PURE_UPDOWN))
|
||||
if (!IsBlockRail(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)) || (a_Pure != E_PURE_UPDOWN))
|
||||
{
|
||||
if (!IsBlockRail(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)) || (a_Pure == E_PURE_NONE))
|
||||
if (!IsBlockRail(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)) || (a_Pure == E_PURE_NONE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY - 1, a_BlockZ);
|
||||
Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY - 1, a_BlockZ);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY + 1, a_BlockZ);
|
||||
Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY + 1, a_BlockZ);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
switch (a_BlockFace)
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && g_BlockFullyOccupiesVoxel[a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)]);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -30,9 +30,9 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
a_ChunkInterface->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, ((a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) + 0x04) & 0x0f));
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, ((a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) + 0x04) & 0x0f));
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ));
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
|
||||
|
||||
virtual void OnPlacedByPlayer(
|
||||
cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -47,7 +47,7 @@ public:
|
||||
cItemHandler * ItemHandler = cItemHandler::GetItemHandler(GetDoubleSlabType(Type));
|
||||
|
||||
// Check if the block at the coordinates is a slab. Eligibility for combining has already been processed in ClientHandle
|
||||
if (IsAnySlabType(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
|
||||
if (IsAnySlabType(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
|
||||
{
|
||||
// Call the function in ClientHandle that places a block when the client sends the packet,
|
||||
// so that plugins may interfere with the placement.
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -28,7 +28,7 @@ public:
|
||||
|
||||
BLOCKTYPE BlockBeforePlacement;
|
||||
NIBBLETYPE MetaBeforePlacement;
|
||||
a_ChunkInterface->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockBeforePlacement, MetaBeforePlacement);
|
||||
a_ChunkInterface.GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockBeforePlacement, MetaBeforePlacement);
|
||||
|
||||
if ((BlockBeforePlacement == E_BLOCK_SNOW) && (MetaBeforePlacement < 7))
|
||||
{
|
||||
@ -65,7 +65,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY > 0)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND));
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -39,7 +39,7 @@ public:
|
||||
{
|
||||
// Not top or bottom faces, try to preserve whatever face was clicked
|
||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true);
|
||||
if (!CanBePlacedOn(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ), a_BlockFace))
|
||||
if (!CanBePlacedOn(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ), a_BlockFace))
|
||||
{
|
||||
// Torch couldn't be placed on whatever face was clicked, last ditch resort - find another face
|
||||
a_BlockFace = FindSuitableFace(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
@ -110,12 +110,12 @@ public:
|
||||
|
||||
|
||||
/// Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure
|
||||
static char FindSuitableFace(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
static char FindSuitableFace(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
for (int i = BLOCK_FACE_YM; i <= BLOCK_FACE_XP; i++) // Loop through all directions
|
||||
{
|
||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, i, true);
|
||||
BLOCKTYPE BlockInQuestion = a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
||||
BLOCKTYPE BlockInQuestion = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
||||
|
||||
if ( // If on a block that can only hold a torch if torch is standing on it, return that face
|
||||
((BlockInQuestion == E_BLOCK_GLASS) ||
|
||||
@ -142,7 +142,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
char Face = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
|
||||
|
||||
|
@ -32,16 +32,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
// Flip the ON bit on/off using the XOR bitwise operation
|
||||
NIBBLETYPE Meta = (a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04);
|
||||
NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04);
|
||||
|
||||
a_ChunkInterface->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
||||
}
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -89,7 +89,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
NIBBLETYPE Meta;
|
||||
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
@ -27,7 +27,7 @@ public:
|
||||
// TODO: Disallow placement where the vine doesn't attach to something properly
|
||||
BLOCKTYPE BlockType = 0;
|
||||
NIBBLETYPE BlockMeta;
|
||||
a_ChunkInterface->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||
a_ChunkInterface.GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||
if (BlockType == m_BlockType)
|
||||
{
|
||||
a_BlockMeta = BlockMeta | DirectionToMetaData(a_BlockFace);
|
||||
@ -105,7 +105,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void Check(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
|
||||
void Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
|
||||
{
|
||||
NIBBLETYPE CurMeta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
|
||||
NIBBLETYPE MaxMeta = GetMaxMeta(a_Chunk, a_RelX, a_RelY, a_RelZ);
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
cWindow * Window = new cCraftingWindow(a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_Player->OpenWindow(Window);
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
/** Sets the block at the specified coords to the specified value.
|
||||
Full processing, incl. updating neighbors, is performed.
|
||||
*/
|
||||
void SetBlock(cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
void SetBlock(cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
m_ChunkMap->SetBlock(a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
}
|
||||
@ -39,9 +39,9 @@ public:
|
||||
m_ChunkMap->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, a_MetaData);
|
||||
}
|
||||
|
||||
void QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay, BLOCKTYPE a_PreviousBlockType, cWorldInterface * a_WorldInterface)
|
||||
void QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay, BLOCKTYPE a_PreviousBlockType, cWorldInterface & a_WorldInterface)
|
||||
{
|
||||
m_ChunkMap->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_WorldInterface->GetWorldAge() + a_TickDelay, a_PreviousBlockType);
|
||||
m_ChunkMap->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_WorldInterface.GetWorldAge() + a_TickDelay, a_PreviousBlockType);
|
||||
}
|
||||
|
||||
/** Sets the block at the specified coords to the specified value.
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
|
||||
virtual eDimension GetDimension(void) const = 0;
|
||||
|
||||
virtual cBroadcastInterface * GetBroadcastManager() = 0;
|
||||
virtual cBroadcastInterface & GetBroadcastManager() = 0;
|
||||
|
||||
virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) = 0;
|
||||
|
||||
|
@ -770,7 +770,7 @@ void cChunk::CheckBlocks()
|
||||
Vector3i BlockPos = IndexToCoordinate(index);
|
||||
|
||||
cBlockHandler * Handler = BlockHandler(GetBlock(index));
|
||||
Handler->Check(&ChunkInterface, BlockPos.x, BlockPos.y, BlockPos.z, *this);
|
||||
Handler->Check(ChunkInterface, BlockPos.x, BlockPos.y, BlockPos.z, *this);
|
||||
} // for itr - ToTickBlocks[]
|
||||
}
|
||||
|
||||
|
@ -1233,12 +1233,12 @@ void cChunkMap::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYP
|
||||
|
||||
|
||||
|
||||
void cChunkMap::SetBlock(cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta)
|
||||
void cChunkMap::SetBlock(cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta)
|
||||
{
|
||||
cChunkInterface ChunkInterface(this);
|
||||
if (a_BlockType == E_BLOCK_AIR)
|
||||
{
|
||||
BlockHandler(GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnDestroyed(&ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
BlockHandler(GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnDestroyed(ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
|
||||
@ -1251,7 +1251,7 @@ void cChunkMap::SetBlock(cWorldInterface * a_WorldInterface, int a_BlockX, int a
|
||||
Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta );
|
||||
m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk);
|
||||
}
|
||||
BlockHandler(a_BlockType)->OnPlaced(&ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
BlockHandler(a_BlockType)->OnPlaced(ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
NIBBLETYPE GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
NIBBLETYPE GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockMeta);
|
||||
void SetBlock (cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta);
|
||||
void SetBlock (cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta);
|
||||
void QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta, Int64 a_Tick, BLOCKTYPE a_PreviousBlockType = E_BLOCK_AIR);
|
||||
bool GetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta);
|
||||
bool GetBlockInfo (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight);
|
||||
|
@ -902,9 +902,8 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, c
|
||||
// A plugin doesn't agree with using the block, abort
|
||||
return;
|
||||
}
|
||||
cChunkInterface *ChunkInterface = new cChunkInterface(World->GetChunkMap());
|
||||
BlockHandler->OnUse(ChunkInterface, World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ);
|
||||
delete ChunkInterface;
|
||||
cChunkInterface ChunkInterface(World->GetChunkMap());
|
||||
BlockHandler->OnUse(ChunkInterface, *World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ);
|
||||
PlgMgr->CallHookPlayerUsedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
||||
return;
|
||||
}
|
||||
@ -1065,7 +1064,7 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c
|
||||
m_Player->GetInventory().RemoveOneEquippedItem();
|
||||
}
|
||||
cChunkInterface ChunkInterface(World->GetChunkMap());
|
||||
NewBlock->OnPlacedByPlayer(&ChunkInterface,World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
||||
NewBlock->OnPlacedByPlayer(ChunkInterface,*World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
||||
|
||||
// Step sound with 0.8f pitch is used as block placement sound
|
||||
World->BroadcastSoundEffect(NewBlock->GetStepSound(), a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 1.0f, 0.8f);
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
a_BlockType = (m_ItemType == E_ITEM_WOODEN_DOOR) ? E_BLOCK_WOODEN_DOOR : E_BLOCK_IRON_DOOR;
|
||||
cChunkInterface ChunkInterface(a_World->GetChunkMap());
|
||||
bool Meta = BlockHandler(a_BlockType)->GetPlacementBlockTypeMeta(
|
||||
&ChunkInterface, a_Player,
|
||||
ChunkInterface, a_Player,
|
||||
a_BlockX, a_BlockY, a_BlockZ, a_BlockFace,
|
||||
a_CursorX, a_CursorY, a_CursorZ,
|
||||
a_BlockType, a_BlockMeta
|
||||
|
@ -467,7 +467,7 @@ bool cItemHandler::GetPlacementBlockTypeMeta(
|
||||
cBlockHandler * BlockH = BlockHandler(m_ItemType);
|
||||
cChunkInterface ChunkInterface(a_World->GetChunkMap());
|
||||
return BlockH->GetPlacementBlockTypeMeta(
|
||||
&ChunkInterface, a_Player,
|
||||
ChunkInterface, a_Player,
|
||||
a_BlockX, a_BlockY, a_BlockZ, a_BlockFace,
|
||||
a_CursorX, a_CursorY, a_CursorZ,
|
||||
a_BlockType, a_BlockMeta
|
||||
|
@ -748,7 +748,7 @@ void cRedstoneSimulator::HandleDoor(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
if (!AreCoordsSimulated(a_BlockX, a_BlockY, a_BlockZ, true))
|
||||
{
|
||||
cChunkInterface ChunkInterface(m_World.GetChunkMap());
|
||||
cBlockDoorHandler::ChangeDoor(&ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
cBlockDoorHandler::ChangeDoor(ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
SetPlayerToggleableBlockAsSimulated(a_BlockX, a_BlockY, a_BlockZ, true);
|
||||
}
|
||||
}
|
||||
@ -757,7 +757,7 @@ void cRedstoneSimulator::HandleDoor(int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
if (!AreCoordsSimulated(a_BlockX, a_BlockY, a_BlockZ, false))
|
||||
{
|
||||
cChunkInterface ChunkInterface(m_World.GetChunkMap());
|
||||
cBlockDoorHandler::ChangeDoor(&ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
cBlockDoorHandler::ChangeDoor(ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
SetPlayerToggleableBlockAsSimulated(a_BlockX, a_BlockY, a_BlockZ, false);
|
||||
}
|
||||
}
|
||||
|
@ -1486,7 +1486,7 @@ int cWorld::GetBiomeAt (int a_BlockX, int a_BlockZ)
|
||||
|
||||
void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
m_ChunkMap->SetBlock(this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
m_ChunkMap->SetBlock(*this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
}
|
||||
|
||||
|
||||
@ -1672,9 +1672,8 @@ bool cWorld::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure)
|
||||
bool cWorld::DigBlock(int a_X, int a_Y, int a_Z)
|
||||
{
|
||||
cBlockHandler *Handler = cBlockHandler::GetBlockHandler(GetBlock(a_X, a_Y, a_Z));
|
||||
cChunkInterface *ChunkInterface = new cChunkInterface(GetChunkMap());
|
||||
Handler->OnDestroyed(ChunkInterface, this, a_X, a_Y, a_Z);
|
||||
delete ChunkInterface;
|
||||
cChunkInterface ChunkInterface(GetChunkMap());
|
||||
Handler->OnDestroyed(ChunkInterface, *this, a_X, a_Y, a_Z);
|
||||
return m_ChunkMap->DigBlock(a_X, a_Y, a_Z);
|
||||
}
|
||||
|
||||
|
@ -186,9 +186,9 @@ public:
|
||||
virtual void BroadcastUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ );
|
||||
void BroadcastWeather (eWeather a_Weather, const cClientHandle * a_Exclude = NULL);
|
||||
|
||||
virtual cBroadcastInterface * GetBroadcastManager()
|
||||
virtual cBroadcastInterface & GetBroadcastManager()
|
||||
{
|
||||
return this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** If there is a block entity at the specified coords, sends it to the client specified */
|
||||
|
Loading…
Reference in New Issue
Block a user