diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-09-23 19:58:24 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-09-23 19:58:24 -0400 |
commit | 1de001488dcb038ea3cb1a372061620392837069 (patch) | |
tree | c50e50cae84efa6f925c070b294ac8a7c0373ff0 /src/main | |
parent | aaead3c4f64ababbe60f9788714658fd81b67a3e (diff) | |
download | SkyblockMod-1de001488dcb038ea3cb1a372061620392837069.tar.gz SkyblockMod-1de001488dcb038ea3cb1a372061620392837069.tar.bz2 SkyblockMod-1de001488dcb038ea3cb1a372061620392837069.zip |
Add LabyMod support for text rendering
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index b26fc86..8c0660f 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -70,9 +70,11 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -98,6 +100,7 @@ public class TheMod public static String lastMaddoxCommand = "/cb placeholdervalue"; static KeyBinding[] keyBindings = new KeyBinding[1]; static int lastMouse = -1; + static boolean usingLabymod = false; static double dungeonStartTime = 0; static double bloodOpenTime = 0; @@ -108,8 +111,7 @@ public class TheMod static int puzzleFails = 0; @EventHandler - public void init(FMLInitializationEvent event) - { + public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(this); MinecraftForge.EVENT_BUS.register(this); @@ -181,6 +183,12 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); } + @EventHandler + public void postInit(final FMLPostInitializationEvent event) { + usingLabymod = Loader.isModLoaded("labymod"); + System.out.println("LabyMod detection: " + usingLabymod); + } + // Update checker @SubscribeEvent public void onJoin(EntityJoinWorldEvent event) { @@ -970,7 +978,20 @@ public class TheMod @SubscribeEvent public void renderPlayerInfo(final RenderGameOverlayEvent.Post event) { - if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE) return; + if (usingLabymod) return; + if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE && event.type != RenderGameOverlayEvent.ElementType.JUMPBAR) return; + renderEverything(); + } + + // LabyMod Support + @SubscribeEvent + public void renderPlayerInfoLabyMod(final RenderGameOverlayEvent event) { + if (!usingLabymod) return; + if (event.type != null) return; + renderEverything(); + } + + public void renderEverything() { final ToggleCommand tc = new ToggleCommand(); final MoveCommand moc = new MoveCommand(); final DisplayCommand ds = new DisplayCommand(); |