aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
blob: 39f0d04d9916fd3b8d96c4dfa2c041336337e120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
package at.hannibal2.skyhanni;

import at.hannibal2.skyhanni.api.CollectionAPI;
import at.hannibal2.skyhanni.config.ConfigManager;
import at.hannibal2.skyhanni.config.Features;
import at.hannibal2.skyhanni.config.commands.Commands;
import at.hannibal2.skyhanni.data.*;
import at.hannibal2.skyhanni.data.repo.RepoManager;
import at.hannibal2.skyhanni.events.FirstConfigLoadedEvent;
import at.hannibal2.skyhanni.features.anvil.AnvilCombineHelper;
import at.hannibal2.skyhanni.features.bazaar.*;
import at.hannibal2.skyhanni.features.bingo.BingoCardDisplay;
import at.hannibal2.skyhanni.features.bingo.BingoNextStepHelper;
import at.hannibal2.skyhanni.features.bingo.CompactBingoChat;
import at.hannibal2.skyhanni.features.bingo.MinionCraftHelper;
import at.hannibal2.skyhanni.features.chat.ChatFilter;
import at.hannibal2.skyhanni.features.chat.PlayerDeathMessages;
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter;
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatModifier;
import at.hannibal2.skyhanni.features.commands.WikiCommand;
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager;
import at.hannibal2.skyhanni.features.dungeon.*;
import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper;
import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowHelper;
import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowParticleFinder;
import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow;
import at.hannibal2.skyhanni.features.fishing.*;
import at.hannibal2.skyhanni.features.garden.*;
import at.hannibal2.skyhanni.features.inventory.*;
import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles;
import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown;
import at.hannibal2.skyhanni.features.minion.MinionFeatures;
import at.hannibal2.skyhanni.features.misc.*;
import at.hannibal2.skyhanni.features.misc.tiarelay.TiaRelayHelper;
import at.hannibal2.skyhanni.features.misc.tiarelay.TiaRelayWaypoints;
import at.hannibal2.skyhanni.features.mobs.AreaMiniBossFeatures;
import at.hannibal2.skyhanni.features.mobs.MobHighlight;
import at.hannibal2.skyhanni.features.nether.ashfang.*;
import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper;
import at.hannibal2.skyhanni.features.slayer.EndermanSlayerBeacon;
import at.hannibal2.skyhanni.features.slayer.HideMobNames;
import at.hannibal2.skyhanni.features.slayer.HighlightSlayerMiniBoss;
import at.hannibal2.skyhanni.features.slayer.SlayerQuestWarning;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerClearView;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerDaggerHelper;
import at.hannibal2.skyhanni.features.slayer.blaze.BlazeSlayerFirePitsWarning;
import at.hannibal2.skyhanni.features.slayer.blaze.HellionShieldHelper;
import at.hannibal2.skyhanni.features.summonings.SummoningMobManager;
import at.hannibal2.skyhanni.features.summonings.SummoningSoulsName;
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper;
import at.hannibal2.skyhanni.test.LorenzTest;
import at.hannibal2.skyhanni.test.PacketTest;
import at.hannibal2.skyhanni.utils.MinecraftConsoleFilter;
import at.hannibal2.skyhanni.utils.TabListData;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlinx.coroutines.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;
import java.util.List;

@Mod(modid = SkyHanniMod.MODID, version = SkyHanniMod.VERSION, clientSideOnly = true, useMetadata = true,
        guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop",
        dependencies = SkyHanniMod.DEPENDENCIES)
public class SkyHanniMod {

    public static final String MODID = "skyhanni";
    public static final String VERSION = "0.17.Beta.22";
    public static final String DEPENDENCIES = "after:notenoughupdates@[2.1.1,);";


    public static Features feature;

    public static RepoManager repo;
    public static ConfigManager configManager;
    private static Logger logger;

    public static List<Object> modules = new ArrayList<>();
    public static Job globalJob = JobKt.Job(null);
    public static CoroutineScope coroutineScope =
            CoroutineScopeKt.CoroutineScope(
                    EmptyCoroutineContext.INSTANCE
                            .plus(new CoroutineName("SkyHanni")) // I love calling KotLin from JaVa
                            .plus(SupervisorKt.SupervisorJob(globalJob)));

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        logger = LogManager.getLogger("SkyHanni");

        // utils
        loadModule(this);
        loadModule(new ChatManager());
        loadModule(new HyPixelData());
        loadModule(new DungeonData());
        loadModule(new ScoreboardData());
        loadModule(new ApiDataLoader());
        loadModule(new SeaCreatureManager());
        loadModule(new ItemRenderBackground());
        loadModule(new EntityData());
        loadModule(new EntityMovementData());
        loadModule(new ItemClickData());
        loadModule(new MinecraftData());
        loadModule(new SendTitleHelper());
        loadModule(new ItemTipHelper());
        loadModule(new RenderLivingEntityHelper());
        loadModule(new SkillExperience());
        loadModule(new InventoryData());
        loadModule(new TabListData());
        loadModule(new RenderGuiData());
        loadModule(new GardenCropMilestones());
        loadModule(new OwnInventoryData());
        loadModule(new ToolTipData());

        // APIs
        loadModule(new BazaarApi());
        loadModule(new GardenAPI());
        loadModule(new CollectionAPI());

