diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2023-01-14 03:16:22 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-14 03:16:22 +0900 |
commit | ba4ce4e30d5778d0ad00c163823dc5abb8b78b76 (patch) | |
tree | 533cdac7f9ae2b0cc6c9248baf1d783a510d4f58 /mod/src/main | |
parent | df33e015ade0be0df3d9ab1e242606dbdc7229ea (diff) | |
download | Skyblock-Dungeons-Guide-ba4ce4e30d5778d0ad00c163823dc5abb8b78b76.tar.gz Skyblock-Dungeons-Guide-ba4ce4e30d5778d0ad00c163823dc5abb8b78b76.tar.bz2 Skyblock-Dungeons-Guide-ba4ce4e30d5778d0ad00c163823dc5abb8b78b76.zip |
Dg4.0 eventpropagation (#270)
* - Event Handler Interface -> Annotations (for features)
Signed-off-by: syeyoung <cyoung06@naver.com>
* - Event Handler Interface -> Annotations (for features)
Signed-off-by: syeyoung <cyoung06@naver.com>
* - profiling
- build.gradle update
Signed-off-by: syeyoung <cyoung06@naver.com>
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main')
84 files changed, 447 insertions, 1456 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java index 9dd515c7..d54613b8 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java @@ -32,8 +32,8 @@ import kr.syeyoung.dungeonsguide.mod.cosmetics.CustomNetworkPlayerInfo; import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.GameSDK; import kr.syeyoung.dungeonsguide.mod.discord.rpc.RichPresenceManager; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonFacade; +import kr.syeyoung.dungeonsguide.mod.events.annotations.EventHandlerRegistry; import kr.syeyoung.dungeonsguide.mod.events.listener.DungeonListener; -import kr.syeyoung.dungeonsguide.mod.events.listener.FeatureListener; import kr.syeyoung.dungeonsguide.mod.events.listener.PacketListener; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; @@ -54,7 +54,6 @@ import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.ThreadDownloadImageData; -import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.ITextureObject; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.IResourceManager; @@ -62,8 +61,6 @@ import net.minecraft.client.resources.IResourcePack; import net.minecraft.command.CommandHandler; import net.minecraft.command.ICommand; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.launchwrapper.LaunchClassLoader; import net.minecraft.network.play.server.S38PacketPlayerListItem; import net.minecraft.util.ResourceLocation; @@ -227,7 +224,7 @@ public class DungeonsGuide implements DGInterface { registerEventsForge(commandReparty = new CommandReparty()); - registerEventsForge(new FeatureListener()); +// registerEventsForge(new FeatureListener()); registerEventsForge(packetListener = new PacketListener()); registerEventsForge(new Keybinds()); @@ -298,6 +295,9 @@ public class DungeonsGuide implements DGInterface { for (Object registeredListener : registeredListeners) { MinecraftForge.EVENT_BUS.unregister(registeredListener); } + + EventHandlerRegistry.unregisterListeners(); + List<ListenerList> all = ReflectionHelper.getPrivateValue(ListenerList.class, null, "allLists"); int busId = ReflectionHelper.getPrivateValue(EventBus.class, MinecraftForge.EVENT_BUS, "busID"); for (ListenerList listenerList : all) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java index 5b553bdc..c3c8f581 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java @@ -459,10 +459,12 @@ public class CommandDgDebug extends CommandBase { } else if ("testgui".equals(arg)) { GuiScreenAdapter adapter = new GuiScreenAdapter(new TestView()); new Thread(DungeonsGuide.THREAD_GROUP, () -> { - Minecraft.getMinecraft().addScheduledTask(() -> { - Minecraft.getMinecraft().displayGuiScreen(adapter); - }); - }).start(); + Minecraft.getMinecraft().addScheduledTask(() -> { + Minecraft.getMinecraft().displayGuiScreen(adapter); + }); + }).start(); + } else if ("clearprofile".equals(arg)) { + Minecraft.getMinecraft().mcProfiler.clearProfiling(); } else { sender.addChatMessage(new ChatComponentText("ain't gonna find much anything here")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg loadrooms §7-§f Reloads dungeon roomdata.")); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DiscordUserJoinRequestListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/DGEventHandler.java index add9e9ab..9bc3384e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DiscordUserJoinRequestListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/DGEventHandler.java @@ -1,6 +1,6 @@ /* * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Copyright (C) 2023 cyoung06 (syeyoung) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published @@ -16,12 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.mod.features.listener; +package kr.syeyoung.dungeonsguide.mod.events.annotations; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; -import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserJoinRequestEvent; +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface DGEventHandler { + boolean triggerOutOfSkyblock() default false; - -public interface DiscordUserJoinRequestListener { - void onDiscordUserJoinRequest(DiscordUserJoinRequestEvent event); + boolean ignoreDisabled() default false; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java new file mode 100644 index 00000000..914652b7 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java @@ -0,0 +1,150 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.annotations; + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.IFeature; +import lombok.AllArgsConstructor; +import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.profiler.Profiler; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.EventBus; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.IEventListener; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.function.Predicate; +import java.util.function.Supplier; + +public class EventHandlerRegistry { + public static Logger logger = LogManager.getLogger("DG-EventPropagator"); + + public static final Map<Class, List<InvocationTarget>> targets = new HashMap<>(); + + @AllArgsConstructor + @Getter + private static class InvocationTarget<T extends Event> { + private final Class<T> targetEvent; + private final IFeature feature; + private final String targetName; + private final Supplier<Boolean> condition; + private final MethodHandle invokeSite; + } + + private static final int busID; + static { + try { + Field f = EventBus.class.getDeclaredField("busID"); + f.setAccessible(true); + busID = (int) f.get(MinecraftForge.EVENT_BUS); + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + public static void registerEvents(IFeature feature) { + Class clazz = feature.getClass(); + while (clazz != null) { + for (Method declaredMethod : clazz.getDeclaredMethods()) { + declaredMethod.setAccessible(true); + DGEventHandler dgEventHandler = declaredMethod.getAnnotation(DGEventHandler.class); + if (dgEventHandler == null) continue; + if (declaredMethod.getParameterTypes().length != 1) + throw new RuntimeException("Too much or too less parameers: "+declaredMethod.getName()+" on "+clazz.getName()); + Class eventType = declaredMethod.getParameterTypes()[0]; + if (!targets.containsKey(eventType)) targets.put(eventType, new LinkedList<>()); + + boolean force = dgEventHandler.ignoreDisabled(); + boolean sb = dgEventHandler.triggerOutOfSkyblock(); + + Supplier<Boolean> booleanSupplier = + force && sb ? null : + force ? SkyblockStatus::isOnSkyblock : + sb ? feature::isEnabled : () -> SkyblockStatus.isOnSkyblock() && feature.isEnabled(); + + try { + InvocationTarget target = new InvocationTarget( + eventType, + feature, + (feature.getClass().getSimpleName() + ":" + declaredMethod.getName()).replace(".", "/"), + booleanSupplier, + MethodHandles.publicLookup().unreflect(declaredMethod).bindTo(feature) + ); + targets.get(eventType).add(target); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); // this shouldn't happen. + } + + } + clazz = clazz.getSuperclass(); + } + registerActualListeners(); + } + + private static Map<Event, IEventListener> registeredHandlers = new HashMap<>(); + + public static void registerActualListeners() { + for (Class<? extends Event> aClass : targets.keySet()) { + if (registeredHandlers.containsKey(aClass)) continue; + try { + Event ev = aClass.getConstructor().newInstance(); + List<InvocationTarget> targetList = targets.get(aClass); + Profiler profiler = Minecraft.getMinecraft().mcProfiler; + IEventListener registered; + ev.getListenerList().register(busID, EventPriority.NORMAL, registered = (event) -> { + profiler.startSection("Dungeons Guide Event Handling"); + for (InvocationTarget target : targetList) { + profiler.startSection(target.getTargetName()); + try { + if (target.condition == null || (target.condition.get() == Boolean.TRUE)) // it is safe to use this here. + target.invokeSite.invoke(event); + } catch (Throwable e) { + logger.error("An error occured while handling event: \nFeature = " + target.getFeature().getClass().getName(), e); + } + profiler.endSection(); + } + profiler.endSection(); + }); + registeredHandlers.put(ev, registered); + } catch (Exception e) { + throw new RuntimeException("An error occured while registering listener for "+aClass.getName(), e); + } + } + } + + public static void unregisterListeners() { + for (Map.Entry<Event, IEventListener> eventIEventListenerEntry : registeredHandlers.entrySet()) { + eventIEventListenerEntry.getKey().getListenerList().unregister(busID, eventIEventListenerEntry.getValue()); + } + registeredHandlers.clear(); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/AuthChangedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DGTickEvent.java index 4e066d85..737c797f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/AuthChangedEvent.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DGTickEvent.java @@ -1,6 +1,6 @@ /* * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2022 cyoung06 (syeyoung) + * Copyright (C) 2023 cyoung06 (syeyoung) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published @@ -18,7 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.events.impl; - import net.minecraftforge.fml.common.eventhandler.Event; -public class AuthChangedEvent extends Event { } +public class DGTickEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java index 247a9284..4bafe9f0 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java @@ -147,7 +147,7 @@ public class DungeonListener { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent ev) { if (ev.side == Side.SERVER || ev.phase != TickEvent.Phase.START) return; - + MinecraftForge.EVENT_BUS.post(new DGTickEvent()); if (SkyblockStatus.isOnSkyblock()) { DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FeatureListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FeatureListener.java deleted file mode 100644 index b6872c00..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FeatureListener.java +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.events.listener; - - -import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; -import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.mod.events.impl.*; -import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.*; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.client.event.*; -import net.minecraftforge.client.event.sound.PlaySoundEvent; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; - -public class FeatureListener { - @SubscribeEvent - public void onRender(RenderGameOverlayEvent.Post postRender) { - try { - boolean isLocConfig = Minecraft.getMinecraft().currentScreen instanceof GuiGuiLocationConfig; - - if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) return; - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof ScreenRenderListener && (!isLocConfig || !(abstractFeature instanceof GuiFeature))) { - ((ScreenRenderListener) abstractFeature).drawScreen(postRender.partialTicks); - } - } - GlStateManager.enableBlend(); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @SubscribeEvent - public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof KeybindPressedListener) { - ((KeybindPressedListener) abstractFeature).onKeybindPress(keyBindPressedEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @SubscribeEvent - public void onStomp(StompConnectedEvent stompConnectedEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof StompConnectedListener) { - ((StompConnectedListener) abstractFeature).onStompConnected(stompConnectedEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onStomp(TextureStitchEvent.Pre textureStitchEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof TextureStichListener) { - ((TextureStichListener) abstractFeature).onTextureStitch(textureStitchEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onStomp(TextureStitchEvent.Post textureStitchEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof TextureStichListener) { - ((TextureStichListener) abstractFeature).onTextureStitch(textureStitchEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onDiscordUserUpdate(DiscordUserUpdateEvent discordUserUpdateEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof DiscordUserUpdateListener) { - ((DiscordUserUpdateListener) abstractFeature).onDiscordUserUpdate(discordUserUpdateEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onDiscordUserUpdate(DiscordUserJoinRequestEvent discordUserUpdateEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof DiscordUserJoinRequestListener) { - ((DiscordUserJoinRequestListener) abstractFeature).onDiscordUserJoinRequest(discordUserUpdateEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onWindowUpdate(WindowUpdateEvent windowUpdateEvent) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof GuiUpdateListener) { - ((GuiUpdateListener) abstractFeature).onGuiUpdate(windowUpdateEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onRender(RenderLivingEvent.Pre preRender) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof EntityLivingRenderListener) { - ((EntityLivingRenderListener) abstractFeature).onEntityRenderPre(preRender); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @SubscribeEvent - public void onSound(PlaySoundEvent soundEvent) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof SoundListener) { - ((SoundListener) abstractFeature).onSound(soundEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @SubscribeEvent - public void onRender(RenderLivingEvent.Post preRender) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof EntityLivingRenderListener) { - ((EntityLivingRenderListener) abstractFeature).onEntityRenderPost(preRender); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onRender(TitleEvent titleEvent) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof TitleListener) { - ((TitleListener) abstractFeature).onTitle(titleEvent.getPacketTitle()); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onRender(RenderPlayerEvent.Pre preRender) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof PlayerRenderListener) { - ((PlayerRenderListener) abstractFeature).onEntityRenderPre(preRender); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onRender(RenderPlayerEvent.Post preRender) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof PlayerRenderListener) { - ((PlayerRenderListener) abstractFeature).onEntityRenderPost(preRender); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - - @SubscribeEvent - public void onRenderWorld(RenderWorldLastEvent postRender) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof WorldRenderListener) { - ((WorldRenderListener) abstractFeature).drawWorld(postRender.partialTicks); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onInteract(PlayerInteractEvent postRender) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof InteractListener) { - ((InteractListener) abstractFeature).onInteract(postRender); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - - @SubscribeEvent - public void onRenderWorld(ClientChatReceivedEvent postRender) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof ChatListener) { - ((ChatListener) abstractFeature).onChat(postRender); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @SubscribeEvent - public void onChatGlobal(ClientChatReceivedEvent postRender) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof ChatListenerGlobal) { - ((ChatListenerGlobal) abstractFeature).onChat(postRender); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @SubscribeEvent - public void dungeonTooltip(ItemTooltipEvent event) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof TooltipListener) { - ((TooltipListener) abstractFeature).onTooltip(event); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent tick) { - if (tick.phase == TickEvent.Phase.END && tick.type == TickEvent.Type.CLIENT ) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof TickListener) { - ((TickListener) abstractFeature).onTick(); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } - @SubscribeEvent - public void onGuiOpen(GuiOpenEvent tick) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof GuiOpenListener) { - ((GuiOpenListener) abstractFeature).onGuiOpen(tick); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post render) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof GuiPostRenderListener) { - ((GuiPostRenderListener) abstractFeature).onGuiPostRender(render); - } - } - GlStateManager.enableBlend(); - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Pre render) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof GuiPreRenderListener) { - ((GuiPreRenderListener) abstractFeature).onGuiPreRender(render); - } - } - GlStateManager.enableBlend(); - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent render) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof GuiBackgroundRenderListener) { - ((GuiBackgroundRenderListener) abstractFeature).onGuiBGRender(render); - } - } - GlStateManager.enableBlend(); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGH) - public void onGuiEvent(GuiScreenEvent.MouseInputEvent.Pre input) { - try { - - if (!SkyblockStatus.isOnSkyblock()) return; - - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof GuiClickListener) { - ((GuiClickListener) abstractFeature).onMouseInput(input); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onSkyblockJoin(SkyblockJoinedEvent joinedEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof SkyblockJoinListener) { - ((SkyblockJoinListener) abstractFeature).onSkyblockJoin(); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onSkyblockQuit(SkyblockLeftEvent leftEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof SkyblockLeaveListener) { - ((SkyblockLeaveListener) abstractFeature).onSkyblockQuit(); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onKey(GuiScreenEvent.KeyboardInputEvent event) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof KeyInputListener) { - ((KeyInputListener) abstractFeature).onKeyInput(event); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onDungeonStart(DungeonStartedEvent leftEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof DungeonStartListener) { - ((DungeonStartListener) abstractFeature).onDungeonStart(); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onDungeonLeft(DungeonLeftEvent leftEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof DungeonQuitListener) { - ((DungeonQuitListener) abstractFeature).onDungeonQuit(); - } - if (abstractFeature instanceof DungeonEndListener) { - ((DungeonEndListener) abstractFeature).onDungeonEnd(); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onDungeonInitialize(DungeonContextInitializationEvent leftEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof DungeonContextInitializationListener) { - ((DungeonContextInitializationListener) abstractFeature).onDungeonInitialize(); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onDungeonInitialize(BossroomEnterEvent enterEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof BossroomEnterListener) { - ((BossroomEnterListener) abstractFeature).onBossroomEnter(); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - @SubscribeEvent - public void onDungeonInitialize(DungeonEndedEvent endedEvent) { - try { - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - if (abstractFeature instanceof DungeonEndListener) { - ((DungeonEndListener) abstractFeature).onDungeonEnd(); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java index 7526f959..59029dde 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java @@ -36,7 +36,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public abstract class AbstractFeature { +public abstract class AbstractFeature implements IFeature { @Getter private final String category; @Getter diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java index b8ff6bbc..1908f9a8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.features; +import kr.syeyoung.dungeonsguide.mod.events.annotations.EventHandlerRegistry; import kr.syeyoung.dungeonsguide.mod.features.impl.advanced.*; import kr.syeyoung.dungeonsguide.mod.features.impl.boss.*; import kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal.FeatureSimonSaysSolver; @@ -68,6 +69,8 @@ public class FeatureRegistry { features.add(abstractFeature); featuresByCategory.put(abstractFeature.getCategory(), features); + EventHandlerRegistry.registerEvents(abstractFeature); + return abstractFeature; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/GuiFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/GuiFeature.java index 315b97f6..9b901907 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/GuiFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/GuiFeature.java @@ -23,7 +23,7 @@ import kr.syeyoung.dungeonsguide.mod.config.guiconfig.GuiConfigV2; import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; import kr.syeyoung.dungeonsguide.mod.config.types.GUIRectangle; import kr.syeyoung.dungeonsguide.mod.config.types.TypeConverterRegistry; -import kr.syeyoung.dungeonsguide.mod.features.listener.ScreenRenderListener; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; @@ -37,6 +37,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; +import net.minecraftforge.client.event.RenderGameOverlayEvent; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; @@ -45,7 +46,7 @@ import java.util.ArrayList; import java.util.List; @Getter -public abstract class GuiFeature extends AbstractFeature implements ScreenRenderListener { +public abstract class GuiFeature extends AbstractFeature { @Setter private GUIRectangle featureRect; @Setter(value = AccessLevel.PROTECTED) @@ -65,9 +66,10 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender this.featureRect = new GUIRectangle(0, 0, width, height); } - @Override - public void drawScreen(float partialTicks) { + @DGEventHandler + public void drawScreen(RenderGameOverlayEvent.Post postRender) { if (!isEnabled()) return; + if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) return; GlStateManager.pushMatrix(); Rectangle featureRect = this.featureRect.getRectangleNoScale(); @@ -77,7 +79,7 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender GL11.glEnable(GL11.GL_SCISSOR_TEST); GlStateManager.translate(featureRect.x, featureRect.y, 0); - drawHUD(partialTicks); + drawHUD(postRender.partialTicks); GL11.glDisable(GL11.GL_SCISSOR_TEST); GlStateManager.popMatrix(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DiscordUserUpdateListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/IFeature.java index 2404d960..b06f921b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DiscordUserUpdateListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/IFeature.java @@ -1,6 +1,6 @@ /* * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Copyright (C) 2023 cyoung06 (syeyoung) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published @@ -16,10 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.mod.features.listener; +package kr.syeyoung.dungeonsguide.mod.features; -import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserUpdateEvent; +import com.google.gson.JsonObject; -public interface DiscordUserUpdateListener { - void onDiscordUserUpdate(DiscordUserUpdateEvent event); +public interface IFeature { + boolean isEnabled(); + + void loadConfig(JsonObject jsonObject); + JsonObject saveConfig(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java index ca73b3af..9f5f651d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java @@ -21,10 +21,10 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonStartListener; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; @@ -47,7 +47,6 @@ import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.relauncher.ReflectionHelper; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -62,7 +61,7 @@ import java.util.regex.Pattern; import static kr.syeyoung.dungeonsguide.mod.utils.TabListUtil.getString; -public class FeatureTestPepole extends GuiFeature implements ChatListener, DungeonStartListener { +public class FeatureTestPepole extends GuiFeature { Logger logger = LogManager.getLogger("FeatureTestPepole"); private Float scale; @@ -232,7 +231,7 @@ public class FeatureTestPepole extends GuiFeature implements ChatListener, Dunge readynessIndicator.put("go", true); } - @Override + @DGEventHandler() public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { String txt = clientChatReceivedEvent.message.getFormattedText(); if (!txt.startsWith("§r§9Party §8>")) return; @@ -265,8 +264,8 @@ public class FeatureTestPepole extends GuiFeature implements ChatListener, Dunge } - @Override - public void onDungeonStart() { + @DGEventHandler + public void onDungeonStart(DungeonStartedEvent event) { ready.clear(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureAutoReparty.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureAutoReparty.java index 6b2f98b2..d99bf658 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureAutoReparty.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureAutoReparty.java @@ -20,17 +20,18 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonQuitListener; -public class FeatureAutoReparty extends SimpleFeature implements DungeonQuitListener { +public class FeatureAutoReparty extends SimpleFeature { public FeatureAutoReparty() { super("Party.Reparty", "Auto reparty when dungeon finishes","Auto reparty on dungeon finish\n\nThis automates player chatting action, (disbanding, repartying) Thus it might be against hypixel's rules.\nBut mods like auto-gg exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "party.autoreparty", false); } - @Override - public void onDungeonQuit() { + @DGEventHandler + public void onDungeonQuit(DungeonLeftEvent event) { if (isEnabled()) DungeonsGuide.getDungeonsGuide().getCommandReparty().requestReparty(true); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBoxRealLivid.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBoxRealLivid.java index feb3dfa1..cdc99aaf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBoxRealLivid.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBoxRealLivid.java @@ -23,15 +23,16 @@ import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorLivid; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.client.event.RenderWorldLastEvent; -public class FeatureBoxRealLivid extends SimpleFeature implements WorldRenderListener { +public class FeatureBoxRealLivid extends SimpleFeature { public FeatureBoxRealLivid() { super("Dungeon.Bossfight.Floor 5", "Box Real Livid", "Box Real Livid in bossfight", "Dungeon.Bossfight.realLividBox", true); addParameter("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Livid", new AColor(0,255,0,150), "acolor", nval -> color = nval)); @@ -40,8 +41,9 @@ public class FeatureBoxRealLivid extends SimpleFeature implements WorldRenderLis AColor color = null; private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { + @DGEventHandler + public void drawWorld(RenderWorldLastEvent event) { + float partialTicks = event.partialTicks; if (!isEnabled()) return; if (!skyblockStatus.isOnDungeon()) return; if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() == null) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureChestPrice.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureChestPrice.java index b28f14c9..953126f6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureChestPrice.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureChestPrice.java @@ -20,8 +20,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiBackgroundRenderListener; import kr.syeyoung.dungeonsguide.mod.utils.AhUtils; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.Minecraft; @@ -42,12 +42,12 @@ import java.util.Comparator; import java.util.Set; import java.util.TreeSet; -public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRenderListener { +public class FeatureChestPrice extends SimpleFeature { public FeatureChestPrice() { super("Dungeon", "Show Profit of Dungeon Reward Chests","Show Profit of Dungeon Chests", "bossfight.profitchest", false); } - @Override + @DGEventHandler public void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered) { if (!isEnabled()) return; if (!(rendered.gui instanceof GuiChest)) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureHideAnimals.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureHideAnimals.java index 5d74977a..55138fde 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureHideAnimals.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureHideAnimals.java @@ -22,14 +22,14 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorThorn; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.EntityLivingRenderListener; import net.minecraft.entity.passive.*; import net.minecraftforge.client.event.RenderLivingEvent; -public class FeatureHideAnimals extends SimpleFeature implements EntityLivingRenderListener { +public class FeatureHideAnimals extends SimpleFeature { public FeatureHideAnimals() { super("Dungeon.Bossfight.Floor 4", "Hide animals on f4", "Hide Spirit Animals on F4. \nClick on Edit for precise setting", "bossfight.hideanimals", false); addParameter("sheep", new FeatureParameter<Boolean>("sheep", "Hide Sheeps", "Hide Sheeps", true, "boolean", nval -> sheep = nval)); @@ -49,7 +49,7 @@ public class FeatureHideAnimals extends SimpleFeature implements EntityLivingRen private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override + @DGEventHandler() public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { if (!isEnabled()) return; if (!skyblockStatus.isOnDungeon()) return; @@ -69,9 +69,4 @@ public class FeatureHideAnimals extends SimpleFeature implements EntityLivingRen renderPlayerEvent.setCanceled(true); } } - - @Override - public void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent) { - - } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java index 5f6883e7..f8368cd4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java @@ -23,8 +23,8 @@ import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorThorn; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.TitleListener; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.TitleEvent; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -36,7 +36,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatListener, TitleListener { +public class FeatureThornSpiritBowTimer extends TextHUDFeature { public FeatureThornSpiritBowTimer() { super("Dungeon.Bossfight.Floor 4", "Display Spirit bow timer", "Displays how long until spirit bow gets destroyed", "bossfight.spiritbowdisplay", false, getFontRenderer().getStringWidth("Spirit Bow Destruction: 2m 00s"), getFontRenderer().FONT_HEIGHT); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); @@ -77,7 +77,7 @@ public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatLi } private long time = 0; - @Override + @DGEventHandler() public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (!(skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; String text = clientChatReceivedEvent.message.getFormattedText(); @@ -101,10 +101,10 @@ public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatLi } } - @Override - public void onTitle(S45PacketTitle renderPlayerEvent) { + @DGEventHandler + public void onTitle(TitleEvent event) { if (!(skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; - if (renderPlayerEvent.getMessage().getFormattedText().contains("picked up")) { + if (event.getPacketTitle().getMessage().getFormattedText().contains("picked up")) { time = System.currentTimeMillis() + 21000; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureSimonSaysSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureSimonSaysSolver.java index e6d3c595..9228d058 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureSimonSaysSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureSimonSaysSolver.java @@ -23,15 +23,15 @@ import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorNecron; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.InteractListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import java.awt.*; @@ -39,7 +39,7 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; -public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRenderListener, TickListener, InteractListener { +public class FeatureSimonSaysSolver extends SimpleFeature { public FeatureSimonSaysSolver() { super("Dungeon.Bossfight.Floor 7+","Simon Says Solver","Solver for Simon says puzzle", "Dungeon.Bossfight.simonsays2"); } @@ -48,8 +48,9 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender private final List<BlockPos> orderbuild = new ArrayList<BlockPos>(); private final LinkedList<BlockPos> orderclick = new LinkedList<BlockPos>(); - @Override - public void drawWorld(float partialTicks) { + @DGEventHandler + public void drawWorld(RenderWorldLastEvent event) { + float partialTicks = event.partialTicks; if (!isEnabled()) return; DungeonContext dc = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (dc == null) { @@ -65,8 +66,8 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender RenderUtils.highlightBlock(orderclick.get(1), new Color(255, 170, 0, 100), partialTicks, false); } private boolean wasButton = false; - @Override - public void onTick() { + @DGEventHandler + public void onTick(DGTickEvent tickEvent) { DungeonContext dc = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (dc == null) { wasButton = false; @@ -93,7 +94,7 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender } } - @Override + @DGEventHandler public void onInteract(PlayerInteractEvent event) { if (!isEnabled()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java index 64b1509d..a51affd8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java @@ -20,8 +20,9 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.inventory.GuiChest; @@ -36,7 +37,7 @@ import org.lwjgl.input.Mouse; import java.util.ArrayList; import java.util.List; -public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenListener, TickListener, GuiPostRenderListener, GuiClickListener, TooltipListener { +public class FeatureTerminalSolvers extends SimpleFeature { public FeatureTerminalSolvers() { super("Dungeon.Bossfight.Floor 7+","F7 GUI Terminal Solver", "Solve f7 gui terminals. (color, startswith, order, navigate, correct panes)", "bossfight.terminals"); } @@ -55,7 +56,7 @@ public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenList private TerminalSolution solution; private final List<Slot> clicked = new ArrayList<Slot>(); - @Override + @DGEventHandler public void onGuiOpen(GuiOpenEvent event) { if (!isEnabled()) return; solution = null; @@ -72,8 +73,8 @@ public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenList } } - @Override - public void onTick() { + @DGEventHandler + public void onTick(DGTickEvent tickEvent) { if (!isEnabled()) return; if (solutionProvider == null) return; if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) { @@ -87,7 +88,7 @@ public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenList solution = solutionProvider.provideSolution(cc, clicked); } - @Override + @DGEventHandler public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { if (!isEnabled()) return; if (solutionProvider == null) return; @@ -130,7 +131,7 @@ public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenList GlStateManager.enableLighting(); } - @Override + @DGEventHandler public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { if (!isEnabled()) return; if (Mouse.getEventButton() == -1) return; @@ -146,7 +147,7 @@ public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenList } } - @Override + @DGEventHandler public void onTooltip(ItemTooltipEvent event) { if (!isEnabled()) return; if (solutionProvider == null) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java index 20c208e7..91e8414f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java @@ -22,9 +22,10 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityJoinRequestReply; import kr.syeyoung.dungeonsguide.mod.discord.rpc.RichPresenceManager; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserJoinRequestEvent; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.*; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -32,6 +33,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; @@ -42,7 +44,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.*; -public class PartyInviteViewer extends SimpleFeature implements GuiPostRenderListener, ScreenRenderListener, TickListener, GuiClickListener, DiscordUserJoinRequestListener { +public class PartyInviteViewer extends SimpleFeature { public PartyInviteViewer() { super("Discord", "Party Invite Viewer","Simply type /dg asktojoin or /dg atj to toggle whether ask-to-join would be presented as option on discord!\n\nRequires Discord RPC to be enabled", "discord.party_invite_viewer"); } @@ -52,22 +54,24 @@ public class PartyInviteViewer extends SimpleFeature implements GuiPostRenderLis return false; } - @Override + @DGEventHandler public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { renderRequests(true); } - @Override - public void drawScreen(float partialTicks) { + @DGEventHandler + public void drawScreen(RenderGameOverlayEvent.Post postRender) { if (!isEnabled()) return; + if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) return; + try { renderRequests(false); } catch (Throwable t) { t.printStackTrace(); } } - @Override - public void onTick() { + @DGEventHandler + public void onTick(DGTickEvent tickEvent) { try { List<PartyJoinRequest> partyJoinRequestList = new ArrayList<>(); boolean isOnHypixel = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnHypixel(); @@ -89,7 +93,7 @@ public class PartyInviteViewer extends SimpleFeature implements GuiPostRenderLis } - @Override + @DGEventHandler public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { if (!isEnabled()) return; int mouseX = Mouse.getX(); @@ -306,7 +310,7 @@ public class PartyInviteViewer extends SimpleFeature implements GuiPostRenderLis GlStateManager.popMatrix(); } - @Override + @DGEventHandler(triggerOutOfSkyblock = true) public void onDiscordUserJoinRequest(DiscordUserJoinRequestEvent event) { PartyJoinRequest partyInvite = new PartyJoinRequest(); partyInvite.setDiscordUser(event.getDiscordUser()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java index 195cfe73..1a8dbe91 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java @@ -23,13 +23,12 @@ import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordRelationshipType; import kr.syeyoung.dungeonsguide.mod.discord.rpc.JDiscordActivity; import kr.syeyoung.dungeonsguide.mod.discord.rpc.JDiscordRelation; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserUpdateEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; import kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer.ImageTexture; -import kr.syeyoung.dungeonsguide.mod.features.listener.DiscordUserUpdateListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.ScreenRenderListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.TickListener; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import lombok.AllArgsConstructor; import lombok.Data; @@ -38,6 +37,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; +import net.minecraftforge.client.event.RenderGameOverlayEvent; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; @@ -47,14 +47,14 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; -public class PlayingDGAlarm extends SimpleFeature implements DiscordUserUpdateListener, ScreenRenderListener, TickListener { +public class PlayingDGAlarm extends SimpleFeature { public PlayingDGAlarm() { super("Discord", "Friend Online Notification","Notifies you in bottom when your discord friend has launched a Minecraft with DG!\n\nRequires the Friend's Discord RPC to be enabled", "discord.playingalarm"); } private List<PlayerOnline> notif = new CopyOnWriteArrayList<>(); - @Override - public void onTick() { + @DGEventHandler + public void onTick(DGTickEvent event) { try { List<PlayerOnline> partyJoinRequestList = new ArrayList<>(); boolean isOnHypixel = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnHypixel(); @@ -71,9 +71,11 @@ public class PlayingDGAlarm extends SimpleFeature implements DiscordUserUpdateLi - @Override - public void drawScreen(float partialTicks) { + @DGEventHandler + public void drawScreen(RenderGameOverlayEvent.Post postRender) { if (!isEnabled()) return; + if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) return; + try { GlStateManager.pushMatrix(); GlStateManager.translate(0,0,100); @@ -150,7 +152,7 @@ public class PlayingDGAlarm extends SimpleFeature implements DiscordUserUpdateLi private long end; } - @Override + @DGEventHandler(triggerOutOfSkyblock = true) public void onDiscordUserUpdate(DiscordUserUpdateEvent event) { JDiscordRelation prev = event.getPrev(), current = event.getCurrent(); if (!isDisplayable(prev) && isDisplayable(current)) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxBats.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxBats.java index 0f0fb5d6..4d0eec66 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxBats.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxBats.java @@ -22,19 +22,20 @@ import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.passive.EntityBat; import net.minecraft.util.BlockPos; +import net.minecraftforge.client.event.RenderWorldLastEvent; import org.jetbrains.annotations.Nullable; import java.util.List; -public class FeatureBoxBats extends SimpleFeature implements WorldRenderListener { +public class FeatureBoxBats extends SimpleFeature { public FeatureBoxBats() { super("Dungeon.Mobs", "Box Bats", "Box bats in dungeons\nDoes not appear through walls", "dungeon.batbox", true); addParameter("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and bats to be boxed", 20, "integer")); @@ -43,8 +44,9 @@ public class FeatureBoxBats extends SimpleFeature implements WorldRenderListener private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { + @DGEventHandler + public void drawWorld(RenderWorldLastEvent event) { + float partialTicks = event.partialTicks; if (!isEnabled()) return; if (!skyblockStatus.isOnDungeon()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxSkelemaster.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxSkelemaster.java index 4ed498b3..49a6bb58 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxSkelemaster.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxSkelemaster.java @@ -22,19 +22,20 @@ import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.BlockPos; +import net.minecraftforge.client.event.RenderWorldLastEvent; import org.jetbrains.annotations.Nullable; import java.util.List; -public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderListener { +public class FeatureBoxSkelemaster extends SimpleFeature { public FeatureBoxSkelemaster() { super("Dungeon.Mobs", "Box Skeleton Masters", "Box skeleton masters in dungeons", "dungeon.skeletonmasterbox", true); addParameter("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); @@ -43,8 +44,9 @@ public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderL private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { + @DGEventHandler + public void drawWorld(RenderWorldLastEvent event) { + float partialTicks = event.partialTicks; if (!isEnabled()) return; if (!skyblockStatus.isOnDungeon()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxStarMobs.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxStarMobs.java index b290df22..2dbc1baa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxStarMobs.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxStarMobs.java @@ -22,19 +22,20 @@ import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.BlockPos; +import net.minecraftforge.client.event.RenderWorldLastEvent; import org.jetbrains.annotations.Nullable; import java.util.List; -public class FeatureBoxStarMobs extends SimpleFeature implements WorldRenderListener { +public class FeatureBoxStarMobs extends SimpleFeature { public FeatureBoxStarMobs() { super("Dungeon.Mobs", "Box Starred mobs", "Box Starred mobs in dungeons", "dungeon.starmobbox", false); addParameter("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and starred mobs to be boxed", 20, "integer")); @@ -43,8 +44,9 @@ public class FeatureBoxStarMobs extends SimpleFeature implements WorldRenderList private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { + @DGEventHandler + public void drawWorld(RenderWorldLastEvent event) { + float partialTicks = event.partialTicks; if (!isEnabled()) return; if (!skyblockStatus.isOnDungeon()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java index 3a545000..c343c4a8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java @@ -22,7 +22,7 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -32,7 +32,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature implements ChatListener { +public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature { public FeatureDungeonCurrentRoomSecrets() { super("Dungeon.HUDs", "Display # Secrets in current room", "Display what your actionbar says", "dungeon.stats.secretsroom", true, getFontRenderer().getStringWidth("Secrets In Room: 8/8"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); @@ -86,7 +86,7 @@ public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature implements return actualBit; } - @Override + @DGEventHandler public void onChat(ClientChatReceivedEvent chat) { if (chat.type != 2) return; String text = chat.message.getFormattedText(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java index 061e4080..21e44ed3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java @@ -25,7 +25,7 @@ import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonDeathEvent; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -43,7 +43,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener { +public class FeatureDungeonDeaths extends TextHUDFeature { public FeatureDungeonDeaths() { super("Dungeon.HUDs", "Display Deaths", "Display names of player and death count in dungeon run", "dungeon.stats.deaths", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); this.setEnabled(false); @@ -143,7 +143,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener Pattern deathPattern = Pattern.compile("§r§c ☠ (.+?)§r§7 .+and became a ghost.+"); Pattern meDeathPattern = Pattern.compile("§r§c ☠ §r§7You .+and became a ghost.+"); - @Override + @DGEventHandler() public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) return; if (!skyblockStatus.isOnDungeon()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java index a8ba5d53..c683b196 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java @@ -26,11 +26,12 @@ import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.MapProcessor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.BossroomEnterEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonEndedEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.BossroomEnterListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonStartListener; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import kr.syeyoung.dungeonsguide.mod.utils.TabListUtil; import net.minecraft.block.material.MapColor; @@ -61,7 +62,7 @@ import javax.vecmath.Vector2d; import java.awt.*; import java.util.List; -public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { +public class FeatureDungeonMap extends GuiFeature { private AColor backgroudColor; private AColor playerColor; private boolean shouldCacheMap; @@ -102,18 +103,18 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, private boolean on = false; - @Override - public void onDungeonEnd() { + @DGEventHandler(ignoreDisabled = true) + public void onDungeonEnd(DungeonEndedEvent event) { on = false; } - @Override - public void onDungeonStart() { + @DGEventHandler + public void onDungeonStart(DungeonStartedEvent event) { on = true; } - @Override - public void onBossroomEnter() { + @DGEventHandler(ignoreDisabled = true) + public void onBossroomEnter(BossroomEnterEvent event) { on = false; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java index cc65cd6b..aa9689d1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java @@ -24,8 +24,8 @@ import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -41,7 +41,7 @@ import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; -public class FeatureDungeonMilestone extends TextHUDFeature implements ChatListener { +public class FeatureDungeonMilestone extends TextHUDFeature { public FeatureDungeonMilestone() { super("Dungeon.HUDs", "Display Current Class Milestone", "Display current class milestone of yourself", "dungeon.stats.milestone", true, getFontRenderer().getStringWidth("Milestone: 12"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); @@ -93,7 +93,7 @@ public class FeatureDungeonMilestone extends TextHUDFeature implements ChatListe public static final Pattern milestone_pattern = Pattern.compile("§r§e§l(.+) Milestone §r§e(.)§r§7: .+ §r§a(.+)§r"); - @Override + @DGEventHandler() public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) return; if (!skyblockStatus.isOnDungeon()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java index df211d2d..804bd1ee 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java @@ -20,8 +20,9 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonStartListener; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -31,7 +32,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class FeatureDungeonRealTime extends TextHUDFeature implements DungeonStartListener, DungeonQuitListener { +public class FeatureDungeonRealTime extends TextHUDFeature { public FeatureDungeonRealTime() { super("Dungeon.HUDs", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime", true, getFontRenderer().getStringWidth("Time(Real): 59m 59s"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); @@ -80,13 +81,13 @@ public class FeatureDungeonRealTime extends TextHUDFeature implements DungeonSta return actualBit; } - @Override - public void onDungeonStart() { - started= System.currentTimeMillis(); + @DGEventHandler + public void onDungeonStart(DungeonStartedEvent event) { + started= System.currentTimeMillis(); } - @Override - public void onDungeonQuit() { + @DGEventHandler(ignoreDisabled = true) + public void onDungeonQuit(DungeonLeftEvent event) { started = -1; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureHideNameTags.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureHideNameTags.java index eb9be583..9e8a7ed1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureHideNameTags.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureHideNameTags.java @@ -21,13 +21,13 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.EntityLivingRenderListener; import net.minecraft.entity.item.EntityArmorStand; import net.minecraftforge.client.event.RenderLivingEvent; -public class FeatureHideNameTags extends SimpleFeature implements EntityLivingRenderListener { +public class FeatureHideNameTags extends SimpleFeature { public FeatureHideNameTags() { super("Dungeon.Mobs", "Hide mob nametags", "Hide mob nametags in dungeon", "dungeon.hidenametag", false); } @@ -35,7 +35,7 @@ public class FeatureHideNameTags extends SimpleFeature implements EntityLivingRe private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override + @DGEventHandler public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { if (!isEnabled()) return; if (!skyblockStatus.isOnDungeon()) return; @@ -46,9 +46,4 @@ public class FeatureHideNameTags extends SimpleFeature implements EntityLivingRe renderPlayerEvent.setCanceled(true); } } - - @Override - public void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent) { - - } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java index c93a8920..26ba2b3e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java @@ -22,8 +22,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.PlayerRenderListener; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; @@ -33,7 +33,7 @@ import net.minecraftforge.client.event.RenderPlayerEvent; import org.lwjgl.opengl.GL11; -public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListener { +public class FeaturePlayerESP extends SimpleFeature { public FeaturePlayerESP() { super("Dungeon.Teammates", "See players through walls", "See players through walls", "dungeon.playeresp", false); setEnabled(false); @@ -43,7 +43,7 @@ public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListe private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private boolean preCalled = false; - @Override + @DGEventHandler public void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent) { @@ -105,8 +105,4 @@ public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListe } - @Override - public void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent) { - } - } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java index a85b47cb..5e228eed 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java @@ -20,11 +20,10 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; import kr.syeyoung.dungeonsguide.mod.features.impl.boss.FeatureChestPrice; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.KeyInputListener; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiChest; @@ -33,13 +32,13 @@ import net.minecraft.inventory.IInventory; import net.minecraftforge.client.event.GuiScreenEvent; import org.lwjgl.input.Mouse; -public class FeaturePressAnyKeyToCloseChest extends SimpleFeature implements KeyInputListener, GuiClickListener { +public class FeaturePressAnyKeyToCloseChest extends SimpleFeature { public FeaturePressAnyKeyToCloseChest() { super("Dungeon", "Press Any Mouse Button or Key to close Secret Chest", "dungeon.presskeytoclose"); addParameter("threshold", new FeatureParameter<Integer>("threshold", "Price Threshold", "The maximum price of item for chest to be closed. Default 1m", 1000000, "integer")); } - @Override + @DGEventHandler public void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent) { GuiScreen screen = Minecraft.getMinecraft().currentScreen; if (!isEnabled()) return; @@ -63,7 +62,7 @@ public class FeaturePressAnyKeyToCloseChest extends SimpleFeature implements Key } } - @Override + @DGEventHandler public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { GuiScreen screen = Minecraft.getMinecraft().currentScreen; if (!isEnabled()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java index eae9ca72..d55b65b1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java @@ -24,8 +24,8 @@ import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonEndListener; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonEndedEvent; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -36,7 +36,7 @@ import java.util.Collections; import java.util.List; import java.util.UUID; -public class FeatureWatcherWarning extends TextHUDFeature implements ChatListener, DungeonEndListener { +public class FeatureWatcherWarning extends TextHUDFeature { public FeatureWatcherWarning() { super("Dungeon.Blood Room","Watcher Spawn Alert", "Alert when watcher says 'That will be enough for now'", "dungen.watcherwarn", true, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT); @@ -68,7 +68,7 @@ public class FeatureWatcherWarning extends TextHUDFeature implements ChatListene return text; } - @Override + @DGEventHandler() public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.message.getFormattedText().equals("§r§c[BOSS] The Watcher§r§f: That will be enough for now.§r")) { warning = System.currentTimeMillis() + 2500; @@ -81,8 +81,8 @@ public class FeatureWatcherWarning extends TextHUDFeature implements ChatListene } } - @Override - public void onDungeonEnd() { + @DGEventHandler(ignoreDisabled = true) + public void onDungeonEnd(DungeonEndedEvent event) { warning = 0; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureAutoAcceptReparty.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureAutoAcceptReparty.java index 48acf890..15501951 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureAutoAcceptReparty.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureAutoAcceptReparty.java @@ -22,12 +22,12 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraftforge.client.event.ClientChatReceivedEvent; -public class FeatureAutoAcceptReparty extends SimpleFeature implements ChatListener { +public class FeatureAutoAcceptReparty extends SimpleFeature { public FeatureAutoAcceptReparty() { super("Party.Reparty", "Auto accept reparty", "Automatically accept reparty", "qol.autoacceptreparty", true); } @@ -35,7 +35,8 @@ public class FeatureAutoAcceptReparty extends SimpleFeature implements ChatListe SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private String lastDisband; - @Override + + @DGEventHandler(triggerOutOfSkyblock = true) public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.message.getFormattedText().endsWith("§ehas disbanded the party!§r")) { lastDisband = null; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java index e7712d3f..1360db60 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java @@ -20,8 +20,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiOpenListener; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -33,7 +33,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class FeatureCooldownCounter extends TextHUDFeature implements DungeonQuitListener, GuiOpenListener { +public class FeatureCooldownCounter extends TextHUDFeature { public FeatureCooldownCounter() { super("Dungeon", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); @@ -79,12 +79,12 @@ public class FeatureCooldownCounter extends TextHUDFeature implements DungeonQui return true; } - @Override - public void onDungeonQuit() { + @DGEventHandler + public void onDungeonQuit(DungeonLeftEvent event) { leftDungeonTime = System.currentTimeMillis(); } - @Override + @DGEventHandler public void onGuiOpen(GuiOpenEvent rendered) { if (!(rendered.gui instanceof GuiChest)) return; ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCopyMessages.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCopyMessages.java index 7b6141d2..465d8aee 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCopyMessages.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCopyMessages.java @@ -20,8 +20,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.event.ClickEvent; import net.minecraft.event.HoverEvent; @@ -29,12 +29,12 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraftforge.client.event.ClientChatReceivedEvent; -public class FeatureCopyMessages extends SimpleFeature implements ChatListener { +public class FeatureCopyMessages extends SimpleFeature { public FeatureCopyMessages() { super("Misc.Chat", "Copy Chat Messages", "Click on copy to copy", "etc.copymsg"); setEnabled(false); } - @Override + @DGEventHandler(triggerOutOfSkyblock = true) public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (!isEnabled()) return; if (clientChatReceivedEvent.type == 2) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java index f5f1a9fb..3112a703 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java @@ -20,19 +20,19 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.SoundListener; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraftforge.client.event.sound.PlaySoundEvent; -public class FeatureDecreaseExplosionSound extends SimpleFeature implements SoundListener { +public class FeatureDecreaseExplosionSound extends SimpleFeature { public FeatureDecreaseExplosionSound() { super("Misc", "Decrease Explosion sound effect", "Decreases volume of explosions while on skyblock", "qol.explosionsound"); addParameter("sound", new FeatureParameter<Float>("sound", "Sound Multiplier %", "The volume of explosion effect will be multiplied by this value. 0~100", 10.0f, "float")); } - @Override + @DGEventHandler public void onSound(PlaySoundEvent soundEvent) { if (!SkyblockStatus.isOnSkyblock()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDisableMessage.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDisableMessage.java index 4e504591..ac589202 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDisableMessage.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDisableMessage.java @@ -20,16 +20,16 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraftforge.client.event.ClientChatReceivedEvent; import java.util.regex.Pattern; -public class FeatureDisableMessage extends SimpleFeature implements ChatListener { +public class FeatureDisableMessage extends SimpleFeature { @Data @AllArgsConstructor public static class MessageData { @@ -62,7 +62,7 @@ public class FeatureDisableMessage extends SimpleFeature implements ChatListener } - @Override + @DGEventHandler() public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) return; if (!isEnabled()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java index e2de0794..a29b5431 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java @@ -21,17 +21,15 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessResult; import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.TickListener; import kr.syeyoung.dungeonsguide.mod.utils.ScoreBoardUtils; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import kr.syeyoung.dungeonsguide.mod.utils.TitleRender; import net.minecraft.client.Minecraft; import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; import java.util.Map; import java.util.Objects; @@ -42,7 +40,7 @@ import static kr.syeyoung.dungeonsguide.mod.chat.ChatProcessResult.REMOVE_CHAT; /** * CREDITS FOR THE COUNTDOWN SOUNDTRACK: <a href="https://www.youtube.com/watch?v=acCqrA-JxAw">...</a> */ -public class FeatureEpicCountdown extends SimpleFeature implements TickListener { +public class FeatureEpicCountdown extends SimpleFeature { static volatile long updatedAt; static volatile int secondsLeft; @@ -104,8 +102,8 @@ public class FeatureEpicCountdown extends SimpleFeature implements TickListener static final String GO_TEXT = "GO!!!"; String lastSec; - @SubscribeEvent - public void onTick(){ + @DGEventHandler + public void onTick(DGTickEvent event){ if(!isEnabled() || !DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; @@ -134,7 +132,7 @@ public class FeatureEpicCountdown extends SimpleFeature implements TickListener } - @SubscribeEvent + @DGEventHandler public void onRender(RenderGameOverlayEvent.Post postRender) { if (!isEnabled()) return; if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java index a9ccc5ed..c3429aee 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java @@ -21,9 +21,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import com.google.common.collect.ImmutableMap; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.PlayerRenderListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.TextureStichListener; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; @@ -48,13 +47,13 @@ import net.minecraftforge.client.model.obj.OBJModel; import java.io.IOException; -public class FeaturePenguins extends SimpleFeature implements PlayerRenderListener, TextureStichListener { +public class FeaturePenguins extends SimpleFeature { public FeaturePenguins() { super("Misc", "Penguins", "Awwww", "etc.penguin", false); OBJLoader.instance.addDomain("dungeonsguide"); } - @Override + @DGEventHandler public void onTextureStitch(TextureStitchEvent event) { if (event instanceof TextureStitchEvent.Pre) { objModel = null; @@ -80,7 +79,7 @@ public class FeaturePenguins extends SimpleFeature implements PlayerRenderListen private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private IBakedModel model; - @Override + @DGEventHandler public void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent) { if (!isEnabled()) return; @@ -164,8 +163,5 @@ public class FeaturePenguins extends SimpleFeature implements PlayerRenderListen } - @Override - public void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent) { - } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipDungeonStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipDungeonStat.java index 0835e3ec..dd4f3436 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipDungeonStat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipDungeonStat.java @@ -20,18 +20,18 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.TooltipListener; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.event.entity.player.ItemTooltipEvent; -public class FeatureTooltipDungeonStat extends SimpleFeature implements TooltipListener { +public class FeatureTooltipDungeonStat extends SimpleFeature { public FeatureTooltipDungeonStat() { super("Misc", "Dungeon Item Stats", "Shows quality of dungeon items (floor, percentage)", "tooltip.dungeonitem"); } - @Override + @DGEventHandler public void onTooltip(ItemTooltipEvent event) { if (!isEnabled()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipPrice.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipPrice.java index 67602844..42c7037b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipPrice.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipPrice.java @@ -19,9 +19,9 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.TooltipListener; import kr.syeyoung.dungeonsguide.mod.utils.AhUtils; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.item.ItemStack; @@ -33,14 +33,14 @@ import java.util.Comparator; import java.util.Set; import java.util.TreeSet; -public class FeatureTooltipPrice extends SimpleFeature implements TooltipListener { +public class FeatureTooltipPrice extends SimpleFeature { public FeatureTooltipPrice() { super("Misc.API Features", "Item Price", "Shows price of items", "tooltip.price"); addParameter("reqShift", new FeatureParameter<Boolean>("reqShift", "Require Shift", "If shift needs to be pressed in order for this feature to be activated", false, "boolean")); setEnabled(false); } - @Override + @DGEventHandler public void onTooltip(ItemTooltipEvent event) { if (!isEnabled()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureUpdateAlarm.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureUpdateAlarm.java index 3191c0ee..558e9259 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureUpdateAlarm.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureUpdateAlarm.java @@ -20,21 +20,22 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.StompConnectedListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.TickListener; import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentText; -public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedListener, TickListener { +public class FeatureUpdateAlarm extends SimpleFeature { public FeatureUpdateAlarm() { super("Misc", "Update Alarm","Show a warning in chat when a version has been released.", "etc.updatealarm", true); } private String stompPayload; - @Override - public void onTick() { + + @DGEventHandler + public void onTick(DGTickEvent event) { if (stompPayload != null) { ChatTransmitter.addToQueue(new ChatComponentText(stompPayload)); stompPayload = null; @@ -42,7 +43,7 @@ public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedL } } - @Override + @DGEventHandler(triggerOutOfSkyblock = true, ignoreDisabled = true) public void onStompConnected(StompConnectedEvent event) { event.getStompInterface().subscribe("/topic/updates", (stompClient ,payload) -> { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java index 5f3bcf58..33241613 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java @@ -21,9 +21,9 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.etc.ability; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.TickListener; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -39,7 +39,7 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; -public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListener, TickListener { +public class FeatureAbilityCooldown extends TextHUDFeature { public FeatureAbilityCooldown() { super("Misc", "View Ability Cooldowns", "A handy hud for viewing cooldown abilities", "etc.abilitycd2", false, 100, getFontRenderer().FONT_HEIGHT * 5); @@ -302,7 +302,8 @@ public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListen Pattern thePattern3 = Pattern.compile("§r§aUsed (.+)§r§a!§r"); private String lastActionbarAbility; - @Override + + @DGEventHandler() public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) { Matcher m = thePattern.matcher(clientChatReceivedEvent.message.getFormattedText()); @@ -388,8 +389,8 @@ public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListen } } - @Override - public void onTick() { + @DGEventHandler + public void onTick(DGTickEvent event) { EntityPlayerSP sp = Minecraft.getMinecraft().thePlayer; if (sp == null) return; if (sp.inventory == null || sp.inventory.armorInventory == null) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java index 6a3d4fdc..5db576be 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java @@ -20,14 +20,14 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.party; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListenerGlobal; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; -public class APIKey extends SimpleFeature implements ChatListenerGlobal { +public class APIKey extends SimpleFeature { public APIKey() { super("Misc.API Features", "API KEY", "Sets api key","partykicker.apikey"); @@ -39,7 +39,7 @@ public class APIKey extends SimpleFeature implements ChatListenerGlobal { } - @Override + @DGEventHandler(triggerOutOfSkyblock = true) public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) return; String str = clientChatReceivedEvent.message.getFormattedText(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java index d9fad104..faa2516f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java @@ -20,8 +20,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.party; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiPostRenderListener; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -37,12 +37,12 @@ import net.minecraftforge.client.event.GuiScreenEvent; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; -public class FeatureGoodParties extends SimpleFeature implements GuiPostRenderListener { +public class FeatureGoodParties extends SimpleFeature { public FeatureGoodParties() { super("Party Kicker", "Highlight parties in party viewer", "Highlight parties you can't join with red", "partykicker.goodparty",true); } - @Override + @DGEventHandler public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { if (!isEnabled()) return; if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java index fdb21f8c..d4cef1f3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java @@ -21,8 +21,8 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.party; import kr.syeyoung.dungeonsguide.mod.config.types.AColor; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonStartListener; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonStartedEvent; import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; @@ -33,7 +33,7 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; import java.util.*; -public class FeaturePartyReady extends TextHUDFeature implements ChatListener, DungeonStartListener { +public class FeaturePartyReady extends TextHUDFeature { public FeaturePartyReady() { super("Party","Party Ready List", "Check if your party member have said r or not", "party.readylist", false, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT*4); getStyles().add(new TextStyle("player", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); @@ -129,7 +129,7 @@ public class FeaturePartyReady extends TextHUDFeature implements ChatListener, D } - @Override + @DGEventHandler() public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { String txt = clientChatReceivedEvent.message.getFormattedText(); if (!txt.startsWith("§r§9Party §8>")) return; @@ -173,8 +173,8 @@ public class FeaturePartyReady extends TextHUDFeature implements ChatListener, D terminal.put(username, term); } - @Override - public void onDungeonStart() { + @DGEventHandler() + public void onDungeonStart(DungeonStartedEvent event) { ready.clear(); terminal.clear(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/FeatureCustomPartyFinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/FeatureCustomPartyFinder.java index a57cd23e..42f442cc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/FeatureCustomPartyFinder.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/FeatureCustomPartyFinder.java @@ -20,10 +20,9 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.party.customgui; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.WindowUpdateEvent; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiOpenListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiUpdateListener; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -35,7 +34,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.client.event.GuiOpenEvent; -public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenListener, GuiUpdateListener { +public class FeatureCustomPartyFinder extends SimpleFeature { public FeatureCustomPartyFinder() { super("Party","Custom Party Finder","Custom Party Finder", "party.customfinder", true); } @@ -51,7 +50,7 @@ public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenLi private String lastClass = ""; GuiCustomPartyFinder guiCustomPartyFinder; - @Override + @DGEventHandler public void onGuiOpen(GuiOpenEvent event) { if (event.gui == null) guiCustomPartyFinder = null; if (!isEnabled()) return; @@ -70,7 +69,7 @@ public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenLi event.gui = guiCustomPartyFinder; } - @Override + @DGEventHandler public void onGuiUpdate(WindowUpdateEvent windowUpdateEvent) { if (guiCustomPartyFinder != null) { guiCustomPartyFinder.onChestUpdate(windowUpdateEvent); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java index 2689ee58..ddc6ab3b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java @@ -32,6 +32,7 @@ import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; @@ -42,8 +43,6 @@ import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playe import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.DataRendererEditor; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.DataRendererRegistry; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiPostRenderListener; import kr.syeyoung.dungeonsguide.mod.party.PartyContext; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; @@ -78,7 +77,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; -public class FeatureViewPlayerStatsOnJoin extends SimpleFeature implements GuiPostRenderListener, GuiClickListener { +public class FeatureViewPlayerStatsOnJoin extends SimpleFeature { static Minecraft mc = Minecraft.getMinecraft(); protected Rectangle popupRect; @@ -156,7 +155,7 @@ public class FeatureViewPlayerStatsOnJoin extends SimpleFeature implements GuiPo }); } - @Override + @DGEventHandler public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { if (!(mc.currentScreen instanceof GuiChat)) { cancelRender(); @@ -474,7 +473,7 @@ public class FeatureViewPlayerStatsOnJoin extends SimpleFeature implements GuiPo shouldDraw = false; } - @Override + @DGEventHandler public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { ScaledResolution scaledResolution = new ScaledResolution(mc); int width = scaledResolution.getScaledWidth(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureBloodRush.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureBloodRush.java index 88873936..c9db77b0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureBloodRush.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureBloodRush.java @@ -20,21 +20,21 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.secret; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.KeybindPressedListener; import net.minecraft.util.ChatComponentText; import org.lwjgl.input.Keyboard; -public class FeatureBloodRush extends SimpleFeature implements KeybindPressedListener { +public class FeatureBloodRush extends SimpleFeature { public FeatureBloodRush() { super("Dungeon.Secrets.Blood Rush", "Blood Rush Mode", "Auto pathfind to witherdoors. \nCan be toggled with key set in settings", "secret.bloodrush", false); addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle Blood Rush", Keyboard.KEY_NONE, "keybind")); } - @Override + @DGEventHandler public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue()) { setEnabled(!isEnabled()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureFreezePathfind.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureFreezePathfind.java index 16dc46d2..71ce11f4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureFreezePathfind.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureFreezePathfind.java @@ -19,21 +19,21 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.secret; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.KeybindPressedListener; import net.minecraft.util.ChatComponentText; import org.lwjgl.input.Keyboard; -public class FeatureFreezePathfind extends SimpleFeature implements KeybindPressedListener { +public class FeatureFreezePathfind extends SimpleFeature { public FeatureFreezePathfind() { super("Dungeon.Secrets.Keybinds", "Global Freeze Pathfind", "Freeze Pathfind, meaning the pathfind lines won't change when you move.\nPress settings to edit the key", "secret.freezepathfind", false); addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle freeze pathfind", Keyboard.KEY_NONE, "keybind")); } - @Override + @DGEventHandler public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue()) { setEnabled(!isEnabled()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java index 1285d60b..a40db3c9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java @@ -33,8 +33,9 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoomInfoRegistry; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; +import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.features.listener.TickListener; import kr.syeyoung.dungeonsguide.mod.features.text.*; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; @@ -55,7 +56,7 @@ import java.util.List; import java.util.*; import java.util.function.Predicate; -public class FeatureSoulRoomWarning extends TextHUDFeature implements TickListener { +public class FeatureSoulRoomWarning extends TextHUDFeature { public FeatureSoulRoomWarning() { super("Dungeon.HUDs","Secret Soul Alert", "Alert if there is an fairy soul in the room", "secret.fairysoulwarn", true, getFontRenderer().getStringWidth("There is a fairy soul in this room!"), getFontRenderer().FONT_HEIGHT); @@ -89,8 +90,8 @@ public class FeatureSoulRoomWarning extends TextHUDFeature implements TickListen } - @Override - public void onTick() { + @DGEventHandler + public void onTick(DGTickEvent event) { if (!skyblockStatus.isOnDungeon()) return; if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() == null || !DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getMapProcessor().isInitialized()) return; DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureTogglePathfind.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureTogglePathfind.java index bd8f01c6..f77da653 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureTogglePathfind.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureTogglePathfind.java @@ -20,21 +20,21 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.secret; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.KeybindPressedListener; import net.minecraft.util.ChatComponentText; import org.lwjgl.input.Keyboard; -public class FeatureTogglePathfind extends SimpleFeature implements KeybindPressedListener { +public class FeatureTogglePathfind extends SimpleFeature { public FeatureTogglePathfind() { super("Dungeon.Secrets.Keybinds", "Toggle Pathfind Lines", "A key for toggling pathfound line visibility.\nPress settings to edit the key", "secret.togglePathfind"); addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle pathfind lines", Keyboard.KEY_NONE, "keybind")); } public boolean togglePathfindStatus = false; - @Override + @DGEventHandler public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue() && isEnabled()) { togglePathfindStatus = !togglePathfindStatus; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java index c86057db..4be32934 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java @@ -26,11 +26,9 @@ import kr.syeyoung.dungeonsguide.mod.config.types.GUIRectangle; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.GuiPreRenderListener; -import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton; import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement; @@ -41,6 +39,8 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.MathHelper; import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; @@ -50,7 +50,7 @@ import java.io.IOException; import java.util.List; import java.util.Optional; -public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderListener, GuiClickListener, WorldRenderListener { +public class FeatureMechanicBrowse extends GuiFeature { public FeatureMechanicBrowse() { super("Dungeon.Secrets.Secret Browser","Secret Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); addParameter("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float")); @@ -89,13 +89,13 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis private int lastWidth, lastHeight; @Override - public void drawScreen(float partialTicks) { + public void drawScreen(RenderGameOverlayEvent.Post post) { if (!isEnabled()) return; int i = Mouse.getEventX(); int j = Minecraft.getMinecraft().displayHeight - Mouse.getEventY(); if (Minecraft.getMinecraft().displayWidth != lastWidth || Minecraft.getMinecraft().displayHeight != lastHeight) mGuiMechanicBrowser.initGui(); lastWidth = Minecraft.getMinecraft().displayWidth; lastHeight = Minecraft.getMinecraft().displayHeight; - mGuiMechanicBrowser.drawScreen(i,j,partialTicks); + mGuiMechanicBrowser.drawScreen(i,j,post.partialTicks); } @Override @@ -107,7 +107,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis @Override public void drawHUD(float partialTicks) { } - @Override + @DGEventHandler public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { if (!isEnabled()) return; try { @@ -118,7 +118,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis } - @Override + @DGEventHandler public void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered) { if (!isEnabled()) return; int i = Mouse.getEventX(); @@ -126,8 +126,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis mGuiMechanicBrowser.drawScreen(i, j, rendered.renderPartialTicks); } - @Override - public void drawWorld(float partialTicks) { + @DGEventHandler + public void drawWorld(RenderWorldLastEvent event) { + float partialTicks = event.partialTicks; if (!isEnabled()) return; SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/BossroomEnterListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/BossroomEnterListener.java deleted file mode 100644 index 5de1e891..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/BossroomEnterListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface BossroomEnterListener { - void onBossroomEnter(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListener.java deleted file mode 100644 index fae18924..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public interface ChatListener { - void onChat(ClientChatReceivedEvent clientChatReceivedEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListenerGlobal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListenerGlobal.java deleted file mode 100644 index 60eed29b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListenerGlobal.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public interface ChatListenerGlobal { - void onChat(ClientChatReceivedEvent clientChatReceivedEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonContextInitializationListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonContextInitializationListener.java deleted file mode 100644 index a234fa61..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonContextInitializationListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface DungeonContextInitializationListener { - void onDungeonInitialize(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonEndListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonEndListener.java deleted file mode 100644 index c9ca0caa..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonEndListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface DungeonEndListener { - void onDungeonEnd(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonQuitListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonQuitListener.java deleted file mode 100644 index fc0e114f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonQuitListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface DungeonQuitListener { - void onDungeonQuit(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonStartListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonStartListener.java deleted file mode 100644 index d0674daf..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonStartListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface DungeonStartListener { - void onDungeonStart(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/EntityLivingRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/EntityLivingRenderListener.java deleted file mode 100644 index f13c29f0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/EntityLivingRenderListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.RenderLivingEvent; - -public interface EntityLivingRenderListener { - void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent); - void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiBackgroundRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiBackgroundRenderListener.java deleted file mode 100644 index abaf900c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiBackgroundRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiBackgroundRenderListener { - void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiClickListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiClickListener.java deleted file mode 100644 index d3816c3e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiClickListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiClickListener { - void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiOpenListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiOpenListener.java deleted file mode 100644 index bb8b8348..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiOpenListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.GuiOpenEvent; - -public interface GuiOpenListener { - void onGuiOpen(GuiOpenEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPostRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPostRenderListener.java deleted file mode 100644 index 2cd249f5..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPostRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiPostRenderListener { - void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPreRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPreRenderListener.java deleted file mode 100644 index 848267c3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPreRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiPreRenderListener { - void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiUpdateListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiUpdateListener.java deleted file mode 100644 index 633f1542..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiUpdateListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import kr.syeyoung.dungeonsguide.mod.events.impl.WindowUpdateEvent; - -public interface GuiUpdateListener { - void onGuiUpdate(WindowUpdateEvent windowUpdateEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/InteractListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/InteractListener.java deleted file mode 100644 index 0dcbc19d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/InteractListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -public interface InteractListener { - void onInteract(PlayerInteractEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeyInputListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeyInputListener.java deleted file mode 100644 index bba7862b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeyInputListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface KeyInputListener { - void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeybindPressedListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeybindPressedListener.java deleted file mode 100644 index d0966183..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeybindPressedListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; - -public interface KeybindPressedListener { - void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/PlayerRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/PlayerRenderListener.java deleted file mode 100644 index 40961ced..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/PlayerRenderListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.RenderPlayerEvent; - -public interface PlayerRenderListener { - void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent ); - void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent ); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ScreenRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ScreenRenderListener.java deleted file mode 100644 index 4a69b8eb..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ScreenRenderListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface ScreenRenderListener { - void drawScreen(float partialTicks); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockJoinListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockJoinListener.java deleted file mode 100644 index d2d996e9..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockJoinListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface SkyblockJoinListener { - void onSkyblockJoin(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockLeaveListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockLeaveListener.java deleted file mode 100644 index e1d95775..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockLeaveListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface SkyblockLeaveListener { - void onSkyblockQuit(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SoundListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SoundListener.java deleted file mode 100644 index 9cd4b2fe..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SoundListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.sound.PlaySoundEvent; - -public interface SoundListener { - void onSound(PlaySoundEvent playSoundEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/StompConnectedListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/StompConnectedListener.java deleted file mode 100644 index 3772f780..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/StompConnectedListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; - -public interface StompConnectedListener { - void onStompConnected(StompConnectedEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TextureStichListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TextureStichListener.java deleted file mode 100644 index 5c54eb9e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TextureStichListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.client.event.TextureStitchEvent; - -public interface TextureStichListener { - void onTextureStitch(TextureStitchEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TickListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TickListener.java deleted file mode 100644 index 436ea23d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TickListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface TickListener { - void onTick(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TitleListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TitleListener.java deleted file mode 100644 index ec402a96..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TitleListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraft.network.play.server.S45PacketTitle; - -public interface TitleListener { - void onTitle(S45PacketTitle renderPlayerEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TooltipListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TooltipListener.java deleted file mode 100644 index f2f73c62..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TooltipListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -public interface TooltipListener { - void onTooltip(ItemTooltipEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/WorldRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/WorldRenderListener.java deleted file mode 100644 index 40b8e338..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/WorldRenderListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.features.listener; - -public interface WorldRenderListener { - void drawWorld(float partialTicks); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java index bc309045..3f852e63 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java @@ -70,7 +70,9 @@ public class StyledTextRenderer { String str = lines[i]; Dimension d = null; try { + Minecraft.getMinecraft().mcProfiler.startSection("drawing fragment"); d = drawFragmentText(fr, str, ts, currX, currY, false); + Minecraft.getMinecraft().mcProfiler.endSection(); } catch (InvocationTargetException | IllegalAccessException e) { e.printStackTrace(); } @@ -149,8 +151,10 @@ public class StyledTextRenderer { Gui.drawRect(x,y, x+fr.getStringWidth(content), y + fr.FONT_HEIGHT, bgColor); + Minecraft.getMinecraft().mcProfiler.startSection("reflection"); posX.set(fr, x+1); posY.set(fr, y+1); + Minecraft.getMinecraft().mcProfiler.endSection(); if (style.isShadow()) { char[] charArr = content.toCharArray(); @@ -162,8 +166,10 @@ public class StyledTextRenderer { width +=renderChar(fr, charArr[i], color,true, false, false, false); } } + Minecraft.getMinecraft().mcProfiler.startSection("reflection"); posX.set(fr, x); posY.set(fr, y); + Minecraft.getMinecraft().mcProfiler.endSection(); { char[] charArr = content.toCharArray(); float width = 0; @@ -204,20 +210,27 @@ public class StyledTextRenderer { if (flag) { + Minecraft.getMinecraft().mcProfiler.startSection("reflection"); posX.set(fr,(float) posX.get(fr) - f1); posY.set(fr,(float) posY.get(fr) - f1); + Minecraft.getMinecraft().mcProfiler.endSection(); } + Minecraft.getMinecraft().mcProfiler.startSection("render"); float f = (float) renderChar.invoke(fr, character, italicStyle); + Minecraft.getMinecraft().mcProfiler.endSection(); if (flag) { + Minecraft.getMinecraft().mcProfiler.startSection("reflection"); posX.set(fr,(float) posX.get(fr) + f1); posY.set(fr,(float) posY.get(fr) + f1); + Minecraft.getMinecraft().mcProfiler.endSection(); } if (boldStyle) { + Minecraft.getMinecraft().mcProfiler.startSection("reflection"); posX.set(fr,(float) posX.get(fr) + f1); if (flag) @@ -225,8 +238,12 @@ public class StyledTextRenderer { posX.set(fr,(float) posX.get(fr) - f1); posY.set(fr,(float) posY.get(fr) - f1); } + Minecraft.getMinecraft().mcProfiler.endSection(); + Minecraft.getMinecraft().mcProfiler.startSection("render"); renderChar.invoke(fr, character, italicStyle); + Minecraft.getMinecraft().mcProfiler.endSection(); + Minecraft.getMinecraft().mcProfiler.startSection("reflection"); posX.set(fr,(float) posX.get(fr) - f1); if (flag) @@ -235,9 +252,13 @@ public class StyledTextRenderer { posY.set(fr,(float) posY.get(fr) + f1); } + Minecraft.getMinecraft().mcProfiler.endSection(); + ++f; } + Minecraft.getMinecraft().mcProfiler.startSection("do Draw"); doDraw.invoke(fr, f); + Minecraft.getMinecraft().mcProfiler.endSection(); return f; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/AhUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/AhUtils.java index b28b97a5..63cf592c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/AhUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/AhUtils.java @@ -23,7 +23,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager; import kr.syeyoung.dungeonsguide.launcher.auth.AuthUtil; -import kr.syeyoung.dungeonsguide.mod.events.impl.AuthChangedEvent; +import kr.syeyoung.dungeonsguide.launcher.events.AuthChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; |