CraftTweaker

CraftTweaker

151M Downloads

The map as IIngredient[IItemStack] will be changed to string when tweak botanina's Elven trade.

854342681 opened this issue ยท 1 comments

commented

Issue description

I try to traverse a map as IIngredient[IItemStack] for tweak botanina's Elven trade, the format is ElvenTrade.addRecipe(name as string, outputs as IItemStack[], inputs as IIngredient[]) as void,and the IIngredient will be changed to string.

Steps to reproduce

  1. creating a map as IIngredient[IItemStack].
  2. Traversing the map for Elven trade.

Script used

https://paste.ubuntu.com/p/GFYMQ22d4R/

The crafttweaker.log file

https://paste.ubuntu.com/p/r7d4yQk7fW/

Minecraft version

1.16

Forge version

36.2.8

CraftTweaker version

7.1.2.455

Other relevant information

Changing [inp]to [inp as IIngredient] (in line 166)could be solve this problem.

The latest.log file

https://paste.ubuntu.com/p/MxF8j2XsGX/

commented

You are casting your map incorrectly, you need to change:

val trade as IIngredient[IItemStack] = {
    <item:emendatusenigmatica:tin_ingot>:<item:contenttweaker:tin_paper>,
    <item:emendatusenigmatica:copper_ingot>:<item:contenttweaker:copper_paper>,
    <item:emendatusenigmatica:aluminum_ingot>:<item:contenttweaker:aluminum_paper>,
    <item:emendatusenigmatica:lead_ingot>:<item:contenttweaker:lead_paper>,
    <item:emendatusenigmatica:zinc_ingot>:<item:contenttweaker:zinc_paper>,
    <item:emendatusenigmatica:nickel_ingot>:<item:contenttweaker:nickel_paper>,
    <item:emendatusenigmatica:osmium_ingot>:<item:contenttweaker:osmium_paper>,
    <item:emendatusenigmatica:silver_ingot>:<item:contenttweaker:silver_paper>,
    <item:emendatusenigmatica:uranium_ingot>:<item:contenttweaker:uranium_paper>,
    <item:minecraft:iron_ingot>:<item:contenttweaker:iron_paper>,
    <item:minecraft:gold_ingot>:<item:contenttweaker:gold_paper>
};

to:

val trade = {
    <item:emendatusenigmatica:tin_ingot>:<item:contenttweaker:tin_paper>,
    <item:emendatusenigmatica:copper_ingot>:<item:contenttweaker:copper_paper>,
    <item:emendatusenigmatica:aluminum_ingot>:<item:contenttweaker:aluminum_paper>,
    <item:emendatusenigmatica:lead_ingot>:<item:contenttweaker:lead_paper>,
    <item:emendatusenigmatica:zinc_ingot>:<item:contenttweaker:zinc_paper>,
    <item:emendatusenigmatica:nickel_ingot>:<item:contenttweaker:nickel_paper>,
    <item:emendatusenigmatica:osmium_ingot>:<item:contenttweaker:osmium_paper>,
    <item:emendatusenigmatica:silver_ingot>:<item:contenttweaker:silver_paper>,
    <item:emendatusenigmatica:uranium_ingot>:<item:contenttweaker:uranium_paper>,
    <item:minecraft:iron_ingot>:<item:contenttweaker:iron_paper>,
    <item:minecraft:gold_ingot>:<item:contenttweaker:gold_paper>
} as IIngredient[IItemStack];```
or else it won't have the correct type.

You should do this to all of your maps