2011-10-03 14:41:19 -04:00
|
|
|
#include "cBlockToPickup.h"
|
2011-12-25 12:47:01 -05:00
|
|
|
#include "Defines.h"
|
2011-10-03 14:41:19 -04:00
|
|
|
#include "BlockID.h"
|
2011-12-21 15:42:34 -05:00
|
|
|
#include "stdlib.h"
|
2011-12-26 04:09:47 -05:00
|
|
|
#include "MersenneTwister.h"
|
2011-10-03 14:41:19 -04:00
|
|
|
|
|
|
|
ENUM_ITEM_ID cBlockToPickup::ToPickup( unsigned char a_BlockID, ENUM_ITEM_ID a_UsedItemID )
|
|
|
|
{
|
2011-12-26 04:09:47 -05:00
|
|
|
MTRand r1;
|
2011-10-03 14:41:19 -04:00
|
|
|
(void)a_UsedItemID;
|
|
|
|
|
|
|
|
switch( a_BlockID )
|
|
|
|
{
|
|
|
|
case E_BLOCK_AIR:
|
|
|
|
return E_ITEM_EMPTY;
|
2011-12-25 12:47:01 -05:00
|
|
|
case E_BLOCK_COBBLESTONE:
|
2011-10-03 14:41:19 -04:00
|
|
|
case E_BLOCK_STONE:
|
2011-12-25 12:47:01 -05:00
|
|
|
if(ItemCategory::IsPickaxe(a_UsedItemID))
|
|
|
|
return E_ITEM_COBBLESTONE;
|
|
|
|
return E_ITEM_EMPTY;
|
2011-10-03 14:41:19 -04:00
|
|
|
case E_BLOCK_GRASS:
|
|
|
|
return E_ITEM_DIRT;
|
2011-11-07 13:19:38 -05:00
|
|
|
case E_BLOCK_GLASS:
|
|
|
|
return E_ITEM_EMPTY;
|
2011-10-03 14:41:19 -04:00
|
|
|
case E_BLOCK_DIRT:
|
|
|
|
return E_ITEM_DIRT;
|
|
|
|
case E_BLOCK_LOG:
|
|
|
|
return E_ITEM_LOG;
|
2011-11-07 13:19:38 -05:00
|
|
|
case E_BLOCK_LEAVES:
|
|
|
|
if( a_UsedItemID == E_ITEM_SHEARS )
|
|
|
|
return E_ITEM_LEAVES;
|
|
|
|
else
|
2011-12-26 04:09:47 -05:00
|
|
|
if(r1.randInt() % 5 == 0) return E_ITEM_SAPLING;
|
2011-12-24 18:34:30 -05:00
|
|
|
return E_ITEM_EMPTY;
|
2011-10-03 14:41:19 -04:00
|
|
|
case E_BLOCK_COAL_ORE:
|
|
|
|
return E_ITEM_COAL;
|
2011-11-07 13:19:38 -05:00
|
|
|
case E_BLOCK_LAPIS_ORE:
|
|
|
|
return E_ITEM_DYE;
|
|
|
|
case E_BLOCK_REDSTONE_ORE_GLOWING:
|
|
|
|
case E_BLOCK_REDSTONE_ORE:
|
|
|
|
return E_ITEM_REDSTONE_DUST;
|
2011-10-03 14:41:19 -04:00
|
|
|
case E_BLOCK_DIAMOND_ORE:
|
|
|
|
return E_ITEM_DIAMOND;
|
|
|
|
case E_BLOCK_IRON_BLOCK:
|
|
|
|
return E_ITEM_IRON_BLOCK;
|
|
|
|
case E_BLOCK_DIAMOND_BLOCK:
|
|
|
|
return E_ITEM_DIAMOND_BLOCK;
|
|
|
|
case E_BLOCK_GOLD_BLOCK:
|
|
|
|
return E_ITEM_GOLD_BLOCK;
|
|
|
|
case E_BLOCK_SIGN_POST:
|
|
|
|
case E_BLOCK_WALLSIGN:
|
|
|
|
return E_ITEM_SIGN;
|
2011-11-07 13:19:38 -05:00
|
|
|
case E_BLOCK_REDSTONE_WIRE:
|
|
|
|
return E_ITEM_REDSTONE_DUST;
|
|
|
|
case E_BLOCK_REDSTONE_TORCH_OFF:
|
|
|
|
return E_ITEM_REDSTONE_TORCH_ON;
|
|
|
|
case E_BLOCK_MELON:
|
|
|
|
return E_ITEM_MELON_SLICE;
|
2011-12-24 20:40:31 -05:00
|
|
|
case E_BLOCK_WOODEN_DOOR:
|
|
|
|
return E_ITEM_WOODEN_DOOR;
|
|
|
|
case E_BLOCK_IRON_DOOR:
|
|
|
|
return E_ITEM_IRON_DOOR;
|
2011-12-25 12:47:01 -05:00
|
|
|
case E_BLOCK_GLOWSTONE:
|
|
|
|
return E_ITEM_GLOWSTONE_DUST;
|
2011-10-03 14:41:19 -04:00
|
|
|
default:
|
|
|
|
return (ENUM_ITEM_ID)a_BlockID;
|
|
|
|
}
|
|
|
|
}
|
2011-12-24 20:40:31 -05:00
|
|
|
|
|
|
|
char cBlockToPickup::PickupCount(unsigned char a_BlockID)
|
|
|
|
{
|
2011-12-26 04:09:47 -05:00
|
|
|
MTRand r1;
|
2011-12-24 20:40:31 -05:00
|
|
|
switch(a_BlockID)
|
|
|
|
{
|
|
|
|
case E_BLOCK_REDSTONE_ORE_GLOWING:
|
|
|
|
case E_BLOCK_REDSTONE_ORE:
|
2011-12-26 04:09:47 -05:00
|
|
|
return r1.randInt() % 2 + 4;
|
2011-12-25 12:47:01 -05:00
|
|
|
case E_BLOCK_GLOWSTONE:
|
2011-12-26 04:09:47 -05:00
|
|
|
return r1.randInt() % 3 + 2;
|
2011-12-24 20:40:31 -05:00
|
|
|
case E_BLOCK_MELON:
|
2011-12-26 04:09:47 -05:00
|
|
|
return r1.randInt() % 8 + 3;
|
2011-12-24 20:40:31 -05:00
|
|
|
case E_BLOCK_LAPIS_ORE:
|
2011-12-26 04:09:47 -05:00
|
|
|
return r1.randInt() % 5 + 4;
|
2011-12-24 20:40:31 -05:00
|
|
|
default:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|