aboutsummaryrefslogtreecommitdiff
path: root/me/Danker/TheMod.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-07-06 17:06:40 -0400
committerGitHub <noreply@github.com>2020-07-06 17:06:40 -0400
commitbd90f8fab6fab609fdf5b58b94b16cb92e879d34 (patch)
treedd66cbad72ed2990740b7b87f94a78f2bcbcba98 /me/Danker/TheMod.java
parent06000253a5789a01486cc6580f39084dc61844cb (diff)
downloadSkyblockMod-bd90f8fab6fab609fdf5b58b94b16cb92e879d34.tar.gz
SkyblockMod-bd90f8fab6fab609fdf5b58b94b16cb92e879d34.tar.bz2
SkyblockMod-bd90f8fab6fab609fdf5b58b94b16cb92e879d34.zip
Upload all files
Features coordinate & angle display, and guild party desktop notifications.
Diffstat (limited to 'me/Danker/TheMod.java')
-rw-r--r--me/Danker/TheMod.java82
1 files changed, 82 insertions, 0 deletions
diff --git a/me/Danker/TheMod.java b/me/Danker/TheMod.java
new file mode 100644
index 0000000..3e9aa3f
--- /dev/null
+++ b/me/Danker/TheMod.java
@@ -0,0 +1,82 @@
+package me.Danker;
+
+import java.awt.Image;
+import java.awt.SystemTray;
+import java.awt.Toolkit;
+import java.awt.TrayIcon;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.client.ClientCommandHandler;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.fml.common.FMLCommonHandler;
+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.FMLPreInitializationEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+@Mod(modid = TheMod.MODID, version = TheMod.VERSION)
+public class TheMod
+{
+ public static final String MODID = "Danker's Skyblock Mod";
+ public static final String VERSION = "1.1";
+
+ @EventHandler
+ public void init(FMLInitializationEvent event)
+ {
+ FMLCommonHandler.instance().bus().register(this);
+ MinecraftForge.EVENT_BUS.register(this);
+ }
+
+ @EventHandler
+ public void preInit(final FMLPreInitializationEvent event) {
+ ClientCommandHandler.instance.registerCommand(new ToggleCommand());
+ }
+
+ @SubscribeEvent
+ public void onChat(final ClientChatReceivedEvent event) {
+ final ToggleCommand tc = new ToggleCommand();
+ final boolean isGPartyToggled = tc.getToggle("gparty");
+ String message = event.message.getUnformattedText();
+ String messagelc = message.toLowerCase();
+
+ if (isGPartyToggled) {
+ if (messagelc.contains(" has invited all members of ")) {
+ try {
+ final SystemTray tray = SystemTray.getSystemTray();
+ final Image image = Toolkit.getDefaultToolkit().createImage("icon.png");
+ final TrayIcon trayIcon = new TrayIcon(image, "Guild Party Notifier");
+ trayIcon.setImageAutoSize(true);
+ trayIcon.setToolTip("Guild Party Notifier");
+ tray.add(trayIcon);
+ trayIcon.displayMessage("Guild Party", message, TrayIcon.MessageType.INFO);
+ tray.remove(trayIcon);
+ } catch (Exception ex) {
+ System.err.print(ex);
+ }
+ }
+ }
+
+ }
+
+ @SubscribeEvent
+ public void renderPlayerInfo(final RenderGameOverlayEvent.Post event) {
+ if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE) return;
+ final ToggleCommand tc = new ToggleCommand();
+ final boolean isCoordsToggled = tc.getToggle("coords");
+
+ if (isCoordsToggled) {
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+ double xDir = (player.rotationYaw % 360 + 360) % 360;
+ if (xDir > 180) xDir -= 360;
+ xDir = (double) Math.round(xDir * 10d) / 10d;
+ double yDir = (double) Math.round(player.rotationPitch * 10d) / 10d;
+ String text = (int) player.posX + " / " + (int) player.posY + " / " + (int) player.posZ + " (" + xDir + " / " + yDir + ")";
+ new CoordRenderer(Minecraft.getMinecraft(), text);
+ }
+
+ }
+}