summaryrefslogtreecommitdiffstats
path: root/source/cPickup.cpp
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-22 17:30:40 +0100
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-22 17:30:40 +0100
commite54373160b69c342dd1a625a841bda3707ba7acf (patch)
tree2a01aba188c6d79ab366cb4dbb0a4dc94ff31a55 /source/cPickup.cpp
parentMissed a class in r94 ;) Sorry guys :D (diff)
downloadcuberite-e54373160b69c342dd1a625a841bda3707ba7acf.tar
cuberite-e54373160b69c342dd1a625a841bda3707ba7acf.tar.gz
cuberite-e54373160b69c342dd1a625a841bda3707ba7acf.tar.bz2
cuberite-e54373160b69c342dd1a625a841bda3707ba7acf.tar.lz
cuberite-e54373160b69c342dd1a625a841bda3707ba7acf.tar.xz
cuberite-e54373160b69c342dd1a625a841bda3707ba7acf.tar.zst
cuberite-e54373160b69c342dd1a625a841bda3707ba7acf.zip
Diffstat (limited to '')
-rw-r--r--source/cPickup.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/cPickup.cpp b/source/cPickup.cpp
index 4788c2e1f..7c4a546ec 100644
--- a/source/cPickup.cpp
+++ b/source/cPickup.cpp
@@ -80,7 +80,8 @@ cPickup::cPickup(cPacket_PickupSpawn* a_PickupSpawnPacket)
m_Speed->z = (float)(a_PickupSpawnPacket->m_Roll) / 8;
// Spawn it on clients
- cRoot::Get()->GetServer()->Broadcast( *a_PickupSpawnPacket );
+ if(a_PickupSpawnPacket->m_Item != E_ITEM_EMPTY)
+ cRoot::Get()->GetServer()->Broadcast( *a_PickupSpawnPacket );
m_EntityType = E_PICKUP;
}
@@ -98,12 +99,13 @@ void cPickup::SpawnOn( cClientHandle* a_Target )
PickupSpawn.m_Rotation = (char)(m_Speed->x * 8);
PickupSpawn.m_Pitch = (char)(m_Speed->y * 8);
PickupSpawn.m_Roll = (char)(m_Speed->z * 8);
- a_Target->Send( PickupSpawn );
+ if(PickupSpawn.m_Item != E_ITEM_EMPTY)
+ a_Target->Send( PickupSpawn );
}
void cPickup::Tick(float a_Dt)
{
- m_Timer+=a_Dt;
+ m_Timer += a_Dt;
a_Dt = a_Dt / 1000.f;
if(m_bCollected)
{
@@ -152,7 +154,9 @@ void cPickup::HandlePhysics(float a_Dt)
cWorld* World = GetWorld();
int BlockX = (m_Pos->x)<0 ? (int)m_Pos->x-1 : (int)m_Pos->x;
int BlockZ = (m_Pos->z)<0 ? (int)m_Pos->z-1 : (int)m_Pos->z;
- if( World->GetBlock( BlockX, (int)m_Pos->y -1, BlockZ ) == E_BLOCK_AIR )
+ char BlockBelow = World->GetBlock( BlockX, (int)m_Pos->y -1, BlockZ );
+ //Not only air, falls through water ;)
+ if( BlockBelow == E_BLOCK_AIR || IsBlockWater(BlockBelow))
{
m_bOnGround = false;
}
@@ -162,7 +166,8 @@ void cPickup::HandlePhysics(float a_Dt)
m_Timer = 0;
return;
}
- if( World->GetBlock( BlockX, (int)m_Pos->y, BlockZ ) != E_BLOCK_AIR ) // If in ground itself, push it out
+ char BlockIn = World->GetBlock( BlockX, (int)m_Pos->y, BlockZ );
+ if( BlockIn != E_BLOCK_AIR && !IsBlockWater(BlockIn) ) // If in ground itself, push it out
{
m_bOnGround = true;
m_Pos->y += 0.2;