1
0
cuberite-2a/src/Blocks/BlockOre.h

64 lines
1.0 KiB
C
Raw Normal View History

#pragma once
#include "BlockHandler.h"
#include "../World.h"
class cBlockOreHandler :
public cBlockHandler
{
public:
cBlockOreHandler(BLOCKTYPE a_BlockType)
: cBlockHandler(a_BlockType)
{
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
2014-08-19 16:14:37 -04:00
cFastRandom Random;
switch (m_BlockType)
{
case E_BLOCK_LAPIS_ORE:
{
2014-08-19 16:14:37 -04:00
a_Pickups.push_back(cItem(E_ITEM_DYE, (char)(4 + Random.NextInt(5)), 4));
break;
}
case E_BLOCK_REDSTONE_ORE:
case E_BLOCK_REDSTONE_ORE_GLOWING:
{
2014-08-19 16:14:37 -04:00
a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, (char)(4 + Random.NextInt(2)), 0));
break;
}
case E_BLOCK_DIAMOND_ORE:
{
2014-08-19 16:14:37 -04:00
a_Pickups.push_back(cItem(E_ITEM_DIAMOND));
break;
}
case E_BLOCK_EMERALD_ORE:
{
2014-08-19 16:14:37 -04:00
a_Pickups.push_back(cItem(E_ITEM_EMERALD));
break;
}
case E_BLOCK_COAL_ORE:
{
2014-08-19 16:14:37 -04:00
a_Pickups.push_back(cItem(E_ITEM_COAL));
break;
}
2014-08-19 16:14:37 -04:00
default:
{
2014-09-12 08:08:56 -04:00
a_Pickups.push_back(cItem(m_BlockType));
break;
2014-08-19 16:14:37 -04:00
}
}
}
} ;