Create

Create

86M Downloads

Extract an interface from KineticTileEntity

edgarogh opened this issue · 0 comments

commented

Describe the Suggestion

When developing mods on top of Create, we may want to use the rotational energy system for our blocks.

Currently, this requires extending KineticTileEntity because Create issues instanceof checks to see if blocks are kinetic blocks. The issue is that in some cases, this isn't convenient at all (existing codebase with our own BlockEntity subclass) or downright impossible (injecting rotational force compat to an existing mod using Mixin) without heavily abusing Mixin and modifying 20 different methods inside Create.

This boils down to the classic diamond / multi-inheritance problem of Java.

I'm suggesting a somewhat big change: replace all instanceof KineticTileEntity evaluations to a newly introduced interface that would have most — if not all — methods from KTE. The current KTE class can still exist for convenience, but it'd also be great if some of its methods were extracted to the interface when possible (as default methods) or had a static equivalent on KTE that takes the interface as the first parameter.


I'm 100% aware that this is a particularly big refactor and may not be in the scope of the mod. If you're still interested by any chance, I'd love to make a PR (and adapt it to your needs afterwards).

Screenshots and Videos

No response

Additional Context

No response