-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
164aa40
commit 3cf1c84
Showing
7 changed files
with
74 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/net/morimori0317/gamemenumodoption/integration/MineTogetherIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package net.morimori0317.gamemenumodoption.integration; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraftforge.fml.ModList; | ||
import net.morimori0317.gamemenumodoption.ClientConfig; | ||
|
||
public class MineTogetherIntegration { | ||
public static boolean isCompat() { | ||
return ModList.get().isLoaded("minetogether") && ClientConfig.MineTogetherCompatibility.get(); | ||
} | ||
|
||
public static boolean isFixButtons() { | ||
return isCompat() && Minecraft.getInstance().getSingleplayerServer() != null; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/net/morimori0317/gamemenumodoption/mixin/ConnectModuleMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.morimori0317.gamemenumodoption.mixin; | ||
|
||
import dev.architectury.hooks.client.screen.ScreenAccess; | ||
import net.creeperhost.minetogether.module.connect.ConnectModule; | ||
import net.minecraft.client.gui.components.AbstractWidget; | ||
import net.minecraft.client.gui.components.Button; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import net.minecraft.client.server.IntegratedServer; | ||
import net.morimori0317.gamemenumodoption.ClientConfig; | ||
import net.morimori0317.gamemenumodoption.integration.MineTogetherIntegration; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
@Mixin(ConnectModule.class) | ||
public class ConnectModuleMixin { | ||
@Inject(method = "onScreenOpen", at = @At(value = "INVOKE", target = "Ldev/architectury/hooks/client/screen/ScreenHooks;addRenderableWidget(Lnet/minecraft/client/gui/screens/Screen;Lnet/minecraft/client/gui/components/AbstractWidget;)Lnet/minecraft/client/gui/components/AbstractWidget;", ordinal = 0), remap = false, locals = LocalCapture.CAPTURE_FAILHARD) | ||
private static void onScreenOpen(Screen screen, ScreenAccess screenAccess, CallbackInfo ci, IntegratedServer integratedServer, AbstractWidget feedBack, AbstractWidget bugs, AbstractWidget openToLan, AbstractWidget options, Button guiButton) { | ||
if (MineTogetherIntegration.isCompat() && ClientConfig.SlideUpGameMenuButtons.get()) | ||
guiButton.y -= 16; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters