1
0

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:
admin@omencraft.com 2011-11-11 00:21:52 +00:00
parent 7528819117
commit 750f9ab74f
2 changed files with 8 additions and 3 deletions

View File

@ -695,8 +695,10 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
bool bPlaceBlock = true;
bool UpdateRedstone = false;
bool AddedCurrent = false;
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 );
switch( BlockID )
{
@ -814,6 +816,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
char MetaData = (char)Equipped.m_ItemHealth;
bool LavaBucket = false;
bool WaterBucket = false;
switch( PacketData->m_ItemType ) // Special handling for special items
{
case E_ITEM_BUCKET:
@ -947,10 +950,12 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
char Y = PacketData->m_PosY;
int Z = PacketData->m_PosZ;
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
}
if( (m_Player->GetGameMode() == 1) || (m_Player->GetInventory().RemoveItem( Item )) )
{
if (isDoor) {

View File

@ -20,7 +20,7 @@ public:
cClientHandle(const cSocket & a_Socket);
~cClientHandle();
static const int VIEWDISTANCE = 13;
static const int VIEWDISTANCE = 17;
const cSocket & GetSocket();
cPlayer* GetPlayer() { return m_Player; } // tolua_export