[HELP] Refactoring loot.zs from old `LootTweaker-0.3.0+MC1.12.2.jar` to new `LootTweaker-0.3.0+oldparsing-MC1.12.2.jar` release
ubergarm opened this issue ยท 2 comments
I just updated to the latest LootTweaker-0.3.0+oldparsing-MC1.12.2.jar
as the previous version LootTweaker-0.3.0+MC1.12.2.jar
was archived.
However, looks like I need to refactor my mobdrops.zs
loottweaker scripts as they are all throwing an error now. My question is, how can I refactor this bit of code to work with the new version?
Code that used to work:
import loottweaker.LootTweaker;
import loottweaker.vanilla.loot.LootTable;
import loottweaker.vanilla.loot.LootPool;
import loottweaker.vanilla.loot.Conditions;
import loottweaker.vanilla.loot.Functions;
## minecraft:zombie
## get existing loot table for a mob with existing table
val zombieTable = LootTweaker.getTable("minecraft:entities/zombie");
## inject additional custom pool
val zombiePool = zombieTable.addPool("RottenEconomy", 1, 2, 1, 2);
## add drops for when killed by player
zombiePool.addItemEntry(<minecraft:rotten_flesh>, 10, 1,
[Functions.setCount(0,3), Functions.lootingEnchantBonus(1, 2, 3)],
[Conditions.killedByPlayer()]
);
Error that I get when running /ct syntax
ERROR: loottweaker/mobdrops.zs:13 > 2 methods available but none matches the parameters (ZenTypeNative: crafttweaker.item.IItemStack, int, int, any[], any[])
This is usually an error in your script, not in the mod
addItemEntry(ZenTypeNative: crafttweaker.item.IItemStack, int, int, Optional string)
addItemEntry(ZenTypeNative: crafttweaker.item.IItemStack, int, Optional string)
Both the old parsing documentation which the changelog says to use and the latest documentation (?which i guess is actually old now?) seem to suggest there are more than 2 methods available for addItemEntry
but /ct syntax
doesn't show them??
Thanks for the help. Let me know if I should just keep using the old JAR file despite it being archived? Maybe I'm just confused!? Maybe this note in the changelog means something that I don't understand: suffixless methods do not have variants that accept functions and/or conditions.
?
Versions
md5sum | Filename | Version |
---|---|---|
76e02991f8938d35057040d9d0c124d8 |
LootTweaker-0.3.0+MC1.12.2.jar |
"old"/"archived" |
12c8ee3e9cbc853002010cf9a2e62256 |
LootTweaker-0.3.0+oldparsing-MC1.12.2.jar |
"new"/"latest" |
02fcc447bb8938e5214292e4d36ec949 |
forge-1.12.2-14.23.5.2855.jar |
forge |
there are more than 2 methods available for
addItemEntry
but /ct syntax doesn't show them??
There aren't, look at the names. For 0.3.0-oldparsing there are exactly 2 methods named addItemEntry
. The method you linked is addItemEntryHelper
the latest documentation (?which i guess is actually old now?)
The changelog for 0.3.0-oldparsing links to separate docs for a reason. Why are you looking at the other docs?
Let me know if I should just keep using the old JAR file despite it being archived?
Not a good idea. I don't archive versions unless they're badly broken in some way.
However if all goes well 0.3.1 should be out around this weekend with a fixed new parser. It'll be compatible with 0.3.0, unlike 0.3.0-oldparsing, which was a quick and temporary workaround for an issue that had me stumped. 0.2.0 and 0.3.0-oldparsing scripts will work in 0.3.1, but deprecation warnings will be generated if some methods are used.