Signal a custom event when the player completes a craft
FranckMartinHebert opened this issue Β· 13 comments
I think what he is either asking for
An event trigger that happens after a crafting,
my guess would be the usage of that the usage for that would be for Advancements or Mod Integration
Or
The Ability to trigger events after crafting
I think what he is either asking for
An event trigger that happens after a crafting,
my guess would be the usage of that the usage for that would be for Advancements or Mod Integration
Exactly, I would like to bring a notion of skill in the gameplay, based on crafting.
I really like your idea of ββcraft table, it fills perfectly what I would like to implement.
[google traduction]
Please correct me if I'm wrong.
You would like an event to be fired when a craft in a worktable is completed. Something like ArtisanWorktableOnCraftEvent
?
You would then hook this event with your mod.
Do I understand correctly?
I can't use ItemCraftedEvent
because the mod doesn't use an IInventory
crafting matrix.
I can do any of the following:
- signal a custom event that extends
PlayerEvent
when the player completes a craft - add new ZenScript recipe builder methods that would allow crafting a recipe to:
- add / remove stages via GameStages mod
- trigger advancements
Which would you find the most useful for what you want to do?
@FranckMartinHebert
Without more details about your specific use case, I'm doing a blind implementation here.
Can you please review the event class and tell me if this will satisfy your use case.
The event AWItemCraftEvent.Post
is fired only on the server, can't be cancelled, is immutable, and exposes:
- the table type as
EnumType
- the table tier as
EnumTier
- a copy of the item stack produced by the craft operation
Again, this event is immutable, meaning that any alterations to the exposed ItemStack
will not affect the outcome of the craft.
That would be great.
If you can do it it's fantastic but I do not want to bother you too much.
Thank you again for your kindness
Available in alpha 1.12.2-1.15.25-21-g825ea34
Will be available in beta 1.12.2-1.16.x
It's perfect. Thank you very much.
I would integrate it as soon as possible. ^^
Just a little question : Does item stack contains extra loot ?
The ItemStack
contains the final adjusted main output of the recipe after weight calculations.
I can add a List<ItemStack>
that would contain copies of the secondary chance outputs if there are any.