Sorry i've been posting so much recently, but google has not been helping me at all lately. Anyway, i want to know how to add items to loot tables with damage values Via code. Thanks in advanced
You need to subscribe to LootTableLoadEvent, check that the loot table being loaded is the one you want to modify and then add/remove loot pools and entries as required.
Keep in mind that you can add a LootEntryTable instance to generate loot from another loot table.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
The documentation links to some examples of modifications to vanilla loot tables in Botania, you may want to read through those.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
JSON files aren't required, but they can make it easier if you're making some complex additions, e.g. adding lots of possible items or complex conditions.
You can either create the relevant LootPool and LootEntry objects in code, or you can add a single LootEntryTable (and probably a LootPool to contain it) to generate loot from a different loot table.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
If needed, create a LootPool and pass the LootEntry and LootCondition instances to the constructor.
Use LootTable#getPool to get an existing LootPool or LootTable#addPool to add a new one.
If needed, use LootPool#addEntry to add a new LootEntry to an existing LootPool.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So, should this be working? (i got the loot condition, function and random value stuff from Botania, and allot from the forge documentation) or am i still missing something huge?
@SubscribeEvent
public void lootLoad(LootTableLoadEvent e)
{
if (e.getName().toString().equals("minecraft:chests/simple_dungeon"))
{
LootEntry entry = new LootEntryItem(ModItems.directional_shard, 15, 60, new LootFunction[0], new LootCondition[0] "biomecompass:directional_shard");
LootPool pool1 = new LootPool(new LootEntry[]{entry}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0,1), "biomecompass_pool_inject");
That looks correct, but you should use your own names for the LootEntry/LootPool instead of the Biome Compass names.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So its working now(thanks :D), but now i want to know how to add a loot function so that it picks a damage value from a List and then randomly assigns it to the item.
Sorry i've been posting so much recently, but google has not been helping me at all lately. Anyway, i want to know how to add items to loot tables with damage values Via code. Thanks in advanced
Infact, is modifying vanilla loot tables from code without json even possible?
You need to subscribe to LootTableLoadEvent, check that the loot table being loaded is the one you want to modify and then add/remove loot pools and entries as required.
Keep in mind that you can add a LootEntryTable instance to generate loot from another loot table.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I've been trying to do that referencing https://mcforge.readthedocs.io/en/latest/items/loot_tables/#modifying-vanilla-loot, but don't understand it at all.
Is there a particular part you don't understand?
The documentation links to some examples of modifications to vanilla loot tables in Botania, you may want to read through those.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I just honestly dont understand the system for injecting into vanilla loot tables. Are jsons required? Or can you do it purely through code?
JSON files aren't required, but they can make it easier if you're making some complex additions, e.g. adding lots of possible items or complex conditions.
You can either create the relevant LootPool and LootEntry objects in code, or you can add a single LootEntryTable (and probably a LootPool to contain it) to generate loot from a different loot table.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
how would i go about doing that?
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So, should this be working? (i got the loot condition, function and random value stuff from Botania, and allot from the forge documentation) or am i still missing something huge?
@SubscribeEvent
public void lootLoad(LootTableLoadEvent e)
{
if (e.getName().toString().equals("minecraft:chests/simple_dungeon"))
{
LootEntry entry = new LootEntryItem(ModItems.directional_shard, 15, 60, new LootFunction[0], new LootCondition[0] "biomecompass:directional_shard");
LootPool pool1 = new LootPool(new LootEntry[]{entry}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0,1), "biomecompass_pool_inject");
e.getTable().addPool(pool1);
}
}
That looks correct, but you should use your own names for the LootEntry/LootPool instead of the Biome Compass names.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
alright
Also, im making my own type of biome compass mod. that's why its called biomecompass_inject_pool
So its working now(thanks :D), but now i want to know how to add a loot function so that it picks a damage value from a List and then randomly assigns it to the item.
nvm i found how how