Skip to content
Merged
Show file tree
Hide file tree
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,7 +1,9 @@
package com.lambda.client.mixin.client.gui;

import com.lambda.client.LambdaMod;
import com.lambda.client.gui.mc.LambdaGuiIncompat;
import com.lambda.client.module.modules.client.MenuShader;
import com.lambda.client.util.KamiCheck;
import com.lambda.client.util.WebUtils;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiMainMenu;
Expand All @@ -27,6 +29,10 @@ public abstract class MixinGuiMainMenu extends GuiScreen {

@Inject(method = "drawScreen", at = @At("RETURN"))
public void drawScreen$Inject$RETURN(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
if (KamiCheck.INSTANCE.isKami() && !KamiCheck.INSTANCE.getDidDisplayWarning()) {
KamiCheck.INSTANCE.setDidDisplayWarning(true);
mc.displayGuiScreen(new LambdaGuiIncompat());
}
FontRenderer fr = fontRenderer;
String slogan = TextFormatting.WHITE + LambdaMod.NAME + " " + TextFormatting.GRAY + LambdaMod.VERSION;
String version;
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/com/lambda/client/LambdaMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.lambda.client
import com.lambda.client.event.ForgeEventProcessor
import com.lambda.client.gui.clickgui.LambdaClickGui
import com.lambda.client.util.ConfigUtils
import com.lambda.client.util.KamiCheck
import com.lambda.client.util.WebUtils
import com.lambda.client.util.threads.BackgroundScope
import net.minecraftforge.common.MinecraftForge
Expand Down Expand Up @@ -75,6 +76,8 @@ class LambdaMod {
WebUtils.updateCheck()
LambdaClickGui.populateRemotePlugins()

KamiCheck.runCheck()

LOG.info("$NAME initialized!")
}

Expand Down
38 changes: 38 additions & 0 deletions src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiIncompat.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.lambda.client.gui.mc

import net.minecraft.client.gui.GuiButton
import net.minecraft.client.gui.GuiMainMenu
import net.minecraft.client.gui.GuiOptionButton
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.resources.I18n

class LambdaGuiIncompat : GuiScreen() {

override fun initGui() {
buttonList.clear()
// I used the minecraft "Out of Memory" class as a reference, turns out it has exactly the buttons I need, with internationalization support too
buttonList.add(GuiOptionButton(0, width / 2 - 155, height / 4 + 120, I18n.format("gui.toTitle", *arrayOfNulls(0))))
buttonList.add(GuiOptionButton(1, width / 2 - 155 + 160, height / 4 + 120, I18n.format("menu.quit", *arrayOfNulls(0))))
}

override fun actionPerformed(button: GuiButton) {
if (button.id == 0) {
mc.displayGuiScreen(GuiMainMenu())
} else if (button.id == 1) {
mc.shutdown()
}
}

override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) {
drawDefaultBackground()
drawCenteredString(fontRenderer, "Found KAMI Blue!", width / 2, height / 4 - 60 + 20, 16777215)
drawString(fontRenderer, "It appears you are using KAMI Blue alongside Lambda Client.", width / 2 - 140, height / 4 - 60 + 60 + 0, 10526880)
drawString(fontRenderer, "Lambda Client is a continued version of KAMI Blue,", width / 2 - 140, height / 4 - 60 + 60 + 18, 10526880)
drawString(fontRenderer, "and is not compatible as a result.", width / 2 - 140, height / 4 - 60 + 60 + 27, 10526880)
drawString(fontRenderer, "It is not recommended to use both clients", width / 2 - 140, height / 4 - 60 + 60 + 45, 10526880)
drawString(fontRenderer, "together, since many modules will override each other.", width / 2 - 140, height / 4 - 60 + 60 + 54, 10526880)
drawString(fontRenderer, "You may continue, but it may cause serious issues,", width / 2 - 140, height / 4 - 60 + 60 + 63, 10526880)
drawString(fontRenderer, "and support will not be provided to dual users.", width / 2 - 140, height / 4 - 60 + 60 + 72, 10526880)
super.drawScreen(mouseX, mouseY, partialTicks)
}
}
16 changes: 16 additions & 0 deletions src/main/kotlin/com/lambda/client/util/KamiCheck.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.lambda.client.util

import com.lambda.client.LambdaMod
import java.net.URL

object KamiCheck {
var isKami: Boolean = false
var didDisplayWarning: Boolean = false
fun runCheck() {
val kamiCheckList: List<URL> = this.javaClass.classLoader.getResources("org/kamiblue/client/KamiMod.class").toList()
if (kamiCheckList.isNotEmpty()) {
LambdaMod.LOG.error("KAMI Blue detected!")
isKami = true
}
}
}