Easy Villagers

Easy Villagers

28M Downloads

Villager's prices set to max value due to restocking, demand, and integer limit underflow

t0rtureddrag0n opened this issue ยท 7 comments

commented

Bug description

After converting a villager and putting them in a trader, his demand value will slowly go down over time due to auto-restocking. eventually, their demand value will go so low that it causes underflow. This process is faster with a higher maxUses value and shorter min and max restock time in the configs. (I got this bug while playing on the latest version of All The Mods 9) Also picking up and putting a villager down or back into the trader randomizes this.

Minecraft version

1.20.1

Mod version

1.20.1-1.1.4

Mod loader and version

Forge 47.2.20

Steps to reproduce

  1. set a villager's maxUses value to a high number to replicate infinite trades/stock using commands. Some mods and datapacks already do this to all villagers.
  2. in the configs for easyvillagers set the trader restock time min to 1 and max to 2 (or any other small number).
  3. convert a villager or set the villager's priceMultiplier to 0.05f with commands.
  4. wait until he restocks a couple of times and his prices will change to the max value if his demand exceeds a specific value (I could not find this value but I don't think it is the normal integer limit value that villagers have)
  5. right click on the trader

Expected behavior

a trade that has had its cost lowered to 1 with converting changes to become 64. trade will also slowly go down to 0 and back down again till it hits the integer floor and underflows back to max value. Vanilla won't let this happen by setting the value back to 0 when it reaches either 2147483648 or -2147483648. This happens with all values of the villager mob but not the villager inside the trader.

Log files

https://gist.github.com/t0rtureddrag0n/c3bc32d1d532553246dbdbecec83ad19

Screenshots

Screenshot (7)
Screenshot (8)

commented

I am not able to reproduce this issue.
I created a villager with this command:
/summon villager ~ ~1 ~ {VillagerData:{profession:fisherman,level:2,type:plains},PersistenceRequired:1,Offers:{Recipes:[{buy:{id:coal,Count:1},sell:{id:emerald,Count:1},rewardExp:0b,priceMultiplier:0.05f,maxUses:9999999}]}}

And the trade price does not increase after thousands of trades.

commented
commented

I exactly replicated what you did in the video and it works perfectly fine.

commented

Did u change the restock speed in the configs, because that speeds up the bug significantly but is still able to happen without doing that.

commented

Yes. Did you try if this happens with just the mod installed?

commented

Yeah tried it on the latest version on 1.20.1 with fresh install only easyvillagers

commented

I'm unable to reproduce it then, sorry.