Nooncraft/src/item.cpp

28 lines
491 B
C++

#include "item.h"
extern "C" {
extern ItemInfo Nooncraft_itemInfo[];
extern int Nooncraft_itemInfoCount;
}
namespace Nooncraft {
ItemInfo *getItemInfo(Item const &i)
{
if(i.isBlock)
return nullptr;
if(i.itemID >= Nooncraft_itemInfoCount)
return nullptr;
return &Nooncraft_itemInfo[i.itemID];
}
BlockInfo *getItemBlockInfo(Item const &i)
{
if(!i.isBlock)
return nullptr;
return Nooncraft::getBlockInfo(i.block);
}
} /* namespace Nooncraft */