Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom energy types on SimpleEnergyItem #30

Open
Luligabi1 opened this issue Jan 30, 2024 · 1 comment
Open

Custom energy types on SimpleEnergyItem #30

Luligabi1 opened this issue Jan 30, 2024 · 1 comment

Comments

@Luligabi1
Copy link

Luligabi1 commented Jan 30, 2024

Hello,

I was wondering if there's a way to have SimpleEnergyItems be unregistered from the "default" energy type? Currently, I have two energy items that are extended from a class that implements SimpleEnergyItem (and other behaviors that are not relevant to the issue).
All is dandy for the first item, since it is meant to use the default energy type. However, for the second, it's meant to use a custom energy type; I registered it manually to it - however, it's still registered to the default type (as all items that implement SimpleEnergyItem do), essentially allowing unintended 1:1 energy transferral.

Even if unregistering is an option, It'd be nice to have custom energy types support, since I wouldn't consider having what's essentially the same logic registered to other id enough to deem it complex/advanced to warrant having to use EnergyStorage.ITEM directly.

EDIT: Not long after I posted this, I found out I just had to register an empty EnergyStorage for the default type and it'd work 😅 Hopefully the request for built-in support, thus requiring no additional setup, is worth keeping the issue open.

@Technici4n
Copy link
Collaborator

I think you should make your own interface and implement support for your API Lookup accordingly. You can use createStorage as follows: https://github.com/TechReborn/Energy/blob/master/src/main/java/team/reborn/energy/impl/EnergyImpl.java#L13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants