Found and fixed a bug not letting users place blocks in water or lava.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@91 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
7528819117
commit
750f9ab74f
@ -695,8 +695,10 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
|
|||||||
bool bPlaceBlock = true;
|
bool bPlaceBlock = true;
|
||||||
bool UpdateRedstone = false;
|
bool UpdateRedstone = false;
|
||||||
bool AddedCurrent = false;
|
bool AddedCurrent = false;
|
||||||
|
|
||||||
if( PacketData->m_Direction >= 0 )
|
if( PacketData->m_Direction >= 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
ENUM_BLOCK_ID BlockID = (ENUM_BLOCK_ID)m_Player->GetWorld()->GetBlock( PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ );
|
ENUM_BLOCK_ID BlockID = (ENUM_BLOCK_ID)m_Player->GetWorld()->GetBlock( PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ );
|
||||||
switch( BlockID )
|
switch( BlockID )
|
||||||
{
|
{
|
||||||
@ -814,6 +816,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
|
|||||||
char MetaData = (char)Equipped.m_ItemHealth;
|
char MetaData = (char)Equipped.m_ItemHealth;
|
||||||
bool LavaBucket = false;
|
bool LavaBucket = false;
|
||||||
bool WaterBucket = false;
|
bool WaterBucket = false;
|
||||||
|
|
||||||
switch( PacketData->m_ItemType ) // Special handling for special items
|
switch( PacketData->m_ItemType ) // Special handling for special items
|
||||||
{
|
{
|
||||||
case E_ITEM_BUCKET:
|
case E_ITEM_BUCKET:
|
||||||
@ -947,10 +950,12 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
|
|||||||
char Y = PacketData->m_PosY;
|
char Y = PacketData->m_PosY;
|
||||||
int Z = PacketData->m_PosZ;
|
int Z = PacketData->m_PosZ;
|
||||||
AddDirection( X, Y, Z, PacketData->m_Direction );
|
AddDirection( X, Y, Z, PacketData->m_Direction );
|
||||||
if( m_Player->GetWorld()->GetBlock( X, Y, Z ) != E_BLOCK_AIR ) { //tried to place a block *into* another?
|
|
||||||
|
int PlaceBlock = m_Player->GetWorld()->GetBlock( X, Y, Z );
|
||||||
|
if (!( ( PlaceBlock == E_BLOCK_AIR ) || ( PlaceBlock == E_BLOCK_WATER ) || ( PlaceBlock == E_BLOCK_STATIONARY_WATER ) || ( PlaceBlock == E_BLOCK_LAVA ) || ( PlaceBlock == E_BLOCK_STATIONARY_LAVA ) ) ) { //tried to place a block *into* another?
|
||||||
break; //happens when you place a block aiming at side of block like torch or stem
|
break; //happens when you place a block aiming at side of block like torch or stem
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (m_Player->GetGameMode() == 1) || (m_Player->GetInventory().RemoveItem( Item )) )
|
if( (m_Player->GetGameMode() == 1) || (m_Player->GetInventory().RemoveItem( Item )) )
|
||||||
{
|
{
|
||||||
if (isDoor) {
|
if (isDoor) {
|
||||||
|
@ -20,7 +20,7 @@ public:
|
|||||||
cClientHandle(const cSocket & a_Socket);
|
cClientHandle(const cSocket & a_Socket);
|
||||||
~cClientHandle();
|
~cClientHandle();
|
||||||
|
|
||||||
static const int VIEWDISTANCE = 13;
|
static const int VIEWDISTANCE = 17;
|
||||||
|
|
||||||
const cSocket & GetSocket();
|
const cSocket & GetSocket();
|
||||||
cPlayer* GetPlayer() { return m_Player; } // tolua_export
|
cPlayer* GetPlayer() { return m_Player; } // tolua_export
|
||||||
|
Loading…
Reference in New Issue
Block a user