Item Stages

Item Stages

20M Downloads

Item stages not working correctly with .withTag (or possibly just with Mekanism)

Golrith opened this issue ยท 3 comments

commented

When assigning stages to items that use the .withTag but the same ID+Meta, the .withTag appears to be ignored. I've noticed this behavior on Mekanism items.

For example, Mekanism cables:
mods.ItemStages.addItemStage("L002", <mekanism:transmitter:1>.withTag({tier: 0})); mods.ItemStages.addItemStage("XXMek", <mekanism:transmitter:1>.withTag({tier: 3}));

The tier 0 item is getting assigned the XXMek stage too,

I'm also using a mod called TechGuns that makes use of .withTag but I've not seen any issues there. So it seems like there's some weird interaction between Mekanism and Item Stages.

commented

Having done some more investigation the solar panel issue is my error and has been resolved.

But, with different Item Stages set on the various mekanism:transmitter using the withtag tiering causes the tags to "cycle" every game load. Normally the with tag gives info such as contents, ammo level, etc, etc, but Mekanism is using it to define totally different items which I believe ItemStages does not account for as that's not the expected usage.

commented

ItemStages definitely does work for multiple variants of the same item. The issue is that you need to define the NBT tag correctly for it to work. Here is an example of how you can hide two variants of the potion item separately.

mods.ItemStages.addItemStage("one", <minecraft:potion>.withTag({Potion: "minecraft:strong_harming"}));
mods.ItemStages.addItemStage("two", <minecraft:potion>.withTag({Potion: "minecraft:strong_healing"}));

NBT in ItemStages will also match partial NBT tags. For example this one will hide all level 5 enchantment books.

mods.ItemStages.addItemStage("one", <minecraft:enchanted_book>.withTag({StoredEnchantments: [{lvl: 5 as short}]}));
commented

That's the weird thing. I've got lots of .withTags items staged just fine, but on the Mekanism Transmitter items every time the game is reloaded, the stage moves between items.

I'm creatively spawning the item in, and then using /ct hand to get the item ID + tag which seems to be getting everything fine.

Let me triple check everything again in my scripts (I'm doing a research tree with questbook and item stages, so as you can imagine, it's quite big!)

Edit:
I've confirmed all my scripts are correct, with only one change made, I added :0 on the items with no meta. This should make no difference, but I think it has helped, a little.

All the basic tier items (Tier 0 tag) are being assigned stage L002, but only one of the transmitters in this tier should have this stage. All the rest should be L022.
As you can see from my script searches:
`
C:\Users\Stuart\Documents\Curse\Minecraft\Instances\Manufactio\scripts\research.zs (5 hits)

Line 267: #L022 - Logistics 3

Line 268: mods.ItemStages.addItemStage("L022", <mekanism:transmitter:0>.withTag({tier: 0}));

Line 269: mods.ItemStages.addItemStage("L022", <mekanism:transmitter:2>.withTag({tier: 0}));

Line 270: mods.ItemStages.addItemStage("L022", <mekanism:transmitter:3>.withTag({tier: 0}));

Line 271: mods.ItemStages.addItemStage("L022", <mekanism:transmitter:6>.withTag({tier: 0}));

Search "L002" (6 hits in 1 file)

C:\Users\Stuart\Documents\Curse\Minecraft\Instances\Manufactio\scripts\research.zs (6 hits)

Line 220: #L002 - Fluid Handling

Line 221: mods.multiblockstages.IEMultiBlockStages.addStage("L002", "IE:SheetmetalTank");

Line 222: mods.ItemStages.addItemStage("L002", <mekanism:machineblock2:11>.withTag({tier: 0, mekData: {}}));

Line 223: mods.ItemStages.addItemStage("L002", <forestry:can>);

Line 224: mods.ItemStages.addItemStage("L002", <mekanism:transmitter:1>.withTag({tier: 0}));

Line 225: mods.ItemStages.addItemStage("L002", <immersiveengineering:wooden_device0:7>);

`

Now, here's an oddity. I forced unlocked L002, and JEI only showed me the one correct pipe as per the script. All of this tier in a chest reports they need L002.
I then force unlocked L022, and all the other pipes in that tier show up in JEI.

I reset the stages, this time force unlocked L022 first. The set excluding the L002 pipe showed, but JEI was still showing them as unfamilar items with L002 requirement.

From this, I think it's more of a JEI issue and it's interpretation of the tags, and ItemStages is working perfectly. So easy to get confused as to what is going on with unusual errors!