DevOnTheRocks / RockyTweaks

A Minecraft Forge mod that adds additional functionality to other mods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Merchant.addTrade] Error on executing script: IllegalArgumentException

Krutoy242 opened this issue · comments

Calling this causing Exception:

mods.rockytweaks.Merchant.addTrade("extrautils2:red_mechanic", "red_mechanic", <minecraft:emerald>, <rftools:wire_block>, 2);

with this stack trace:

[INITIALIZATION][CLIENT][ERROR] [crafttweaker]: Error executing {[0:crafttweaker]: category\merchants.zs}: null
java.lang.IllegalArgumentException
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
	at rocks.gameonthe.rockytweaks.crafttweaker.merchant.MerchantTradeHandler.addTrade(MerchantTradeHandler.java:27)
	at rocks.gameonthe.rockytweaks.crafttweaker.merchant.MerchantTradeHandler.addTrade(MerchantTradeHandler.java:41)
	at category\Merchants.__script__(category\merchants.zs:456)
	at __ZenMain__.run(category\Merchants)
	at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:240)
	at crafttweaker.runtime.CrTTweaker.loadScript(CrTTweaker.java:105)
	at youyihj.zenutils.impl.delegate.ZenUtilsTweaker.loadScript(ZenUtilsTweaker.java:47)
	at crafttweaker.mc1120.events.CommonEventHandler.registerRecipes(CommonEventHandler.java:67)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_2000_CommonEventHandler_registerRecipes_Register.invoke(.dynamic)

I checked, <minecraft:emerald> and <rftools:wire_block> are valid, existing items.
"extrautils2:red_mechanic" and "red_mechanic" are valid profession and career names (outputted by /ct merchant careers). Also, this merchant exist in JEI https://i.imgur.com/LzUjUNV.png

So it seems like ExtraUtils registers their villagers after CraftTweaker processes scripts. The command that lists villager professions checks at runtime, well after the script has already been processed. Unfortunately, I believe that leaves me with no way to fix this issue.

The only thing I might be able to do is to update the commands to not include villagers that are registered after the scripts are processed. Due to forge and the mods involved not being updated for 1.12.2 anymore, I don't see much value in spending more time on this issue. Sorry it didn't work like it should.