diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 32 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/WarningGui.java | 61 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/WarningGuiRedirect.java | 28 |
3 files changed, 118 insertions, 3 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index b7c853d..1023cdb 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -1,5 +1,6 @@ package me.Danker; +import akka.event.Logging; import com.google.gson.JsonObject; import me.Danker.commands.*; import me.Danker.gui.*; @@ -9,9 +10,7 @@ import me.Danker.utils.Utils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiChat; -import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.*; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; @@ -68,6 +67,7 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import java.awt.*; +import java.net.URLDecoder; import java.text.NumberFormat; import java.util.List; import java.util.*; @@ -98,6 +98,8 @@ public class DankersSkyblockMod static double lastMaddoxTime = 0; static KeyBinding[] keyBindings = new KeyBinding[2]; static boolean usingLabymod = false; + static boolean usingOAM = false; + static boolean OAMWarning = false; public static String guiToOpen = null; static boolean foundLivid = false; static Entity livid = null; @@ -305,9 +307,33 @@ public class DankersSkyblockMod @EventHandler public void postInit(final FMLPostInitializationEvent event) { + Package[] packages = Package.getPackages(); + for(Package p : packages){ + if(p.getName().startsWith("com.spiderfrog.gadgets")){ + usingOAM = true; + break; + } + } + System.out.println("OAM detection: " + usingOAM); + + usingLabymod = Loader.isModLoaded("labymod"); System.out.println("LabyMod detection: " + usingLabymod); } + + @SubscribeEvent + public void onGuiOpenEvent(GuiOpenEvent event){ + if(event.gui instanceof GuiMainMenu && usingOAM && !OAMWarning){ + System.out.println("Gui opened: Instance of GuiMainMenu."); + if(!(event.gui instanceof WarningGui)){ + System.out.println("No instance of WarningGui"); + event.gui = new WarningGuiRedirect(new WarningGui()); + OAMWarning = true; + }else{ + System.out.println("Instance of WarningGui"); + } + } + } // Update checker @SubscribeEvent diff --git a/src/main/java/me/Danker/gui/WarningGui.java b/src/main/java/me/Danker/gui/WarningGui.java new file mode 100644 index 0000000..63b4710 --- /dev/null +++ b/src/main/java/me/Danker/gui/WarningGui.java @@ -0,0 +1,61 @@ +package me.Danker.gui; + +import akka.event.Logging; +import me.Danker.handlers.TextRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiLabel; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +import javax.xml.soap.Text; +import java.util.ArrayList; +import java.util.List; + +public class WarningGui extends GuiScreen { + private GuiButton close; + + public WarningGui(){ + + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + int height = sr.getScaledHeight(); + int width = sr.getScaledWidth(); + + close = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Close"); + + this.buttonList.add(close); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + String text0 = "§cWARNING!§0"; + int text0Width = mc.fontRendererObj.getStringWidth(text0); + new TextRenderer(mc, text0, (int)(width * 0.45) - text0Width / 2, (int) (height * 0.1), 2 ); + String text1 = "You are using SpiderFrog's Old Animations mod."; + int text1Width = mc.fontRendererObj.getStringWidth(text1); + new TextRenderer(mc, text1, width / 2 - text1Width / 2, (int) (height * 0.3), 1D ); + String text2 = "This mod breaks Danker's Skyblock Mod."; + int text2Width = mc.fontRendererObj.getStringWidth(text2); + new TextRenderer(mc, text2, width / 2 - text2Width / 2, (int) (height * 0.4), 1D); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void actionPerformed(GuiButton button){ + if(button == close) { + Minecraft.getMinecraft().displayGuiScreen(null); + } + } +} diff --git a/src/main/java/me/Danker/gui/WarningGuiRedirect.java b/src/main/java/me/Danker/gui/WarningGuiRedirect.java new file mode 100644 index 0000000..78e6f18 --- /dev/null +++ b/src/main/java/me/Danker/gui/WarningGuiRedirect.java @@ -0,0 +1,28 @@ +package me.Danker.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class WarningGuiRedirect extends GuiMainMenu { + public GuiScreen guiToShow; + private GuiButton close; + + protected void keyTyped(char par1, int par2){} + public WarningGuiRedirect(GuiScreen g){ + guiToShow = g; + } + + public void initGui(){ + super.initGui(); + } + + + public void drawScreen(int par1, int par2, float par3){ + super.drawScreen(par1, par2, par3); + + mc.displayGuiScreen(guiToShow); + } +} |