08-27-2020, 06:45 PM
I'd recommend doing something similar to vanilla's loot tables: https://minecraft.gamepedia.com/Loot_table
If I understand that correctly, there are data files that describe the loot to be generated in different situations, and containers can reference them (by filename). There is a way for custom worlds to override the default loot tables, simply by having appropriately-named files in a specific subfolder within the world folder. I think this behavior can be copied to Cuberite.
As for assigning loot tables to containers, we have a cBlockEntityWithItems class that is the ideal place to implement the loot table handling, including the saving and loading. Since cBlockArea supports block entities, this will give support to loot tables to the cBlockArea class, and there's only a single missing step of exporting / importing them via cubeset files, which would need implementing by the GalExport plugin.
We'd also need an loot table editor, most likely implemented in the GalExport plugin as a separate web tab, each area would have a list of containers and associated loot tables.
One possible extension to the Vanilla system would be custom loot tables, specific for a container. Instead of storing a filename in the LootTable tag, we could store "verbatim:[json]" with the loot table stored directly in the tag.
If I understand that correctly, there are data files that describe the loot to be generated in different situations, and containers can reference them (by filename). There is a way for custom worlds to override the default loot tables, simply by having appropriately-named files in a specific subfolder within the world folder. I think this behavior can be copied to Cuberite.
As for assigning loot tables to containers, we have a cBlockEntityWithItems class that is the ideal place to implement the loot table handling, including the saving and loading. Since cBlockArea supports block entities, this will give support to loot tables to the cBlockArea class, and there's only a single missing step of exporting / importing them via cubeset files, which would need implementing by the GalExport plugin.
We'd also need an loot table editor, most likely implemented in the GalExport plugin as a separate web tab, each area would have a list of containers and associated loot tables.
One possible extension to the Vanilla system would be custom loot tables, specific for a container. Instead of storing a filename in the LootTable tag, we could store "verbatim:[json]" with the loot table stored directly in the tag.