#Right Click Harvest Help
13 messages · Page 1 of 1 (latest)
Fabric API has events for interaction
How would I go about implementing that?
Use the register method on the event to register a lambda, class or other object implementing the interface UseBlockCallback
The event itself can also be found in UseBlockCallback
Ah, yeah. I understand, so I'm registering an event that will listen for the interface and I can shove the logic in that.
Where would you recommend I register the event? Should I create a new class for it?
Depending on the scale of your mod, you can do it in modinit or create a new class
Personally, I like creating modularized handler classes, but that's just my opinion
It tends to make you think about what it's supposed to do If you have to name it
Gotcha
So I've made a class called "HarvestEvent" and have this setup
I guess I'd have to have it destroy the crop block and then automatically plant it back, how would I go about doing that?
I would take a look at the implementation for that event, the class the event is trigger from by mixin contains a lot of context for that