RFTools

RFTools

74M Downloads

Crafting items in the storage scanner doesn't fire ItemCraftedEvent

josephcsible opened this issue ยท 8 comments

commented

The storage scanner never fires ItemCraftedEvent for items that it crafts. This results in, for example, Integrated Dynamics' omni-directional connectors not getting assigned IDs.

commented

Why does it assign IDs on crafting? That's not really a good idea IMHO (i.e what if the item is obtained outside crafting, i.e. cheating in or perhaps as chest loot)

commented

Hmm good point, pinging @rubensworks

But in any case, when an item is crafted, shouldn't ItemCraftEvent be fired?

commented

maybe but things like that slow it down again and additionally I don't have an IInventory craft matrix to give it (of course I can make one but...)

commented

@McJty Assignment on crafting is intentional. Alternative ways to obtain an ID such as right-clicking with them in the air seems very user-unfriendly, so I'd rather not change that.

As @josephcsible has said, ItemCraftEvent should be fired in any case. I guess this would cause issues in other mods as well.

commented

What I generally do with ID's is assign them lazily. I have a static method int getId(ItemStack item) in the item class which checks if the id is present in the NBT, if not assigns a new one and otherwise returns that. All code that needs the id calls that function so as soon as it is needed it is created.

I'll add the event though

commented

That can't work quite like that in this case. Rather than these IDs being totally unique, the item is created in pairs, and both items in the pair need to have the same ID.

commented

Ah but then that should be done using a custom IRecipeFactory and using that in the json recipe. I have done similar things in some of my mods with adding NBT to destination result of a craft. I think that's nicer then using the event for that

commented

Not trigging this event makes these "crafting tables" unable to satisfy Better Questing (and likely HQM) crafting tasks.