        // features
        loadModule(new BazaarOrderHelper());
        loadModule(new AuctionsHighlighter());
        loadModule(new ChatFilter());
        loadModule(new PlayerChatModifier());
        loadModule(new DungeonChatFilter());
        loadModule(new HideNotClickableItems());
        loadModule(new ItemDisplayOverlayFeatures());
        loadModule(new CurrentPetDisplay());
        loadModule(new ExpBottleOnGroundHider());
        loadModule(new DamageIndicatorManager());
        loadModule(new ItemAbilityCooldown());
        loadModule(new DungeonHighlightClickedBlocks());
        loadModule(new DungeonMilestonesDisplay());
        loadModule(new DungeonDeathCounter());
        loadModule(new DungeonCleanEnd());
        loadModule(new DungeonBossMessages());
        loadModule(new DungeonBossHideDamageSplash());
        loadModule(new TrophyFishMessages());
        loadModule(new BazaarBestSellMethod());
        loadModule(new AnvilCombineHelper());
        loadModule(new SeaCreatureMessageShortener());
//        registerEvent(new GriffinBurrowFinder());
        loadModule(new AshfangFreezeCooldown());
        loadModule(new AshfangNextResetCooldown());
        loadModule(new SummoningSoulsName());
        loadModule(new AshfangGravityOrbs());
        loadModule(new AshfangBlazingSouls());
        loadModule(new AshfangBlazes());
        loadModule(new AshfangHideParticles());
        loadModule(new AshfangHideDamageIndicator());
        loadModule(new ItemStars());
        loadModule(new MinionFeatures());
        loadModule(new RealTime());
        loadModule(new RngMeterInventory());
        loadModule(new WikiCommand());
        loadModule(new SummoningMobManager());
        loadModule(new AreaMiniBossFeatures());
        loadModule(new MobHighlight());
        loadModule(new MarkedPlayerManager());
        loadModule(new HighlightSlayerMiniBoss());
        loadModule(new PlayerDeathMessages());
        loadModule(new HighlightDungeonDeathmite());
        loadModule(new DungeonHideItems());
        loadModule(new DungeonCopilot());
        loadModule(new EndermanSlayerBeacon());
        loadModule(new FireVeilWandParticles());
        loadModule(new HideMobNames());
        loadModule(new HideDamageSplash());
        loadModule(new ThunderSparksHighlight());
        loadModule(new BlazeSlayerDaggerHelper());
        loadModule(new HellionShieldHelper());
        loadModule(new BlazeSlayerFirePitsWarning());
        loadModule(new BlazeSlayerClearView());
        loadModule(new PlayerChatFilter());
        loadModule(new HideArmor());
        loadModule(new SlayerQuestWarning());
        loadModule(new StatsTuning());
        loadModule(new NonGodPotEffectDisplay());
        loadModule(new SoopyGuessBurrow());
        loadModule(new GriffinBurrowHelper());
        loadModule(new GriffinBurrowParticleFinder());
        loadModule(new BurrowWarpHelper());
        loadModule(new CollectionCounter());
        loadModule(new HighlightBonzoMasks());
        loadModule(new DungeonLevelColor());
        loadModule(new BazaarCancelledBuyOrderClipboard());
        loadModule(new CompactSplashPotionMessage());
        loadModule(new CroesusUnopenedChestTracker());
        loadModule(new CompactBingoChat());
        loadModule(new BrewingStandOverlay());
        loadModule(new BazaarUpdateTimer());
        loadModule(new BarnFishingTimer());
        loadModule(new CrimsonIsleReputationHelper(this));
        loadModule(new SharkFishCounter());
        loadModule(new SkyBLockLevelGuideHelper());
        loadModule(new OdgerWaypoint());
        loadModule(new TiaRelayHelper());
        loadModule(new TiaRelayWaypoints());
        loadModule(new BingoCardDisplay());
        loadModule(new BingoNextStepHelper());
        loadModule(new MinionCraftHelper());
        loadModule(new TpsCounter());
        loadModule(new ParticleHider());
        loadModule(new MiscFeatures());
        loadModule(new SkyMartBestProfit());
        loadModule(new GardenVisitorFeatures());
        loadModule(new GardenInventoryNumbers());
        loadModule(new GardenVisitorTimer());
        loadModule(new GardenNextPlotPrice());
        loadModule(new GardenCropMilestoneDisplay());
        loadModule(new GardenCustomKeybinds());
        loadModule(new ChickenHeadTimer());
        loadModule(new GardenOptimalSpeed());
        loadModule(new GardenDeskInSBMenu());
        loadModule(new GardenLevelDisplay());
        loadModule(new EliteFarmingWeight());
        loadModule(new DicerRngDropCounter());
        loadModule(new CropMoneyDisplay());
        loadModule(new JacobFarmingContestsInventory());
        loadModule(new GardenNextJacobContest());
        loadModule(new WrongFungiCutterWarning());

        Commands.INSTANCE.init();

        loadModule(new LorenzTest());
        loadModule(new ButtonOnPause());
        loadModule(new PacketTest());

        configManager = new ConfigManager();
        configManager.firstLoad();
        new FirstConfigLoadedEvent().postAndCatch();

        MinecraftConsoleFilter.Companion.initLogging();

        Runtime.getRuntime().addShutdownHook(new Thread(configManager::saveConfig));

        repo = new RepoManager(configManager.getConfigDirectory());
        repo.loadRepoInformation();
    }

    public void loadModule(Object object) {
        modules.add(object);
        MinecraftForge.EVENT_BUS.register(object);
    }

    public static GuiScreen screenToOpen = null;
    private static int screenTicks = 0;

    @SubscribeEvent
    public void onClientTick(TickEvent.ClientTickEvent event) {
        if (screenToOpen != null) {
            screenTicks++;
            if (screenTicks == 5) {
                Minecraft.getMinecraft().displayGuiScreen(screenToOpen);
                screenTicks = 0;
                screenToOpen = null;
            }
        }
    }

    public static void consoleLog(String message) {
        if (logger != null) {
            logger.log(Level.INFO, message);
        } else {
            System.out.println("consoleLog: (" + message + ")");
        }
    }
}