Changed signitures of Several BLockHandler Methods
Changed the signitures of the following to use interfaces: GetPlacementBlockTypeMeta OnPlaced OnPlacedByPlayer OnDestroyed OnNeighbourChanged NeighbourChanged OnUse CanBeAt Check
This commit is contained in:
parent
6952b24e88
commit
25ec7750aa
@ -23,7 +23,7 @@ void cBlockBedHandler::OnPlacedByPlayer(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cBlockBedHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, 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);
|
||||||
|
|
||||||
|
@ -21,7 +21,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;
|
||||||
virtual void OnDestroyed(cChunkInterface * a_ChunkInterface, 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 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;
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool CanBeAt(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;
|
NIBBLETYPE Meta;
|
||||||
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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)
|
if (a_RelY <= 0)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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);
|
return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual void OnPlacedByPlayer(
|
virtual void OnPlacedByPlayer(
|
||||||
cChunkInterface * a_ChunkInterface, 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_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||||
@ -110,8 +110,13 @@ public:
|
|||||||
return "step.wood";
|
return "step.wood";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) override
|
|
||||||
|
virtual bool CanBeAt(cChunkInterface * a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
cBlockArea Area;
|
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))
|
||||||
@ -206,7 +211,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/// If there's a chest in the a_Area in the specified coords, modifies its meta to a_NewMeta and returns true.
|
/// 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) override
|
bool CheckAndAdjustNeighbor(cChunkInterface * a_ChunkInterface, const cBlockArea & a_Area, int a_RelX, int a_RelZ, NIBBLETYPE a_NewMeta)
|
||||||
{
|
{
|
||||||
if (a_Area.GetRelBlockType(a_RelX, 0, a_RelZ) != E_BLOCK_CHEST)
|
if (a_Area.GetRelBlockType(a_RelX, 0, a_RelZ) != E_BLOCK_CHEST)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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));
|
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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));
|
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(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);
|
return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_SAND);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "BlockDoor.h"
|
#include "BlockDoor.h"
|
||||||
#include "../Item.h"
|
#include "../Item.h"
|
||||||
#include "../World.h"
|
|
||||||
#include "../Entities/Player.h"
|
#include "../Entities/Player.h"
|
||||||
|
|
||||||
|
|
||||||
@ -18,24 +17,24 @@ cBlockDoorHandler::cBlockDoorHandler(BLOCKTYPE a_BlockType)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cBlockDoorHandler::OnDestroyed(cWorld * a_World, 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_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
NIBBLETYPE OldMeta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
|
||||||
if (OldMeta & 8)
|
if (OldMeta & 8)
|
||||||
{
|
{
|
||||||
// Was upper part of door
|
// Was upper part of door
|
||||||
if (IsDoor(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)))
|
if (IsDoor(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)))
|
||||||
{
|
{
|
||||||
a_World->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
|
else
|
||||||
{
|
{
|
||||||
// Was lower part
|
// Was lower part
|
||||||
if (IsDoor(a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)))
|
if (IsDoor(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)))
|
||||||
{
|
{
|
||||||
a_World->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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,11 +43,11 @@ void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cBlockDoorHandler::OnUse(cWorld * a_World, 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_World->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_World, a_BlockX, a_BlockY, a_BlockZ);
|
ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ void cBlockDoorHandler::OnUse(cWorld * a_World, cWorldInterface * a_WorldInterfa
|
|||||||
|
|
||||||
|
|
||||||
void cBlockDoorHandler::OnPlacedByPlayer(
|
void cBlockDoorHandler::OnPlacedByPlayer(
|
||||||
cWorld * a_World, 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_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||||
@ -65,15 +64,15 @@ void cBlockDoorHandler::OnPlacedByPlayer(
|
|||||||
{
|
{
|
||||||
NIBBLETYPE a_TopBlockMeta = 8;
|
NIBBLETYPE a_TopBlockMeta = 8;
|
||||||
if (
|
if (
|
||||||
((a_BlockMeta == 0) && (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) == m_BlockType)) ||
|
((a_BlockMeta == 0) && (a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) == m_BlockType)) ||
|
||||||
((a_BlockMeta == 1) && (a_World->GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) == m_BlockType)) ||
|
((a_BlockMeta == 1) && (a_ChunkInterface->GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) == m_BlockType)) ||
|
||||||
((a_BlockMeta == 2) && (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) == m_BlockType)) ||
|
((a_BlockMeta == 2) && (a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) == m_BlockType)) ||
|
||||||
((a_BlockMeta == 3) && (a_World->GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) == m_BlockType))
|
((a_BlockMeta == 3) && (a_ChunkInterface->GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) == m_BlockType))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
a_TopBlockMeta = 9;
|
a_TopBlockMeta = 9;
|
||||||
}
|
}
|
||||||
a_World->SetBlock(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "BlockHandler.h"
|
#include "BlockHandler.h"
|
||||||
#include "../World.h"
|
|
||||||
#include "../Entities/Player.h"
|
#include "../Entities/Player.h"
|
||||||
|
|
||||||
|
|
||||||
@ -15,13 +14,13 @@ class cBlockDoorHandler :
|
|||||||
public:
|
public:
|
||||||
cBlockDoorHandler(BLOCKTYPE a_BlockType);
|
cBlockDoorHandler(BLOCKTYPE a_BlockType);
|
||||||
|
|
||||||
virtual void OnDestroyed(cWorld * a_World, 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 void OnUse(cWorld * a_World, 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;
|
||||||
virtual const char * GetStepSound(void) override;
|
virtual const char * GetStepSound(void) override;
|
||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -34,8 +33,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!CanReplaceBlock(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ)) ||
|
!CanReplaceBlock(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ)) ||
|
||||||
!CanReplaceBlock(a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ))
|
!CanReplaceBlock(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -54,7 +53,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual void OnPlacedByPlayer(
|
virtual void OnPlacedByPlayer(
|
||||||
cWorld * a_World, 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_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||||
@ -67,7 +66,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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));
|
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
|
||||||
}
|
}
|
||||||
@ -137,32 +136,32 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/// Changes the door at the specified coords from open to close or vice versa
|
/// Changes the door at the specified coords from open to close or vice versa
|
||||||
static void ChangeDoor(cWorld * a_World, 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_World->GetBlockMeta(a_X, a_Y, a_Z);
|
NIBBLETYPE OldMetaData = a_ChunkInterface->GetBlockMeta(a_X, a_Y, a_Z);
|
||||||
|
|
||||||
a_World->SetBlockMeta(a_X, a_Y, a_Z, ChangeStateMetaData(OldMetaData));
|
a_ChunkInterface->SetBlockMeta(a_X, a_Y, a_Z, ChangeStateMetaData(OldMetaData));
|
||||||
|
|
||||||
if (OldMetaData & 8)
|
if (OldMetaData & 8)
|
||||||
{
|
{
|
||||||
// Current block is top of the door
|
// Current block is top of the door
|
||||||
BLOCKTYPE BottomBlock = a_World->GetBlock(a_X, a_Y - 1, a_Z);
|
BLOCKTYPE BottomBlock = a_ChunkInterface->GetBlock(a_X, a_Y - 1, a_Z);
|
||||||
NIBBLETYPE BottomMeta = a_World->GetBlockMeta(a_X, a_Y - 1, a_Z);
|
NIBBLETYPE BottomMeta = a_ChunkInterface->GetBlockMeta(a_X, a_Y - 1, a_Z);
|
||||||
|
|
||||||
if (IsDoor(BottomBlock) && !(BottomMeta & 8))
|
if (IsDoor(BottomBlock) && !(BottomMeta & 8))
|
||||||
{
|
{
|
||||||
a_World->SetBlockMeta(a_X, a_Y - 1, a_Z, ChangeStateMetaData(BottomMeta));
|
a_ChunkInterface->SetBlockMeta(a_X, a_Y - 1, a_Z, ChangeStateMetaData(BottomMeta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Current block is bottom of the door
|
// Current block is bottom of the door
|
||||||
BLOCKTYPE TopBlock = a_World->GetBlock(a_X, a_Y + 1, a_Z);
|
BLOCKTYPE TopBlock = a_ChunkInterface->GetBlock(a_X, a_Y + 1, a_Z);
|
||||||
NIBBLETYPE TopMeta = a_World->GetBlockMeta(a_X, a_Y + 1, a_Z);
|
NIBBLETYPE TopMeta = a_ChunkInterface->GetBlockMeta(a_X, a_Y + 1, a_Z);
|
||||||
|
|
||||||
if (IsDoor(TopBlock) && (TopMeta & 8))
|
if (IsDoor(TopBlock) && (TopMeta & 8))
|
||||||
{
|
{
|
||||||
a_World->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(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -30,20 +30,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual void OnUse(cWorld * a_World, 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_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
NIBBLETYPE OldMetaData = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetYaw());
|
NIBBLETYPE NewMetaData = PlayerYawToMetaData(a_Player->GetYaw());
|
||||||
OldMetaData ^= 4; // Toggle the gate
|
OldMetaData ^= 4; // Toggle the gate
|
||||||
if ((OldMetaData & 1) == (NewMetaData & 1))
|
if ((OldMetaData & 1) == (NewMetaData & 1))
|
||||||
{
|
{
|
||||||
// Standing in front of the gate - apply new direction
|
// Standing in front of the gate - apply new direction
|
||||||
a_World->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
|
else
|
||||||
{
|
{
|
||||||
// Standing aside - use last direction
|
// Standing aside - use last direction
|
||||||
a_World->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
|
/// Portal boundary and direction variables
|
||||||
int XZP, XZM, Dir; // For wont of a better name...
|
int XZP, XZM, Dir; // For wont of a better name...
|
||||||
|
|
||||||
virtual void OnPlaced(cWorld * a_World, 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
|
PORTAL FINDING ALGORITH
|
||||||
@ -35,7 +35,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
a_BlockY--; // Because we want the block below the fire
|
a_BlockY--; // Because we want the block below the fire
|
||||||
FindAndSetPortalFrame(a_BlockX, a_BlockY, a_BlockZ, a_World); // Brought to you by Aperture Science
|
FindAndSetPortalFrame(a_BlockX, a_BlockY, a_BlockZ, a_ChunkInterface, a_WorldInterface); // Brought to you by Aperture Science
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
virtual void OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||||
@ -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
|
/// 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
|
/// 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, cWorld * a_World, int MaxY = 0)
|
int FindObsidianCeiling(int X, int Y, int Z, cChunkInterface * a_ChunkInterface, int MaxY = 0)
|
||||||
{
|
{
|
||||||
if (a_World->GetBlock(X, Y, Z) != E_BLOCK_OBSIDIAN)
|
if (a_ChunkInterface->GetBlock(X, Y, Z) != E_BLOCK_OBSIDIAN)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
for (int newY = Y + 1; newY < cChunkDef::Height; newY++)
|
for (int newY = Y + 1; newY < cChunkDef::Height; newY++)
|
||||||
{
|
{
|
||||||
BLOCKTYPE Block = a_World->GetBlock(X, newY, Z);
|
BLOCKTYPE Block = a_ChunkInterface->GetBlock(X, newY, Z);
|
||||||
if ((Block == E_BLOCK_AIR) || (Block == E_BLOCK_FIRE))
|
if ((Block == E_BLOCK_AIR) || (Block == E_BLOCK_FIRE))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
// This is because the frame is a solid obsidian pillar
|
// This is because the frame is a solid obsidian pillar
|
||||||
if ((MaxY != 0) && (newY == Y + 1))
|
if ((MaxY != 0) && (newY == Y + 1))
|
||||||
{
|
{
|
||||||
return EvaluatePortalBorder(X, newY, Z, MaxY, a_World);
|
return EvaluatePortalBorder(X, newY, Z, MaxY, a_ChunkInterface);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -97,11 +97,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Evaluates if coords have a valid border on top, based on MaxY
|
/// Evaluates if coords have a valid border on top, based on MaxY
|
||||||
int EvaluatePortalBorder(int X, int FoundObsidianY, int Z, int MaxY, cWorld * a_World)
|
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
|
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_World->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
|
// Base obsidian, base + 1 obsidian, base + x NOT obsidian -> not complete portal
|
||||||
return 0;
|
return 0;
|
||||||
@ -112,9 +112,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Finds entire frame in any direction with the coordinates of a base block and fills hole with nether portal (START HERE)
|
/// 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, cWorld * a_World)
|
void FindAndSetPortalFrame(int X, int Y, int Z, cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface)
|
||||||
{
|
{
|
||||||
int MaxY = FindObsidianCeiling(X, Y, Z, a_World); // Get topmost obsidian block as reference for all other checks
|
int MaxY = FindObsidianCeiling(X, Y, Z, a_ChunkInterface); // Get topmost obsidian block as reference for all other checks
|
||||||
int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add/subtract one as we've checked the original already the line above
|
int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add/subtract one as we've checked the original already the line above
|
||||||
|
|
||||||
if (MaxY == 0) // Oh noes! Not a portal coordinate :(
|
if (MaxY == 0) // Oh noes! Not a portal coordinate :(
|
||||||
@ -122,9 +122,9 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FindPortalSliceX(X1, X2, Y, Z, MaxY, a_World))
|
if (!FindPortalSliceX(X1, X2, Y, Z, MaxY, a_ChunkInterface))
|
||||||
{
|
{
|
||||||
if (!FindPortalSliceZ(X, Y, Z1, Z2, MaxY, a_World))
|
if (!FindPortalSliceZ(X, Y, Z1, Z2, MaxY, a_ChunkInterface))
|
||||||
{
|
{
|
||||||
return; // No eligible portal construct, abort abort abort!!
|
return; // No eligible portal construct, abort abort abort!!
|
||||||
}
|
}
|
||||||
@ -136,11 +136,11 @@ public:
|
|||||||
{
|
{
|
||||||
if (Dir == 1)
|
if (Dir == 1)
|
||||||
{
|
{
|
||||||
a_World->SetBlock(Width, Height, Z, E_BLOCK_NETHER_PORTAL, Dir);
|
a_ChunkInterface->SetBlock(a_WorldInterface, Width, Height, Z, E_BLOCK_NETHER_PORTAL, Dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a_World->SetBlock(X, Height, Width, E_BLOCK_NETHER_PORTAL, Dir);
|
a_ChunkInterface->SetBlock(a_WorldInterface, X, Height, Width, E_BLOCK_NETHER_PORTAL, Dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,14 +150,14 @@ public:
|
|||||||
|
|
||||||
/// Evaluates if coordinates are a portal going XP/XM; returns true if so, and writes boundaries to variable
|
/// 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
|
/// Takes coordinates of base block and Y coord of target obsidian ceiling
|
||||||
bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cWorld * a_World)
|
bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface * a_ChunkInterface)
|
||||||
{
|
{
|
||||||
Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction)
|
Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction)
|
||||||
bool FoundFrameXP = false, FoundFrameXM = false;
|
bool FoundFrameXP = false, FoundFrameXM = false;
|
||||||
for (; ((a_World->GetBlock(X1, Y, Z) == E_BLOCK_OBSIDIAN) || (a_World->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_World, MaxY);
|
int Value = FindObsidianCeiling(X1, Y, Z, a_ChunkInterface, MaxY);
|
||||||
int ValueTwo = FindObsidianCeiling(X1, Y + 1, Z, a_World, MaxY); // For corners without obsidian
|
int ValueTwo = FindObsidianCeiling(X1, Y + 1, Z, a_ChunkInterface, MaxY); // For corners without obsidian
|
||||||
if ((Value == -1) || (ValueTwo == -1)) // FindObsidianCeiling returns -1 upon frame-find
|
if ((Value == -1) || (ValueTwo == -1)) // FindObsidianCeiling returns -1 upon frame-find
|
||||||
{
|
{
|
||||||
FoundFrameXP = true; // Found a frame border in this direction, proceed in other direction (don't go further)
|
FoundFrameXP = true; // Found a frame border in this direction, proceed in other direction (don't go further)
|
||||||
@ -168,10 +168,10 @@ public:
|
|||||||
return false; // Not valid slice, no portal can be formed
|
return false; // Not valid slice, no portal can be formed
|
||||||
}
|
}
|
||||||
} XZP = X1 - 1; // Set boundary of frame interior, note that for some reason, the loop of X and the loop of Z go to different numbers, hence -1 here and -2 there
|
} 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_World->GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_World->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_World, MaxY);
|
int Value = FindObsidianCeiling(X2, Y, Z, a_ChunkInterface, MaxY);
|
||||||
int ValueTwo = FindObsidianCeiling(X2, Y + 1, Z, a_World, MaxY);
|
int ValueTwo = FindObsidianCeiling(X2, Y + 1, Z, a_ChunkInterface, MaxY);
|
||||||
if ((Value == -1) || (ValueTwo == -1))
|
if ((Value == -1) || (ValueTwo == -1))
|
||||||
{
|
{
|
||||||
FoundFrameXM = true;
|
FoundFrameXM = true;
|
||||||
@ -186,14 +186,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Evaluates if coords are a portal going ZP/ZM; returns true if so, and writes boundaries to variable
|
/// 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, cWorld * a_World)
|
bool FindPortalSliceZ(int X, int Y, int Z1, int Z2, int MaxY, cChunkInterface * a_ChunkInterface)
|
||||||
{
|
{
|
||||||
Dir = 2;
|
Dir = 2;
|
||||||
bool FoundFrameZP = false, FoundFrameZM = false;
|
bool FoundFrameZP = false, FoundFrameZM = false;
|
||||||
for (; ((a_World->GetBlock(X, Y, Z1) == E_BLOCK_OBSIDIAN) || (a_World->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_World, MaxY);
|
int Value = FindObsidianCeiling(X, Y, Z1, a_ChunkInterface, MaxY);
|
||||||
int ValueTwo = FindObsidianCeiling(X, Y + 1, Z1, a_World, MaxY);
|
int ValueTwo = FindObsidianCeiling(X, Y + 1, Z1, a_ChunkInterface, MaxY);
|
||||||
if ((Value == -1) || (ValueTwo == -1))
|
if ((Value == -1) || (ValueTwo == -1))
|
||||||
{
|
{
|
||||||
FoundFrameZP = true;
|
FoundFrameZP = true;
|
||||||
@ -204,10 +204,10 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} XZP = Z1 - 2;
|
} XZP = Z1 - 2;
|
||||||
for (; ((a_World->GetBlock(X, Y, Z2) == E_BLOCK_OBSIDIAN) || (a_World->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_World, MaxY);
|
int Value = FindObsidianCeiling(X, Y, Z2, a_ChunkInterface, MaxY);
|
||||||
int ValueTwo = FindObsidianCeiling(X, Y + 1, Z2, a_World, MaxY);
|
int ValueTwo = FindObsidianCeiling(X, Y + 1, Z2, a_ChunkInterface, MaxY);
|
||||||
if ((Value == -1) || (ValueTwo == -1))
|
if ((Value == -1) || (ValueTwo == -1))
|
||||||
{
|
{
|
||||||
FoundFrameZM = true;
|
FoundFrameZM = true;
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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));
|
return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ));
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual void Check(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)
|
switch (m_BlockType)
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super::Check(a_RelX, a_RelY, a_RelZ, a_Chunk);
|
super::Check(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk);
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
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(cWorld * a_World, 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, 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
|
// Notify the neighbors
|
||||||
NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ);
|
NeighborChanged(a_ChunkInterface, a_BlockX - 1, a_BlockY, a_BlockZ);
|
||||||
@ -400,7 +400,7 @@ const char * cBlockHandler::GetStepSound()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cBlockHandler::CanBeAt(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;
|
return true;
|
||||||
}
|
}
|
||||||
@ -445,9 +445,9 @@ bool cBlockHandler::DoesDropOnUnsuitable(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cBlockHandler::Check(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_RelX, a_RelY, a_RelZ, a_Chunk))
|
if (!CanBeAt(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk))
|
||||||
{
|
{
|
||||||
if (DoesDropOnUnsuitable())
|
if (DoesDropOnUnsuitable())
|
||||||
{
|
{
|
||||||
|
@ -40,11 +40,11 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
/// Called by cWorld::SetBlock() after the block has been set
|
/// Called by cWorld::SetBlock() after the block has been set
|
||||||
virtual void OnPlaced(cChunkInterface * a_ChunkInterface, 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().
|
/// Called by cClientHandle::HandlePlaceBlock() after the player has placed a new block. Called after OnPlaced().
|
||||||
virtual void OnPlacedByPlayer(
|
virtual void OnPlacedByPlayer(
|
||||||
cWorld * a_World, 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_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||||
@ -78,7 +78,7 @@ public:
|
|||||||
virtual const char * GetStepSound(void);
|
virtual const char * GetStepSound(void);
|
||||||
|
|
||||||
/// Checks if the block can stay at the specified relative coords in the chunk
|
/// Checks if the block can stay at the specified relative coords in the chunk
|
||||||
virtual bool CanBeAt(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.
|
/** Checks if the block can be placed at this point.
|
||||||
Default: CanBeAt(...)
|
Default: CanBeAt(...)
|
||||||
@ -113,7 +113,7 @@ public:
|
|||||||
By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()),
|
By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()),
|
||||||
and wakes up all simulators on the block.
|
and wakes up all simulators on the block.
|
||||||
*/
|
*/
|
||||||
virtual void Check(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>
|
/// <summary>Rotates a given block meta counter-clockwise. Default: no change</summary>
|
||||||
/// <returns>Block meta following rotation</returns>
|
/// <returns>Block meta following rotation</returns>
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -24,10 +24,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual void OnDestroyed(cWorld * a_World, 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
|
// TODO: Ice destroyed with air below it should turn into air instead of water
|
||||||
a_World->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
|
// This is called later than the real destroying of this ice block
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
@ -19,15 +19,15 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
if (!LadderCanBePlacedAt(a_World, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace))
|
if (!LadderCanBePlacedAt(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace))
|
||||||
{
|
{
|
||||||
a_BlockFace = FindSuitableBlockFace(a_World, a_BlockX, a_BlockY, a_BlockZ);
|
a_BlockFace = FindSuitableBlockFace(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
|
||||||
if (a_BlockFace == BLOCK_FACE_BOTTOM)
|
if (a_BlockFace == BLOCK_FACE_BOTTOM)
|
||||||
{
|
{
|
||||||
@ -68,11 +68,11 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/// Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure
|
/// Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure
|
||||||
static char FindSuitableBlockFace(cWorld * a_World, 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++)
|
for (int Face = 2; Face <= 5; Face++)
|
||||||
{
|
{
|
||||||
if (LadderCanBePlacedAt(a_World, a_BlockX, a_BlockY, a_BlockZ, Face))
|
if (LadderCanBePlacedAt(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, Face))
|
||||||
{
|
{
|
||||||
return Face;
|
return Face;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool LadderCanBePlacedAt(cWorld * a_World, 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))
|
if ((a_BlockFace == BLOCK_FACE_BOTTOM) || (a_BlockFace == BLOCK_FACE_TOP))
|
||||||
{
|
{
|
||||||
@ -90,17 +90,17 @@ public:
|
|||||||
|
|
||||||
AddFaceDirection( a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true);
|
AddFaceDirection( a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true);
|
||||||
|
|
||||||
return g_BlockIsSolid[a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ)];
|
return g_BlockIsSolid[a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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
|
// TODO: Use AdjustCoordsByMeta(), then cChunk::UnboundedRelGetBlock() and finally some comparison
|
||||||
char BlockFace = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
|
char BlockFace = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
|
||||||
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
|
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
|
||||||
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
|
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||||
return LadderCanBePlacedAt(a_Chunk.GetWorld(), BlockX, a_RelY, BlockZ, BlockFace);
|
return LadderCanBePlacedAt(a_ChunkInterface, BlockX, a_RelY, BlockZ, BlockFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,10 +70,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual void OnNeighborChanged(cWorld * a_World, 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_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
NIBBLETYPE Meta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta & 0x7); // Unset 0x8 bit so it gets checked for decay
|
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(cWorld * a_World, 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
|
// Flip the ON bit on/off using the XOR bitwise operation
|
||||||
NIBBLETYPE Meta = (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08);
|
NIBBLETYPE Meta = (a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08);
|
||||||
|
|
||||||
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_LEVER, Meta); // SetMeta doesn't work for unpowering levers, so setblock
|
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_World->BroadcastSoundEffect("random.click", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
|
a_WorldInterface->GetBroadcastManager()->BroadcastSoundEffect("random.click", 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(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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;
|
NIBBLETYPE Meta;
|
||||||
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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)
|
if (a_RelY <= 0)
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool CanBeAt(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));
|
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(cWorld * a_World, 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_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
NIBBLETYPE OldMeta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
|
||||||
int newX = a_BlockX;
|
int newX = a_BlockX;
|
||||||
int newY = a_BlockY;
|
int newY = a_BlockY;
|
||||||
int newZ = a_BlockZ;
|
int newZ = a_BlockZ;
|
||||||
AddPistonDir(newX, newY, newZ, OldMeta & ~(8), 1);
|
AddPistonDir(newX, newY, newZ, OldMeta & ~(8), 1);
|
||||||
|
|
||||||
if (a_World->GetBlock(newX, newY, newZ) == E_BLOCK_PISTON_EXTENSION)
|
if (a_ChunkInterface->GetBlock(newX, newY, newZ) == E_BLOCK_PISTON_EXTENSION)
|
||||||
{
|
{
|
||||||
a_World->SetBlock(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(cWorld * a_World, int a_BlockX, int a_Bloc
|
|||||||
|
|
||||||
|
|
||||||
bool cBlockPistonHandler::GetPlacementBlockTypeMeta(
|
bool cBlockPistonHandler::GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -13,10 +13,10 @@ class cBlockPistonHandler :
|
|||||||
public:
|
public:
|
||||||
cBlockPistonHandler(BLOCKTYPE a_BlockType);
|
cBlockPistonHandler(BLOCKTYPE a_BlockType);
|
||||||
|
|
||||||
virtual void OnDestroyed(cWorld *a_World, 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(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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))
|
if ((a_RelY - 1 < 0) || (a_RelY + 1 > cChunkDef::Height))
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlacedByPlayer(cWorld * a_World, 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
|
// Check whether the pumpkin is a part of a golem or a snowman
|
||||||
|
|
||||||
@ -24,16 +24,16 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLOCKTYPE BlockY1 = a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ);
|
BLOCKTYPE BlockY1 = a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ);
|
||||||
BLOCKTYPE BlockY2 = a_World->GetBlock(a_BlockX, a_BlockY - 2, a_BlockZ);
|
BLOCKTYPE BlockY2 = a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 2, a_BlockZ);
|
||||||
|
|
||||||
// Check for a snow golem:
|
// Check for a snow golem:
|
||||||
if ((BlockY1 == E_BLOCK_SNOW_BLOCK) && (BlockY2 == E_BLOCK_SNOW_BLOCK))
|
if ((BlockY1 == E_BLOCK_SNOW_BLOCK) && (BlockY2 == E_BLOCK_SNOW_BLOCK))
|
||||||
{
|
{
|
||||||
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||||
a_World->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);
|
||||||
a_World->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||||
a_World->SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtSnowGolem);
|
a_WorldInterface->SpawnMob(a_BlockX + 0.5, a_BlockY - 2, a_BlockZ + 0.5, cMonster::mtSnowGolem);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,40 +46,40 @@ public:
|
|||||||
|
|
||||||
// Now check both orientations for hands:
|
// Now check both orientations for hands:
|
||||||
if (
|
if (
|
||||||
(a_World->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_World->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:
|
// Remove the iron blocks:
|
||||||
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||||
a_World->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);
|
||||||
a_World->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_World->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_World->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||||
|
|
||||||
// Spawn the golem:
|
// Spawn the golem:
|
||||||
a_World->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 (
|
else if (
|
||||||
(a_World->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_World->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:
|
// Remove the iron blocks:
|
||||||
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
||||||
a_World->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);
|
||||||
a_World->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_World->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_World->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 2, a_BlockZ, E_BLOCK_AIR, 0);
|
||||||
|
|
||||||
// Spawn the golem:
|
// Spawn the golem:
|
||||||
a_World->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(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -42,9 +42,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual void OnPlaced(cChunkInterface *a_ChunkInterface, 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_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
super::OnPlaced(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||||
|
|
||||||
// Alert diagonal rails
|
// Alert diagonal rails
|
||||||
OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY + 1, a_BlockZ);
|
OnNeighborChanged(a_ChunkInterface, a_BlockX + 1, a_BlockY + 1, a_BlockZ);
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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)
|
if (a_RelY <= 0)
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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)]);
|
return ((a_RelY > 0) && g_BlockFullyOccupiesVoxel[a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)]);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -30,9 +30,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual void OnUse(cWorld * a_World, 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_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, ((a_World->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(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));
|
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(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));
|
return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ));
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual void OnPlacedByPlayer(
|
virtual void OnPlacedByPlayer(
|
||||||
cWorld * a_World, 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_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
cItemHandler * ItemHandler = cItemHandler::GetItemHandler(GetDoubleSlabType(Type));
|
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
|
// Check if the block at the coordinates is a slab. Eligibility for combining has already been processed in ClientHandle
|
||||||
if (IsAnySlabType(a_World->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,
|
// Call the function in ClientHandle that places a block when the client sends the packet,
|
||||||
// so that plugins may interfere with the placement.
|
// so that plugins may interfere with the placement.
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -28,7 +28,7 @@ public:
|
|||||||
|
|
||||||
BLOCKTYPE BlockBeforePlacement;
|
BLOCKTYPE BlockBeforePlacement;
|
||||||
NIBBLETYPE MetaBeforePlacement;
|
NIBBLETYPE MetaBeforePlacement;
|
||||||
a_World->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))
|
if ((BlockBeforePlacement == E_BLOCK_SNOW) && (MetaBeforePlacement < 7))
|
||||||
{
|
{
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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)
|
if (a_RelY > 0)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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));
|
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(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)
|
if (a_RelY <= 0)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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));
|
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(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -28,7 +28,7 @@ public:
|
|||||||
|
|
||||||
if ((a_BlockFace == BLOCK_FACE_TOP) || (a_BlockFace == BLOCK_FACE_BOTTOM))
|
if ((a_BlockFace == BLOCK_FACE_TOP) || (a_BlockFace == BLOCK_FACE_BOTTOM))
|
||||||
{
|
{
|
||||||
a_BlockFace = FindSuitableFace(a_World, a_BlockX, a_BlockY, a_BlockZ); // Top or bottom faces clicked, find a suitable face
|
a_BlockFace = FindSuitableFace(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ); // Top or bottom faces clicked, find a suitable face
|
||||||
if (a_BlockFace == BLOCK_FACE_NONE)
|
if (a_BlockFace == BLOCK_FACE_NONE)
|
||||||
{
|
{
|
||||||
// Client wouldn't have sent anything anyway, but whatever
|
// Client wouldn't have sent anything anyway, but whatever
|
||||||
@ -39,10 +39,10 @@ public:
|
|||||||
{
|
{
|
||||||
// Not top or bottom faces, try to preserve whatever face was clicked
|
// Not top or bottom faces, try to preserve whatever face was clicked
|
||||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true);
|
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, true);
|
||||||
if (!CanBePlacedOn(a_World->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
|
// Torch couldn't be placed on whatever face was clicked, last ditch resort - find another face
|
||||||
a_BlockFace = FindSuitableFace(a_World, a_BlockX, a_BlockY, a_BlockZ);
|
a_BlockFace = FindSuitableFace(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
if (a_BlockFace == BLOCK_FACE_NONE)
|
if (a_BlockFace == BLOCK_FACE_NONE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -110,12 +110,12 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
/// Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure
|
/// Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure
|
||||||
static char FindSuitableFace(cWorld * a_World, 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
|
for (int i = BLOCK_FACE_YM; i <= BLOCK_FACE_XP; i++) // Loop through all directions
|
||||||
{
|
{
|
||||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, i, true);
|
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, i, true);
|
||||||
BLOCKTYPE BlockInQuestion = a_World->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
|
if ( // If on a block that can only hold a torch if torch is standing on it, return that face
|
||||||
((BlockInQuestion == E_BLOCK_GLASS) ||
|
((BlockInQuestion == E_BLOCK_GLASS) ||
|
||||||
@ -142,7 +142,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual bool CanBeAt(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));
|
char Face = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
|
||||||
|
|
||||||
|
@ -32,16 +32,16 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnUse(cWorld * a_World, 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
|
// Flip the ON bit on/off using the XOR bitwise operation
|
||||||
NIBBLETYPE Meta = (a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04);
|
NIBBLETYPE Meta = (a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04);
|
||||||
|
|
||||||
a_World->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
a_ChunkInterface->SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool CanBeAt(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;
|
NIBBLETYPE Meta;
|
||||||
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
virtual bool GetPlacementBlockTypeMeta(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
@ -27,7 +27,7 @@ public:
|
|||||||
// TODO: Disallow placement where the vine doesn't attach to something properly
|
// TODO: Disallow placement where the vine doesn't attach to something properly
|
||||||
BLOCKTYPE BlockType = 0;
|
BLOCKTYPE BlockType = 0;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
a_ChunkInterface->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||||
if (BlockType == m_BlockType)
|
if (BlockType == m_BlockType)
|
||||||
{
|
{
|
||||||
a_BlockMeta = BlockMeta | DirectionToMetaData(a_BlockFace);
|
a_BlockMeta = BlockMeta | DirectionToMetaData(a_BlockFace);
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Check(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 CurMeta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
|
||||||
NIBBLETYPE MaxMeta = GetMaxMeta(a_Chunk, 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(
|
virtual bool GetPlacementBlockTypeMeta(
|
||||||
cWorld * a_World, cPlayer * a_Player,
|
cChunkInterface * a_ChunkInterface, cPlayer * a_Player,
|
||||||
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
|
||||||
int a_CursorX, int a_CursorY, int a_CursorZ,
|
int a_CursorX, int a_CursorY, int a_CursorZ,
|
||||||
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
||||||
|
@ -23,6 +23,10 @@ public:
|
|||||||
return m_ChunkMap->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
return m_ChunkMap->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetBlockTypeMeta (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
|
||||||
|
{
|
||||||
|
return m_ChunkMap->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||||
|
}
|
||||||
/** Sets the block at the specified coords to the specified value.
|
/** Sets the block at the specified coords to the specified value.
|
||||||
Full processing, incl. updating neighbors, is performed.
|
Full processing, incl. updating neighbors, is performed.
|
||||||
*/
|
*/
|
||||||
|
@ -22,4 +22,6 @@ public:
|
|||||||
/** Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified: */
|
/** Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified: */
|
||||||
virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false) = 0;
|
virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false) = 0;
|
||||||
|
|
||||||
|
/** Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise */
|
||||||
|
virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) = 0;
|
||||||
};
|
};
|
||||||
|
@ -753,7 +753,7 @@ void cChunk::BroadcastPendingBlockChanges(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cChunk::CheckBlocks(void)
|
void cChunk::CheckBlocks()
|
||||||
{
|
{
|
||||||
if (m_ToTickBlocks.size() == 0)
|
if (m_ToTickBlocks.size() == 0)
|
||||||
{
|
{
|
||||||
@ -762,13 +762,15 @@ void cChunk::CheckBlocks(void)
|
|||||||
std::vector<unsigned int> ToTickBlocks;
|
std::vector<unsigned int> ToTickBlocks;
|
||||||
std::swap(m_ToTickBlocks, ToTickBlocks);
|
std::swap(m_ToTickBlocks, ToTickBlocks);
|
||||||
|
|
||||||
|
cChunkInterface ChunkInterface(m_World->GetChunkMap());
|
||||||
|
|
||||||
for (std::vector<unsigned int>::const_iterator itr = ToTickBlocks.begin(), end = ToTickBlocks.end(); itr != end; ++itr)
|
for (std::vector<unsigned int>::const_iterator itr = ToTickBlocks.begin(), end = ToTickBlocks.end(); itr != end; ++itr)
|
||||||
{
|
{
|
||||||
unsigned int index = (*itr);
|
unsigned int index = (*itr);
|
||||||
Vector3i BlockPos = IndexToCoordinate(index);
|
Vector3i BlockPos = IndexToCoordinate(index);
|
||||||
|
|
||||||
cBlockHandler * Handler = BlockHandler(GetBlock(index));
|
cBlockHandler * Handler = BlockHandler(GetBlock(index));
|
||||||
Handler->Check(BlockPos.x, BlockPos.y, BlockPos.z, *this);
|
Handler->Check(&ChunkInterface, BlockPos.x, BlockPos.y, BlockPos.z, *this);
|
||||||
} // for itr - ToTickBlocks[]
|
} // for itr - ToTickBlocks[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ private:
|
|||||||
void BroadcastPendingBlockChanges(void);
|
void BroadcastPendingBlockChanges(void);
|
||||||
|
|
||||||
/// Checks the block scheduled for checking in m_ToTickBlocks[]
|
/// Checks the block scheduled for checking in m_ToTickBlocks[]
|
||||||
void CheckBlocks(void);
|
void CheckBlocks();
|
||||||
|
|
||||||
/// Ticks several random blocks in the chunk
|
/// Ticks several random blocks in the chunk
|
||||||
void TickBlocks(void);
|
void TickBlocks(void);
|
||||||
|
@ -1235,10 +1235,10 @@ 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 = new cChunkInterface(this);
|
cChunkInterface ChunkInterface(this);
|
||||||
if (a_BlockType == E_BLOCK_AIR)
|
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;
|
int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ;
|
||||||
@ -1251,8 +1251,7 @@ void cChunkMap::SetBlock(cWorldInterface * a_WorldInterface, int a_BlockX, int a
|
|||||||
Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta );
|
Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta );
|
||||||
m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk);
|
m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk);
|
||||||
}
|
}
|
||||||
BlockHandler(a_BlockType)->OnPlaced(ChunkInterface, 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);
|
||||||
delete ChunkInterface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1064,7 +1064,8 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, c
|
|||||||
{
|
{
|
||||||
m_Player->GetInventory().RemoveOneEquippedItem();
|
m_Player->GetInventory().RemoveOneEquippedItem();
|
||||||
}
|
}
|
||||||
NewBlock->OnPlacedByPlayer(World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
|
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);
|
||||||
|
|
||||||
// Step sound with 0.8f pitch is used as block placement sound
|
// 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);
|
World->BroadcastSoundEffect(NewBlock->GetStepSound(), a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 1.0f, 0.8f);
|
||||||
|
@ -747,7 +747,8 @@ void cRedstoneSimulator::HandleDoor(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
{
|
{
|
||||||
if (!AreCoordsSimulated(a_BlockX, a_BlockY, a_BlockZ, true))
|
if (!AreCoordsSimulated(a_BlockX, a_BlockY, a_BlockZ, true))
|
||||||
{
|
{
|
||||||
cBlockDoorHandler::ChangeDoor(&m_World, a_BlockX, a_BlockY, a_BlockZ);
|
cChunkInterface ChunkInterface(m_World.GetChunkMap());
|
||||||
|
cBlockDoorHandler::ChangeDoor(&ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
SetPlayerToggleableBlockAsSimulated(a_BlockX, a_BlockY, a_BlockZ, true);
|
SetPlayerToggleableBlockAsSimulated(a_BlockX, a_BlockY, a_BlockZ, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -755,7 +756,8 @@ void cRedstoneSimulator::HandleDoor(int a_BlockX, int a_BlockY, int a_BlockZ)
|
|||||||
{
|
{
|
||||||
if (!AreCoordsSimulated(a_BlockX, a_BlockY, a_BlockZ, false))
|
if (!AreCoordsSimulated(a_BlockX, a_BlockY, a_BlockZ, false))
|
||||||
{
|
{
|
||||||
cBlockDoorHandler::ChangeDoor(&m_World, a_BlockX, a_BlockY, a_BlockZ);
|
cChunkInterface ChunkInterface(m_World.GetChunkMap());
|
||||||
|
cBlockDoorHandler::ChangeDoor(&ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
SetPlayerToggleableBlockAsSimulated(a_BlockX, a_BlockY, a_BlockZ, false);
|
SetPlayerToggleableBlockAsSimulated(a_BlockX, a_BlockY, a_BlockZ, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ public:
|
|||||||
bool IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
|
bool IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
|
||||||
|
|
||||||
/** Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise */
|
/** Spawns a mob of the specified type. Returns the mob's EntityID if recognized and spawned, <0 otherwise */
|
||||||
int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType); // tolua_export
|
virtual int SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType); // tolua_export
|
||||||
int SpawnMobFinalize(cMonster* a_Monster);
|
int SpawnMobFinalize(cMonster* a_Monster);
|
||||||
|
|
||||||
/** Creates a projectile of the specified type. Returns the projectile's EntityID if successful, <0 otherwise */
|
/** Creates a projectile of the specified type. Returns the projectile's EntityID if successful, <0 otherwise */
|
||||||
|
Loading…
Reference in New Issue
Block a user