gliscowo / deathlog

A utility mod for keeping track of all the embarrassing times you died
https://modrinth.com/mod/deathlog
MIT License
14 stars 13 forks source link

[Suggestion] Implement an API that allows other mods to open the `DeathLogScreen` #38

Open TheCSDev opened 8 months ago

TheCSDev commented 8 months ago

Hello!
Developer of Better Statistics Screen here.

Recently, there's been interest in integrating my mod with DeathLog (Examples include: Issue 13, and recently Issue 108). While I'm eager to make this happen, the current lack of an API presents a challenge.

As such, I would like to suggest for this mod to implement some sort of reliable way for other mods to integrate this mod, such as a simple API. Here is an example of how ModMenu implements their API.

Here is an example of what you could do:

package com.glisco.deathlog.api.client;

import net.minecraft.text.Text;
import net.minecraft.client.gui.screen.Screen;

public interface DeathLogClientApi
{
    static Screen createDeathLogScreen(@Nullable Screen parent) {...}
    static Text createDeathLogButtonText() {...}
}

...kind of like how ModMenu does it for their mod. Other mod developers such as myself, could then implement support for your mod through CurseMaven and your API.

If implementing your own API isn't feasible, I'd like to present an alternative. My mod, Better Statistics Screen, features an API that allows other mods to integrate custom elements. While this would necessitate a dependency, it's a potential workaround. Although, you would have to add betterstats and tcdcommons to the Gradle proejct, and based on the issue #30, I am assuming you implementing support is likely not what you'd want.

Thank you for your time, as that's all I wanted to suggest, and have a great day!

gliscowo commented 6 months ago

Alright, well, personally I do not see any necessity for a dedicated API class or interface. What can I offer you instead is to treat DeathLogClient.openScreen(DirectDeathLogStorage, boolean) and DeathLogClient.getClientStorage() like API functions (read, I will make an effort to keep them stable and backwards-compatible).

Would that work for you? Cheers

TheCSDev commented 6 months ago

Hello, and thanks for the reply.
Sure, that can work as well. Will use that to implement support for the mod in the future then.
Thanks again, and have a great day (or night)!