1
0

Fixed some new 1.7 client crash bugs

Some technical blocks were removed; trying to render them as items
caused a crash.
This commit is contained in:
Tiger Wang 2013-12-07 18:03:56 +00:00
parent a61082ffee
commit 5bed85aba0
6 changed files with 41 additions and 1 deletions

View File

@ -225,6 +225,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\BlockEntities\EnderChestEntity.h" />
<ClInclude Include="..\src\Blocks\BlockRedstoneLamp.h" />
<ClInclude Include="resource_MCServer.h" />
<ClInclude Include="..\src\Authenticator.h" />
<ClInclude Include="..\src\BlockArea.h" />

View File

@ -948,6 +948,9 @@
<ClInclude Include="..\src\BlockEntities\EnderChestEntity.h">
<Filter>Source Files\BlockEntities</Filter>
</ClInclude>
<ClInclude Include="..\src\Blocks\BlockRedstoneLamp.h">
<Filter>Source Files\Blocks</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\webadmin\template.html">

View File

@ -48,6 +48,7 @@
#include "BlockPumpkin.h"
#include "BlockRail.h"
#include "BlockRedstone.h"
#include "BlockRedstoneLamp.h"
#include "BlockRedstoneRepeater.h"
#include "BlockRedstoneTorch.h"
#include "BlockSand.h"
@ -171,6 +172,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_REDSTONE_ORE: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_REDSTONE_LAMP_ON: return new cBlockRedstoneLampHandler (a_BlockType);
case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler(a_BlockType);
case E_BLOCK_REDSTONE_REPEATER_ON: return new cBlockRedstoneRepeaterHandler(a_BlockType);
case E_BLOCK_REDSTONE_TORCH_OFF: return new cBlockRedstoneTorchHandler (a_BlockType);

View File

@ -36,6 +36,12 @@ public:
cBlockPistonHeadHandler(void);
virtual void OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// No pickups
// Also with 1.7, the item forms of these tecnical blocks have been removed, so giving someone this will crash their client...
}
} ;

View File

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

View File

@ -113,7 +113,7 @@ void cPiston::ExtendPiston(int pistx, int pisty, int pistz)
AddDir(pistx, pisty, pistz, pistonMeta, -1);
// "pist" now at piston body, "ext" at future extension
m_World->SetBlock( pistx, pisty, pistz, pistonBlock, pistonMeta | 0x8);
m_World->SetBlock(pistx, pisty, pistz, pistonBlock, pistonMeta | 0x8);
m_World->QueueSetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, pistonMeta | (IsSticky(pistonBlock) ? 8 : 0), PISTON_TICK_DELAY);
}
@ -126,6 +126,7 @@ void cPiston::RetractPiston(int pistx, int pisty, int pistz)
BLOCKTYPE pistonBlock;
NIBBLETYPE pistonMeta;
m_World->GetBlockTypeMeta(pistx, pisty, pistz, pistonBlock, pistonMeta);
if (!IsExtended(pistonMeta))
{
// Already retracted, bail out