https://github.com/scriptlinestudios/loot_library.h
A C library for emulating Minecraft loot table generation
https://github.com/scriptlinestudios/loot_library.h
Last synced: 3 months ago
JSON representation
A C library for emulating Minecraft loot table generation
- Host: GitHub
- URL: https://github.com/scriptlinestudios/loot_library.h
- Owner: ScriptLineStudios
- License: mit
- Created: 2024-12-14T19:16:31.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-01T21:47:30.000Z (about 1 year ago)
- Last Synced: 2025-01-01T22:29:13.280Z (about 1 year ago)
- Language: C
- Size: 20.5 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# loot_library.h
A C library for emulating Minecraft loot table generation. Still a WIP, API is still subject to sudden changes.
While it's written in C, the entire library can be ported to CUDA very easily if needed.
Currently supports ruined portals and desert temples.
# example
Searching through ruined portal loot seeds.
```C
#include
#define LOOT_LIBRARY
#include "src/loot_library.h"
int main(void) {
LootTable table = init_ruined_portal_loot_table();
uint64_t loot_seed = 1111L;
LootItem items[64] = {0};
size_t num_items;
ruined_portal_loot(&table, loot_seed, items, &num_items);
for (size_t i = 0; i < num_items; i++) {
printf("%s x %d\n", item_names[items[i].item], items[i].quantity);
if (items[i].enchanted) {
printf(" %s %d\n", enchant_names[items[i].enchant], items[i].enchant_level);
}
}
return 0;
}
```