Quote:think the loottable reference should be stored within the cBlockEntityWithItems directly
So you meen the whole json file as a string? Or just a a reference to the loot table? Although both is possible. just check if it's valid json and parse it or try the lookup - else send error message.
The String m_LootTable is already written to disk when storing the BlockEntityWithItems
Another Thing about hardcoding:
The Loot tables refences so called "item tags" this is a feature of minecraft to reference multiple blocks a once through a simple string. (e.g. minecraft:bamboo_buildable_on -> bamboo, gravel,...)
I hardcoded them from the wiki and now i saw that you can export them from the server jar.
My Question:
Do we want to include that also into the cuberite files or do we want it in the binary?
Note: Vanilla minecraft doesn't allow editing on those files.
Edit:
I know that there is a function that let's you check if a cItem is of a certein type BUT i didn't find any function to return a cItems with all the items so that you can obtain all or any of the items described by the tag (which would be needed for the loot tables)
Edit 2:
If we do include them i'd suggest merging the (realy many) files to a single json file and using the name of the file as key to the object containing the actual values from the file.
Maybe even gzip the resulting file to prevent incidental user changes to the files.
Edit 3:
Then I'd add an object to root that does the handling and distribution. e.g.
Code:
class ItemTagHandler
{
bool IsInItemTag(const AString & a_Tag, const cItem & a_Item);
cItems GetItems(const AString & a_Tag);
}