Implement a way to register Fan Processing catalysts separate from Fan Processing Types
Lgmrszd opened this issue ยท 2 comments
Describe the Suggestion
This suggestion is mostly to provide an API for addon devs.
On previous versions the check was done in FanProcessing.Type.byBlock
, and other mods could easily inject their own conditions via Mixin.
Currently (0.5.1.e) the way Fan Processing Type is checked is through getAt
in "FanProcessingTypeinterface, which you cannot inject on (Mixin don't support injecting into Interfaces methods). While I did manage to make it work (by injecting into
rebuildin
AirCurrent`), it's more complicated now and I am not sure if things would not break if another addon tried to do the same simultaneously.
My suggestion is to implement a registry that allows registering Level, BlockPos -> FanProcessingType
functions, and modify FanProcessingType.getAt
such that it also checks this registry once
I've implemented this partially back in #5163 but since other parts of that PR were implemented and most things have changed, it's no longer relevant. I might try to implement that myself in the near future and suggest a PR if I get time for it.
Screenshots and Videos
No response
Additional Context
No response
Tags were added to allow controlling which blocks and fluids act as catalysts. Are you able to use these? If not, injecting into AllFanProcessingTypes$__Type#isValidAt
should work for now as well.
In my case I implemented a block that can provide different processing types, so tag cannot be applied. Your suggestion could work in most cases (if there's a block that changes to a specific processing type conditionally), but in my case I would have to inject to 4 instances of isValidAt
for each type, which is not exactly optimal.
For reference, this is the injection I was using on 0.5.1.c: https://github.com/Lgmrszd/CompressedCreativity/blob/c4c12bcb5e3e568638a0ee164d91feadd065c59d/src/main/java/com/lgmrszd/compressedcreativity/mixin/create/FanProcessingMixin.java
Edit: here's also how I am attempting to implement this now: https://github.com/Lgmrszd/CompressedCreativity/blob/3034e971e75c96997d963cf4043eb42be0382b26/src/main/java/com/lgmrszd/compressedcreativity/mixin/create/AirCurrentMixin.java
(It's a bit different because the catalyst in question is the source of AirCurrent itself, and 0.5.1.e doesn't check the source block itself (It did before). That's why this particular mixin modifies initial FanProcessingType type
assignment)