From eb7131bd126b06c348313de6ab07d5d59f7c79c0 Mon Sep 17 00:00:00 2001 From: "luksor111@gmail.com" Date: Mon, 26 Nov 2012 10:03:34 +0000 Subject: [PATCH] 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 --- VC2008/MCServer.vcproj | 4 ++++ source/Blocks/BlockGlass.h | 26 ++++++++++++++++++++++++++ source/Blocks/BlockHandler.cpp | 2 ++ source/Blocks/BlockOre.h | 2 +- source/Blocks/BlockRail.h | 3 ++- source/Defines.h | 4 ++-- source/Player.cpp | 2 +- 7 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 source/Blocks/BlockGlass.h diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj index 6d7054b1b..9f9132cb4 100644 --- a/VC2008/MCServer.vcproj +++ b/VC2008/MCServer.vcproj @@ -1818,6 +1818,10 @@ RelativePath="..\source\blocks\BlockFurnace.h" > + + diff --git a/source/Blocks/BlockGlass.h b/source/Blocks/BlockGlass.h new file mode 100644 index 000000000..d5147af96 --- /dev/null +++ b/source/Blocks/BlockGlass.h @@ -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 + { + } +} ; + + + + diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp index 53e9c4a06..3f63de89f 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/source/Blocks/BlockHandler.cpp @@ -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); diff --git a/source/Blocks/BlockOre.h b/source/Blocks/BlockOre.h index 50f5a88e2..1bfd8d17c 100644 --- a/source/Blocks/BlockOre.h +++ b/source/Blocks/BlockOre.h @@ -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; diff --git a/source/Blocks/BlockRail.h b/source/Blocks/BlockRail.h index fb2000884..24947c0bc 100644 --- a/source/Blocks/BlockRail.h +++ b/source/Blocks/BlockRail.h @@ -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)); } diff --git a/source/Defines.h b/source/Defines.h index 1844d7872..18d495a53 100644 --- a/source/Defines.h +++ b/source/Defines.h @@ -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; diff --git a/source/Player.cpp b/source/Player.cpp index cf9e4be99..cd4c6d11c 100644 --- a/source/Player.cpp +++ b/source/Player.cpp @@ -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);