Woot

Woot

24M Downloads

[1.9.4] Rework loot learning

Ipsis opened this issue ยท 4 comments

commented

Currently if a mob has some rare loot and the mod doesn't see it before the learning limit is hit for that mob/looting combination, then we will never generate the loot.

So is there a nice way of handling this?

I'm thinking of trigger a learn refresh off:
timer per mob/looting level
access count of mob/looting level

The mod would then delete a number of learned loot drops from that combination and spawn/learn a few more.

Another option would be to have a separate "non-factory kill" list and a lookup would pick a random one from one of these.

commented

As a first pass for this I'm going to give the following a try:

  • drop the registry of the loot dropped on each kill
  • replace it with a registry of items that the mob has dropped
  • use the new registry to decide on the chance for each item to drop
  • factory generates loot on a per item basis

The big difference here will also be that the list of 100 sampled mob drops will go. Instead there will be an initial 100 kill sample to generate a bunch of items. Then instead of stopping after that, it will start scaling back the fake kills so it still learns but at a slower pace. This will hopefully allow the rarer items to be detected.

DemoXin on OOclan also suggested dumping the learned loot to a config file to allow modpacks to remove items that are not wanted. You could then load that config file as the learned mob drop configuration and disable the live learning. (DemoXinMC on GitHub?)

The first stage of any new way is to extend the woot command so I can see what individual loot items are dropped and not the complete table, which is #58

commented

Also need to remove the custom damage source and just go with the standard DamageSource.causePlayerDamage(FakePlayer).

This will search the FakePlayers inventory for the highest looting level equiped, which will be the looting sword. So I can throw away and custom damage source and not lose any information.

commented
commented

This is now working(?)
I now store a list of the items dropped over all the kills of that mob type/looting level.
It then calculate the percentage chance of getting each item and which stack size.
The information is stored as a json file.
The same information is shared across all instances of the mod pack - ie it is not world specific.
It is still a bit delicate, so the save/load needs some more testing.