This commit is contained in:
NK 2023-03-13 16:57:43 +00:00
parent 2f18fadd79
commit 79d8fa3a4a

View file

@ -4,12 +4,15 @@ import cc.polyfrost.oneconfig.events.EventManager;
import cc.polyfrost.oneconfig.events.event.InitializationEvent; import cc.polyfrost.oneconfig.events.event.InitializationEvent;
import cc.polyfrost.oneconfig.libs.eventbus.Subscribe; import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
import me.night0721.lilase.config.AHConfig; import me.night0721.lilase.config.AHConfig;
import me.night0721.lilase.config.ConfigUtils; import me.night0721.lilase.config.ConfigHandler;
import me.night0721.lilase.events.SniperFlipperEvents; import me.night0721.lilase.events.SniperFlipperEvents;
import me.night0721.lilase.features.cofl.Cofl;
import me.night0721.lilase.features.sniper.PageFlipper;
import me.night0721.lilase.features.sniper.Sniper; import me.night0721.lilase.features.sniper.Sniper;
import me.night0721.lilase.gui.ImageRenderer; import me.night0721.lilase.gui.ImageRenderer;
import me.night0721.lilase.utils.Clock; import me.night0721.lilase.utils.Clock;
import me.night0721.lilase.utils.KeyBindingManager; import me.night0721.lilase.utils.KeyBindingManager;
import me.night0721.lilase.utils.Utils;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiDisconnected; import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiMainMenu;
@ -24,7 +27,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.io.IOException; import java.io.IOException;
import static me.night0721.lilase.config.AHConfig.AUCTION_HOUSE_DELAY;
import static me.night0721.lilase.config.AHConfig.RECONNECT_DELAY; import static me.night0721.lilase.config.AHConfig.RECONNECT_DELAY;
@Mod(modid = Lilase.MODID, name = Lilase.MOD_NAME, version = Lilase.VERSION, acceptedMinecraftVersions = "[1.8.9]") @Mod(modid = Lilase.MODID, name = Lilase.MOD_NAME, version = Lilase.VERSION, acceptedMinecraftVersions = "[1.8.9]")
@ -34,13 +36,17 @@ public class Lilase {
public static final String VERSION = "1.0.26"; public static final String VERSION = "1.0.26";
public static final Minecraft mc = Minecraft.getMinecraft(); public static final Minecraft mc = Minecraft.getMinecraft();
public static Sniper sniper; public static Sniper sniper;
public static PageFlipper pageFlipper;
public static Cofl cofl;
public static AHConfig config; public static AHConfig config;
public static ConfigHandler configHandler;
private int tickAmount; private int tickAmount;
private final Clock clock = new Clock(); private final Clock clock = new Clock();
@Mod.EventHandler @Mod.EventHandler
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
ConfigUtils.register(); configHandler = new ConfigHandler();
configHandler.init();
KeyBindingManager keyBindingManager = new KeyBindingManager(); KeyBindingManager keyBindingManager = new KeyBindingManager();
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(keyBindingManager); MinecraftForge.EVENT_BUS.register(keyBindingManager);
@ -48,7 +54,10 @@ public class Lilase {
MinecraftForge.EVENT_BUS.register(new ImageRenderer()); MinecraftForge.EVENT_BUS.register(new ImageRenderer());
EventManager.INSTANCE.register(this); EventManager.INSTANCE.register(this);
sniper = new Sniper(); sniper = new Sniper();
pageFlipper = new PageFlipper();
keyBindingManager.registerKeyBindings(); keyBindingManager.registerKeyBindings();
cofl = new Cofl();
cofl.onOpen();
} }
@Subscribe @Subscribe
@ -60,14 +69,14 @@ public class Lilase {
public void onTick(TickEvent.ClientTickEvent event) throws IOException { public void onTick(TickEvent.ClientTickEvent event) throws IOException {
if (mc.thePlayer == null || event.phase != TickEvent.Phase.START) return; if (mc.thePlayer == null || event.phase != TickEvent.Phase.START) return;
tickAmount++; tickAmount++;
if (tickAmount % (20 * AUCTION_HOUSE_DELAY) == 0) sniper.getItem(); if (tickAmount % 20 == 0) Utils.checkFooter();
if (tickAmount % 2400 == 0) ConfigUtils.checkWebhookAndAPI(); if (tickAmount % (20 * 60) == 0) sniper.start();
if (tickAmount % 2400 == 0) configHandler.checkWebhookAndAPI();
if (pageFlipper != null) pageFlipper.switchStates();
if (Sniper.flipper != null) Sniper.flipper.switchStates(); if (Sniper.flipper != null) Sniper.flipper.switchStates();
if (mc.currentScreen instanceof GuiDisconnected) { if (mc.currentScreen instanceof GuiDisconnected && clock.passed()) {
if (clock.passed()) { clock.schedule(RECONNECT_DELAY * 1000L);
clock.schedule(RECONNECT_DELAY * 1000L); FMLClientHandler.instance().connectToServer(new GuiMultiplayer(new GuiMainMenu()), new ServerData(" ", "mc.hypixel.net", false));
FMLClientHandler.instance().connectToServer(new GuiMultiplayer(new GuiMainMenu()), new ServerData(" ", "mc.hypixel.net", false));
}
} }
} }
} }