Slimefun4 icon indicating copy to clipboard operation
Slimefun4 copied to clipboard

Add MultiBlockCraftEvent

Open char3210 opened this issue 2 years ago • 1 comments

Description

This allows addons to listen for MultiBlockMachine crafts and cancel them if wanted. It's mainly for my advancements addon, but it can definitely be useful in other addons as well.

Proposed changes

Create MultiBlockCraftEvent, which fires whenever a player crafts an item using a multiblock machine. Call the event whenever a MultiBlockMachine crafts, and cancel the craft if needed.

Related Issues (if applicable)

N/A

Checklist

  • [x] I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • [ ] I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • [x] I followed the existing code standards and didn't mess up the formatting.
  • [x] I did my best to add documentation to any public classes or methods I added.
  • [x] I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • [ ] I added sufficient Unit Tests to cover my code.

char3210 avatar Jan 24 '22 04:01 char3210

now this is useful for other addons

FN-FAL113 avatar Jan 24 '22 07:01 FN-FAL113

If #3269 get's merged then this PR will have to get updated so I'm going to wait for that 👍

why is that? is it just a merge conflict or something, i don't see how adding new recipes to existing multiblocks would affect this

char3210 avatar Jun 09 '23 15:06 char3210

If #3269 get's merged then this PR will have to get updated so I'm going to wait for that 👍

why is that? is it just a merge conflict or something, i don't see how adding new recipes to existing multiblocks would affect this

The logic you use when calling the event. If the PR in question gets merged there A. Will be merge conflicts but B. The input materials are stored in a set and are not guaranteed to be one or the other so you will have to change the logic you use. Like that ternary operation wouldn't be accurate.

JustAHuman-xD avatar Jun 09 '23 17:06 JustAHuman-xD

Final thing is can we add inputs to this aswell? Instead of just output

JustAHuman-xD avatar Jun 09 '23 17:06 JustAHuman-xD

Is this still being worked on. Would be a nice event to have. Added label stale

J3fftw1 avatar Jul 29 '23 17:07 J3fftw1

we should close this

svr333 avatar Aug 05 '23 12:08 svr333

Closed in favor of #3928

JustAHuman-xD avatar Aug 05 '23 16:08 JustAHuman-xD