#lootjs custom drops seem to overwrite default drops
33 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
this is how i removed leather from the drops if its relevant
heres the consts
OH my bad
THIS is the the problem code
okay wierder enough skinnable2.forEach works as expected while skinnable.forEach does not
ie pigs seem to be only dropping kubejs:animalskin while cows drop their normal drops w/ kubejs:animalskin as well
okay it seems like pigs are the only one affected??? dude i have no idea whats going on
ok further testing looks like pigs still do drop porkchops
BUT the probabilities are all effed up
killed a lot of pigs and only got a handful of porkchops while i have stacks of animalskin
i genuinely dont know whats going on lol
💔
I recommend installing Advanced Loot Info in order to get in-game information about loot tables (press U on the mob spawn egg)
Cows can drop 2 types of items at the same time, leather and beef, meaning that they probably use a loot table with several pools. If leather was in the first pool and you removed it and then happened to fill that pool with your item, you effectively kept the loot table structure intact by replacing the leather with your drop
With the pig, it drops only 1 type of item, meaning it most likely has only 1 pool. If you add your new item to that same (first) pool, then you have a loot table with 1 pool hosting 2 items, meaning that when their drop chances will get rolled, they will fight for what gets dropped, and weight 25 heavily favors your item (porkchop probably has a weight of 1, so it only gets dropped 1/26 times)
So if I am correct, you probably want to create a 2nd pool for your skinnable(s) and put your item there to not disturb the original drop
alr it works as intendend now
thank u!
qucik questtion since i cant close myticket for some reason
what exactly is withWeight?
is it like a percentage of 100 or whatever?
is this correct? i feel like i messed something up
i mean i tested it and it semi works but it seems like it only does either pork or animal skin
If you want to just replace the leather with your item, LootJS has replaceItem which can be much easier than creating a new LootEntry. https://docs.almostreliable.com/lootjs/api/loot-entries-transformer.html#replaceitem
Documentation for LootJS
What you're doing here is creating a loot table with a pool with your item and allegedly shoving it into the first pool of your target entities, so effectively you're not doing anything different than before since the porkchop and the loot table still share the same pool. You don't need to create a new loot table in order to create a new pool. Instead of doing it in two steps, you can do it in one like so (notice how .firstPool() isn't called):
event.getLootTable("minecraft:entities/husk").createPool(pool => {
pool.addEntry(LootEntry.of('quest_items:toxic_vial').killedByPlayer().randomChanceWithEnchantment("minecraft:looting", [0.05, 0.1, 0.15, 0.2]))
})
They are not percentages, they are numbers which are turned into ratios (percentages) based on the existing weight of other items in a pool. Most items that don't share a pool will have a default weight of 1 since they don't compete with any other item. If item 1 has a weight of 3, item2 has a weight of 10 and they are the only two items in a pool, it means item1 will have a 3/13 chance to drop whilst item2 will have a 10/13 chance to drop
Again, I recommend installing the Advanced Loot Info mod. It will allow you to see the loot tables and the pools. It makes it much easier to debug
alr !