Some bug fixes and Title display when game starts

This commit is contained in:
NK 2023-02-25 23:26:56 +00:00
parent 49657c4fd1
commit 2547cf6c8b
6 changed files with 33 additions and 14 deletions

View file

@ -4,13 +4,12 @@ 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 com.mojang.realmsclient.gui.ChatFormatting; import com.mojang.realmsclient.gui.ChatFormatting;
import me.night0721.lilase.features.ah.AHConfig;
import me.night0721.lilase.events.PacketReceivedEvent; import me.night0721.lilase.events.PacketReceivedEvent;
import me.night0721.lilase.features.ah.AuctionHouse;
import me.night0721.lilase.features.flip.Flipper;
import me.night0721.lilase.utils.KeyBindingManager;
import me.night0721.lilase.events.SniperFlipperEvents; import me.night0721.lilase.events.SniperFlipperEvents;
import me.night0721.lilase.features.ah.AHConfig;
import me.night0721.lilase.features.ah.AuctionHouse;
import me.night0721.lilase.utils.ConfigUtils; import me.night0721.lilase.utils.ConfigUtils;
import me.night0721.lilase.utils.KeyBindingManager;
import me.night0721.lilase.utils.Utils; 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;
@ -25,7 +24,6 @@ import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.opengl.Display;
import java.io.IOException; import java.io.IOException;
@ -45,14 +43,14 @@ public class Lilase {
@Mod.EventHandler @Mod.EventHandler
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
KeyBindingManager keyBindingManager = new KeyBindingManager();
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new KeyBindingManager()); MinecraftForge.EVENT_BUS.register(keyBindingManager);
MinecraftForge.EVENT_BUS.register(new SniperFlipperEvents()); MinecraftForge.EVENT_BUS.register(new SniperFlipperEvents());
EventManager.INSTANCE.register(this); EventManager.INSTANCE.register(this);
ConfigUtils.register(); ConfigUtils.register();
auctionHouse = new AuctionHouse(); auctionHouse = new AuctionHouse();
KeyBindingManager.registerKeyBindings(); keyBindingManager.registerKeyBindings();
Display.setTitle("Lilase v" + VERSION + " | night0721");
} }
@Subscribe @Subscribe

View file

@ -193,7 +193,7 @@ public class SniperFlipperEvents {
} }
@SubscribeEvent @SubscribeEvent
public void onWindowClick(PacketReceivedEvent event) { public void onPacketReceive(PacketReceivedEvent event) {
if (event.packet instanceof S33PacketUpdateSign && Utils.checkInHub() && Flipper.state.equals(START)) { if (event.packet instanceof S33PacketUpdateSign && Utils.checkInHub() && Flipper.state.equals(START)) {
new Thread(() -> { new Thread(() -> {
try { try {

View file

@ -202,12 +202,12 @@ public class AuctionHouse {
public void toggleAuction() { public void toggleAuction() {
if (open) { if (open) {
Utils.sendMessage("Stopped Auction House"); Utils.sendMessage("Stopped AH Sniper");
open = false; open = false;
UngrabUtils.regrabMouse(); UngrabUtils.regrabMouse();
} else { } else {
if (Utils.checkInHub()) { if (Utils.checkInHub()) {
Utils.sendMessage("Started Auction House"); Utils.sendMessage("Started AH Sniper");
open = true; open = true;
UngrabUtils.ungrabMouse(); UngrabUtils.ungrabMouse();
} else Utils.sendMessage("Detected not in hub, please go to hub to start"); } else Utils.sendMessage("Detected not in hub, please go to hub to start");

View file

@ -0,0 +1,18 @@
package me.night0721.lilase.mixins;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.Display;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static me.night0721.lilase.Lilase.VERSION;
@Mixin({Minecraft.class})
public class MixinMinecraft {
@Inject(method = {"startGame"}, at = {@At("RETURN")})
private void startGame(CallbackInfo ci) {
Display.setTitle("Lilase v" + VERSION + " | night0721");
}
}

View file

@ -8,10 +8,10 @@ import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
public class KeyBindingManager { public class KeyBindingManager {
private static final KeyBinding[] keyBindings = new KeyBinding[4]; private final KeyBinding[] keyBindings = new KeyBinding[2];
public static void registerKeyBindings() { public void registerKeyBindings() {
keyBindings[0] = new KeyBinding("Auction House Toggle", Keyboard.KEY_END, Lilase.MOD_NAME); keyBindings[0] = new KeyBinding("Sniper Toggle", Keyboard.KEY_END, Lilase.MOD_NAME);
keyBindings[1] = new KeyBinding("Config", Keyboard.KEY_MULTIPLY, Lilase.MOD_NAME); keyBindings[1] = new KeyBinding("Config", Keyboard.KEY_MULTIPLY, Lilase.MOD_NAME);
for (KeyBinding keyBinding : keyBindings) { for (KeyBinding keyBinding : keyBindings) {
ClientRegistry.registerKeyBinding(keyBinding); ClientRegistry.registerKeyBinding(keyBinding);

View file

@ -6,5 +6,8 @@
"minVersion": "0.8.2", "minVersion": "0.8.2",
"mixins": [ "mixins": [
"MixinNetworkManager" "MixinNetworkManager"
],
"client": [
"MixinMinecraft"
] ]
} }