Fixed certain blocks crashing clients when mined

Fixed rail duplication glitch
Fixed fall damage calculation
Glass no longer drops glass

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1068 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
luksor111@gmail.com 2012-11-26 10:03:34 +00:00
parent f50c14f91b
commit eb7131bd12
7 changed files with 38 additions and 5 deletions

View File

@ -1818,6 +1818,10 @@
RelativePath="..\source\blocks\BlockFurnace.h"
>
</File>
<File
RelativePath="..\source\Blocks\BlockGlass.h"
>
</File>
<File
RelativePath="..\source\blocks\BlockGlowstone.h"
>

View File

@ -0,0 +1,26 @@
#pragma once
#include "BlockHandler.h"
class cBlockGlassHandler :
public cBlockHandler
{
public:
cBlockGlassHandler(BLOCKTYPE a_BlockType)
: cBlockHandler(a_BlockType)
{
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
}
} ;

View File

@ -46,6 +46,7 @@
#include "BlockFarmland.h"
#include "BlockMycelium.h"
#include "BlockRail.h"
#include "BlockGlass.h"
@ -104,6 +105,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_FURNACE: return new cBlockFurnaceHandler (a_BlockType);
case E_BLOCK_GLOWSTONE: return new cBlockGlowstoneHandler (a_BlockType);
case E_BLOCK_GOLD_ORE: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_GLASS: return new cBlockGlassHandler (a_BlockType);
case E_BLOCK_GRASS: return new cBlockDirtHandler (a_BlockType);
case E_BLOCK_GRAVEL: return new cBlockGravelHandler (a_BlockType);
case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType);

View File

@ -20,7 +20,7 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
short ItemType = E_ITEM_EMPTY;
short ItemType = m_BlockType;
char Count = 1;
short Meta = 0;

View File

@ -58,7 +58,8 @@ public:
virtual void OnNeighborChanged(cWorld *a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
if(IsUnstable(a_World, a_BlockX, a_BlockY, a_BlockZ))
char Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if(IsUnstable(a_World, a_BlockX, a_BlockY, a_BlockZ) && Meta != FindMeta(a_World, a_BlockX, a_BlockY, a_BlockZ))
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, FindMeta(a_World, a_BlockX, a_BlockY, a_BlockZ));
}

View File

@ -47,7 +47,7 @@ enum
inline bool IsValidBlock( int a_BlockType ) //tolua_export
{ //tolua_export
if( a_BlockType > -1 &&
a_BlockType <= 126 && //items to 109 are valid for Beta1.8.1.. 1.2.5 is up to 126
a_BlockType <= 145 && //items to 109 are valid for Beta1.8.1.. 1.2.5 is up to 126
//a_BlockType != 29 && allow pistons
//a_BlockType != 33 && allow pistons
a_BlockType != 34 &&
@ -66,7 +66,7 @@ inline bool IsValidBlock( int a_BlockType ) //tolua_export
// Changed to fit the style ;)
inline bool IsValidItem( int a_ItemID ) //tolua_export
{ //tolua_export
if( (a_ItemID >= 256 && a_ItemID <= 388)
if( (a_ItemID >= 256 && a_ItemID <= 400)
|| (a_ItemID >= 2256 && a_ItemID <= 2267) )
{
return true;

View File

@ -290,7 +290,7 @@ void cPlayer::SetTouchGround(bool a_bTouchGround)
if (m_bTouchGround)
{
float Dist = (float)(m_LastGroundHeight - m_Pos.y);
int Damage = (int)(Dist - 4.f);
int Damage = (int)(Dist - 3.f);
if (Damage > 0)
{
TakeDamage(Damage, 0);