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

Hide Mod Options API Button if unused #43

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.betterthanupdates.modoptionsapi.mixin.client;

import modoptionsapi.ModOptionsAPI;
import modoptionsapi.gui.ModMenu;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -14,7 +15,8 @@
public class PauseMenuMixin extends Screen {
@Inject(method = "initVanillaScreen", at = @At("RETURN"))
private void modoptionsapi$addButton(CallbackInfo ci) {
this.buttons.add(new ButtonWidget(30, this.width / 2 - 100, this.height / 4 + 148 + -16, "Mod World Options"));
if (ModOptionsAPI.getAllMods().length > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this check into a method, but otherwise this looks good.

this.buttons.add(new ButtonWidget(30, this.width / 2 - 100, this.height / 4 + 148 + -16, "Mod World Options"));
}

@Inject(method = "buttonClicked", at = @At("RETURN"))
Expand Down