Bug with Infinite Trading (fabric)
ConduCard opened this issue ยท 17 comments
The mod Im using is Infinte Trading for Fabric. Im using this mod for 1.17.1 and it goes well at the beginning. The problem starts when I trade a lot. The costs of the trades I trade change to 64, always. The other trades remains all good. Any idea how I could solve this?
Can you please try running the following command? /execute as @e[type=villager] run data get entity @s
Post the output here. NOTE: You may need to temporarily enable cheats (Open to LAN, then "Allow Cheats: ON").
Alternatively, run this command while you are near a villager whose prices are bumped up and locked at 64 and post the output here: /data get entity @e[type=villager,limit=1,sort=nearest]
It's because you likely either traded too much, hit the villager itself, hit a nearby villager, or killed a nearby villager. All four of which cause the villager to increase trade prices for you, with the first item being due to the demand factor, while the last three being due to negative gossip (which would also cause nearby Iron Golems to immediately become hostile).
Depending on the volume of the trade you did while the price was low, it could take anywhere from a few days to a couple months for the trade prices to go back to normal. You can try speeding it up by:
- Make sure the world is on Hard difficulty.
- Get at least five Splash Potions of Weakness and five Golden Apples.
- Zombify the villager, then cure the villager.
- Repeat step 3 four more times.
I'm sure I didn't hit them. First thing I did was step 3. The first time, it was solved, but it happened again, so I did step 3 again. This time, it didn't work. The prices stayed like that, 64 of the cost. I tried to go to a creative world and check if the issue was on survival or see if I can see any relation with the high prices, but at the moment I spawned a villager, their prices were high too. Each villager I spawned, had high prices. And it was a completely new world. So I don't really think the issue is for hitting them.
Damn, thats a lot to process. ill see what i can do. Ill inform you if I break my mind.
Can you please try running the following command?
/execute as @e[type=villager] run data get entity @s
Post the output here. NOTE: You may need to temporarily enable cheats (Open to LAN, then "Allow Cheats: ON").Alternatively, run this command while you are near a villager whose prices are bumped up and locked at 64 and post the output here:
/data get entity @e[type=villager,limit=1,sort=nearest]
Ok, Ill try it out
Im not used to commands, so i dont exactly get what "output" means. I dont know what to write there. Could you please give an example?
When you run a command such as /data get entity
, it outputs to chat and to the client-side log for your Minecraft instance.
You can either copy those lines of command output or once you are done, close the game and attach your Minecraft instance's logs/latest.log
file.
It should look something like this:
[09:39:40] [Render thread/INFO]: [CHAT] Villager has the following entity data: {Brain: {memories: {}}, HurtByTimestamp: 0, Attributes: [{Base: 0.5d, Name: "minecraft:generic.movement_speed"}, {Base: 48.0d, Modifiers: [{Amount: 8.787997047636029E-4d, Operation: 1, UUID: [I; 1007303428, 703415223, -1193238640, 2120790603], Name: "Random spawn bonus"}], Name: "minecraft:generic.follow_range"}], FoodLevel: 0b, Invulnerable: 0b, FallFlying: 0b, ForcedAge: 0, Gossips: [], PortalCooldown: 0, AbsorptionAmount: 0.0f, LastRestock: 0L, FallDistance: 0.0f, DeathTime: 0s, Xp: 0, LastGossipDecay: 5848L, HandDropChances: [0.085f, 0.085f], PersistenceRequired: 0b, UUID: [I; -1248181989, -1718074199, -1286898320, 941502520], Age: 0, Motion: [0.0d, -0.0784000015258789d, 0.0d], Health: 20.0f, LeftHanded: 0b, Air: 300s, OnGround: 1b, Rotation: [0.0f, -7.4641848f], HandItems: [{}, {}], RestocksToday: 0, ArmorDropChances: [0.085f, 0.085f, 0.085f, 0.085f], Pos: [-1.8510756185571642d, 64.0d, 169.52449086724803d], Fire: -1s, ArmorItems: [{}, {}, {}, {}], CanPickUpLoot: 1b, VillagerData: {profession: "minecraft:none", level: 1, type: "minecraft:plains"}, HurtTime: 0s, Inventory: []}
In other words, run the command, then once you're done, close the game and post the resulting latest.log
here.
It's because you likely either traded too much, hit the villager itself, hit a nearby villager, or killed a nearby villager. All four of which cause the villager to increase trade prices for you, with the first item being due to the demand factor, while the last three being due to negative gossip (which would also cause nearby Iron Golems to immediately become hostile).
Depending on the volume of the trade you did while the price was low, it could take anywhere from a few days to a couple months for the trade prices to go back to normal. You can try speeding it up by:
- Make sure the world is on Hard difficulty.
- Get at least five Splash Potions of Weakness and five Golden Apples.
- Zombify the villager, then cure the villager.
- Repeat step 3 four more times.
If you are using a launcher such as MultiMC or ATLauncher, you may be able to find a log upload button. Click that and post the resulting link.
Otherwise, try the following steps:
- Do whatever you need to do to reproduce the bug in the current game session.
- Close the game, so that it will finish outputting the latest.log file.
- Find that latest.log file (in the
.minecraft/logs
folder), copy it, and paste it here so that it will be attached here.
I managed to apply the NBT you posted (less the Pos
and UUID
) to a villager on my vanilla Minecraft instance:
Villager 1:
Based on the NBT posted above, the values of Demand
got set almost immediately to -Integer.MAX_VALUE
for certain trades, but the mod's code should be fixed to keep the value of Demand
at -Integer.MAX_VALUE
or 0 for all trades every time you trade with a villager.
According to the NBT, it appears that you must have traded too much (over 1,156 sets of books sold at once!) with the same villager. To resolve this inflated demand factor, do any of the following
- Let the villager work for a few in-game days, than check up on its trades. You may need to repeat this for a few dozen to a couple hundred in-game days.
- Be nearest to the affected villager, then run the following data commands in succession (you can replace the zero with any negative number if you want):
data modify entity @e[type=minecraft:villager,limit=1,sort=nearest] Offers.Recipes[0].demand set value 0
data modify entity @e[type=minecraft:villager,limit=1,sort=nearest] Offers.Recipes[1].demand set value 0
data modify entity @e[type=minecraft:villager,limit=1,sort=nearest] Offers.Recipes[2].demand set value 0
data modify entity @e[type=minecraft:villager,limit=1,sort=nearest] Offers.Recipes[3].demand set value 0
...
data modify entity @e[type=minecraft:villager,limit=1,sort=nearest] Offers.Recipes[9].demand set value 0
Okay, thanks. Ill try it out. Definitely not doing the first one. Ill try the second one. Thanks.
Do I need to run the commands you told me before?
I just realized something. The bug only happens if I too many books from a librarian.
Okay, i found the output. Here they are. I trade with 2 villagers so Ill post from both. Both have the same issue.
Villager 1:
[10:29:27] [Render thread/INFO]: [CHAT] Ethelred Chasten the Librarian has the following entity data: {Brain: {memories: {"minecraft:home": {value: {pos: [I; -416, 57, 164], dimension: "minecraft:overworld"}}, "minecraft:last_slept": {value: 1164942L}, "minecraft:last_woken": {value: 1166974L}, "minecraft:last_worked_at_poi": {value: 1173541L}, "minecraft:job_site": {value: {pos: [I; -416, 57, 165], dimension: "minecraft:overworld"}}}}, HurtByTimestamp: 0, Attributes: [{Base: 0.5d, Name: "minecraft:generic.movement_speed"}, {Base: 48.0d, Modifiers: [{Amount: 0.005517255035778725d, Operation: 1, UUID: [I; -642655928, 1482574349, -1278787925, -1613577262], Name: "Random spawn bonus"}], Name: "minecraft:generic.follow_range"}], FoodLevel: 0b, Invulnerable: 0b, FallFlying: 0b, ForcedAge: 0, Gossips: [{Target: [I; -1092805066, -1591982521, -1350548852, -636303985], Type: "trading", Value: 18}, {Target: [I; -1092805066, -1591982521, -1350548852, -636303985], Type: "minor_positive", Value: 24}, {Target: [I; -1092805066, -1591982521, -1350548852, -636303985], Type: "major_positive", Value: 20}], PortalCooldown: 0, AbsorptionAmount: 0.0f, LastRestock: 1172598L, FallDistance: 0.0f, cpaCooldown: 0, DeathTime: 0s, Xp: 2017, LastGossipDecay: 1166592L, HandDropChances: [0.0f, 0.085f], PersistenceRequired: 0b, UUID: [I; 1990552122, 1347635985, -1928161924, 1841263965], Age: 0, Motion: [0.0d, -0.0784000015258789d, 0.0d], cpadidTP: 0b, Health: 20.0f, LeftHanded: 0b, Air: 300s, OnGround: 1b, Offers: {Recipes: [{maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:paper", Count: 24b}, sell: {id: "minecraft:emerald", Count: 1b}, xp: 2, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 4, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 9b}, sell: {id: "minecraft:bookshelf", Count: 1b}, xp: 1, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 134, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:book", Count: 4b}, sell: {id: "minecraft:emerald", Count: 1b}, xp: 10, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 392, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:book", Count: 1b}, buy: {id: "minecraft:emerald", Count: 30b}, sell: {id: "minecraft:enchanted_book", Count: 1b, tag: {StoredEnchantments: [{lvl: 1s, id: "minecraft:binding_curse"}]}}, xp: 5, uses: 0, priceMultiplier: 0.2f, specialPrice: 0, demand: 4, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:ink_sac", Count: 5b}, sell: {id: "minecraft:emerald", Count: 1b}, xp: 20, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 2, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 1b}, sell: {id: "minecraft:glass", Count: 4b}, xp: 10, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 2, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 5b}, sell: {id: "minecraft:clock", Count: 1b}, xp: 15, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 2, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 4b}, sell: {id: "minecraft:compass", Count: 1b}, xp: 15, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 2, rewardExp: 1b}]}, Rotation: [354.3751f, 0.0f], HandItems: [{id: "minecraft:enchanted_book", Count: 1b, tag: {StoredEnchantments: [{lvl: 1s, id: "minecraft:binding_curse"}]}}, {}], RestocksToday: 0, ArmorDropChances: [0.085f, 0.085f, 0.085f, 0.085f], CustomName: '{"color":"white","text":"Ethelred Chasten the Librarian"}', Pos: [-415.5469996849599d, 57.875d, 165.15923855958496d], Fire: -1s, ArmorItems: [{}, {}, {}, {}], CanPickUpLoot: 1b, VillagerData: {profession: "minecraft:librarian", level: 4, type: "minecraft:plains"}, HurtTime: 0s, Inventory: []}
Villager 2:
[10:29:27] [Render thread/INFO]: [CHAT] Lombard Bunnell the Librarian has the following entity data: {Brain: {memories: {"minecraft:home": {value: {pos: [I; -416, 57, 168], dimension: "minecraft:overworld"}}, "minecraft:last_slept": {value: 1164930L}, "minecraft:last_woken": {value: 1166974L}, "minecraft:last_worked_at_poi": {value: 1173535L}, "minecraft:job_site": {value: {pos: [I; -416, 57, 167], dimension: "minecraft:overworld"}}}}, HurtByTimestamp: 0, Attributes: [{Base: 0.5d, Name: "minecraft:generic.movement_speed"}, {Base: 48.0d, Modifiers: [{Amount: -0.05827543379058891d, Operation: 1, UUID: [I; 626895319, -2078260685, -1115440635, 968969668], Name: "Random spawn bonus"}], Name: "minecraft:generic.follow_range"}], FoodLevel: 0b, Invulnerable: 0b, FallFlying: 0b, ForcedAge: 0, Gossips: [{Target: [I; -1092805066, -1591982521, -1350548852, -636303985], Type: "trading", Value: 25}, {Target: [I; -1092805066, -1591982521, -1350548852, -636303985], Type: "minor_positive", Value: 24}, {Target: [I; -1092805066, -1591982521, -1350548852, -636303985], Type: "major_positive", Value: 20}], PortalCooldown: 0, AbsorptionAmount: 0.0f, LastRestock: 1172890L, FallDistance: 0.0f, cpaCooldown: 0, DeathTime: 0s, Xp: 6394, LastGossipDecay: 1167254L, HandDropChances: [0.0f, 0.085f], PersistenceRequired: 0b, UUID: [I; 1537934965, 773736107, -1769935410, -703589662], Age: 0, Motion: [0.0d, -0.0784000015258789d, 0.0d], cpadidTP: 0b, Health: 20.0f, LeftHanded: 0b, Air: 300s, OnGround: 1b, Offers: {Recipes: [{maxUses: 2147483647, buyB: {id: "minecraft:book", Count: 1b}, buy: {id: "minecraft:emerald", Count: 23b}, sell: {id: "minecraft:enchanted_book", Count: 1b, tag: {StoredEnchantments: [{lvl: 2s, id: "gobber2:smithblade"}]}}, xp: 1, uses: 0, priceMultiplier: 0.2f, specialPrice: 0, demand: 6, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 9b}, sell: {id: "minecraft:bookshelf", Count: 1b}, xp: 1, uses: 1, priceMultiplier: 0.05f, specialPrice: 0, demand: 966, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:book", Count: 4b}, sell: {id: "minecraft:emerald", Count: 1b}, xp: 10, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 1156, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 1b}, sell: {id: "minecraft:lantern", Count: 1b}, xp: 5, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 4, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:book", Count: 1b}, buy: {id: "minecraft:emerald", Count: 8b}, sell: {id: "minecraft:enchanted_book", Count: 1b, tag: {StoredEnchantments: [{lvl: 1s, id: "minecraft:bane_of_arthropods"}]}}, xp: 10, uses: 0, priceMultiplier: 0.2f, specialPrice: 0, demand: 2, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 1b}, sell: {id: "minecraft:glass", Count: 4b}, xp: 10, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 2, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:writable_book", Count: 2b}, sell: {id: "minecraft:emerald", Count: 1b}, xp: 30, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: -2147483647, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 5b}, sell: {id: "minecraft:clock", Count: 1b}, xp: 15, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: -2147483647, rewardExp: 1b}, {maxUses: 2147483647, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 20b}, sell: {id: "minecraft:name_tag", Count: 1b}, xp: 30, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: -2147483647, rewardExp: 1b}]}, Rotation: [84.89441f, 0.0f], HandItems: [{id: "minecraft:name_tag", Count: 1b}, {}], RestocksToday: 2, ArmorDropChances: [0.085f, 0.085f, 0.085f, 0.085f], CustomName: '{"color":"white","text":"Lombard Bunnell the Librarian"}', Pos: [-415.151477542211d, 57.875d, 167.42115959191008d], Fire: -1s, ArmorItems: [{}, {}, {}, {}], CanPickUpLoot: 1b, VillagerData: {profession: "minecraft:librarian", level: 5, type: "minecraft:plains"}, HurtTime: 0s, Inventory: []}
If I missed a log, please let me know. I havent close the latest log file yet, so it still shows of the last game.
I've created a datapack to automate fixing inflation as a workaround: Villager Demand Fix.zip
- Download the attached zip file and put it into your world's
datapacks
folder. - Run
/reload
. - Run
/function villager_demand_fix:fix_villager
to fix inflation in the nearest villager to you. execute as @e[type=minecraft:villager] run function villager_demand_fix:fix_villager
fixes inflation in all loaded villagers.