check changelogs in README.md

This commit is contained in:
NK 2023-02-25 03:12:49 +00:00
parent 4e46c40d73
commit 1178a6ec10
17 changed files with 481 additions and 232 deletions

View file

@ -8,10 +8,20 @@ Forge mod will automatiaclly buy item according to your configuration, and send
- Can customise fetch time (the faster, the higher chance to get the item you want)
- Webhook system to send you that an item has been bought
- Failsafe in Limbo
- Auto reconnect to server when disconnected
- Auto skip confirmation screen
- GUI showing coordinates, fps and clock and more error
- Auto ungrab mouse when sniping/flipping
# Changelog:
- v1.0.1-beta - Initial Release, with auto buy
- v1.0.2 - Added flipper, profit check, auto post
- v1.0.21 -
Auto reconnect to server when disconnected
ungrab mouse when sniping/flipping
auto skip confirmation screen, with GUI showing coord fps and time and more error catching
however config still broken, keep using Lilase.cfg first. Will fix config and discord in next update
# Example Config:
```cfg
@ -38,12 +48,14 @@ item3 {
S:Type=
}
main {
S:APIKey=Paste your API key here
I:AuctionHouseDelay=15
B:GUI=true
I:GUI_COLOR=-7237653
I:Multiplier=400
I:ReconnectDelay=20
S:Webhook=Paste your webhook here
B:checkMultiplierBeforeBuy=false
B:checkMultiplierBeforeBuy=true
}
```

View file

@ -21,7 +21,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "org.spongepowered.mixin"
version = "1.0.2"
version = "1.0.21"
group = "me.night0721.lilase"
archivesBaseName = "Lilase"
sourceCompatibility = 1.8

View file

@ -8,14 +8,19 @@ import me.night0721.lilase.config.AHConfig;
import me.night0721.lilase.events.PacketReceivedEvent;
import me.night0721.lilase.features.ah.AuctionHouse;
import me.night0721.lilase.features.flip.Flipper;
import me.night0721.lilase.managers.KeyBindingManager;
import me.night0721.lilase.managers.SniperFlipperEvents;
import me.night0721.lilase.utils.KeyBindingManager;
import me.night0721.lilase.events.SniperFlipperEvents;
import me.night0721.lilase.utils.ConfigUtils;
import me.night0721.lilase.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.network.play.server.S2DPacketOpenWindow;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -25,18 +30,19 @@ import org.lwjgl.opengl.Display;
import java.io.IOException;
import static me.night0721.lilase.config.AHConfig.AUCTION_HOUSE_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]")
public class Lilase {
public static final String MOD_NAME = "Lilase";
public static final String MODID = "Lilase";
public static final String VERSION = "1.0.2";
public static final String VERSION = "1.0.21";
static int tickAmount;
int waitTime;
public static AuctionHouse auctionHouse;
public static AHConfig config;
static final Minecraft mc = Minecraft.getMinecraft();
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
@ -46,11 +52,11 @@ public class Lilase {
ConfigUtils.register();
auctionHouse = new AuctionHouse();
KeyBindingManager.registerKeyBindings();
Display.setTitle("Lilase v" + VERSION);
Display.setTitle("Lilase v" + VERSION + " | night0721");
}
@Subscribe
public void onConfigInit(InitializationEvent event) {
public void initConfig(InitializationEvent ignore) {
config = new AHConfig();
}
@ -67,8 +73,15 @@ public class Lilase {
if (tickAmount % 2400 == 0) {
ConfigUtils.checkWebhookAndAPI();
}
AuctionHouse.switchStates();
Flipper.switchStates();
if ((mc.currentScreen instanceof GuiDisconnected)) {
if (waitTime >= (RECONNECT_DELAY * 20)) {
waitTime = 0;
FMLClientHandler.instance().connectToServer(new GuiMultiplayer(new GuiMainMenu()), new ServerData(" ", "mc.hypixel.net", false));
} else {
waitTime++;
}
}
}
@SubscribeEvent

View file

@ -1,39 +1,259 @@
package me.night0721.lilase.config;
import cc.polyfrost.oneconfig.config.Config;
import cc.polyfrost.oneconfig.config.annotations.Checkbox;
import cc.polyfrost.oneconfig.config.annotations.Number;
import cc.polyfrost.oneconfig.config.annotations.Slider;
import cc.polyfrost.oneconfig.config.annotations.Text;
import cc.polyfrost.oneconfig.config.annotations.*;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.config.data.ModType;
import me.night0721.lilase.utils.ConfigUtils;
import me.night0721.lilase.utils.Utils;
public class AHConfig extends Config {
public AHConfig() {
super(new Mod("Lilase", ModType.UTIL_QOL), "lilase.json");
initialize();
addListener("AUCTION_HOUSE_DELAY", () -> ConfigUtils.writeIntConfig("main", "AuctionHouseDelay", Math.round(AHConfig.AUCTION_HOUSE_DELAY)));
addListener("WEBHOOK", () -> ConfigUtils.writeStringConfig("main", "Webhook", AHConfig.WEBHOOK));
addListener("RECONNECT_DELAY", () -> ConfigUtils.writeIntConfig("main", "ReconnectDelay", Math.round(AHConfig.RECONNECT_DELAY)));
addListener("AUCTION_HOUSE_DELAY", () -> ConfigUtils.writeIntConfig("main", "AuctionHouseDelay", Math.round(AHConfig.AUCTION_HOUSE_DELAY)));
addListener("CHECK_MULTIPLIER", () -> ConfigUtils.writeBooleanConfig("main", "checkMultiplierBeforeBuy", AHConfig.CHECK_MULTIPLIER));
addListener("MULTIPLIER", () -> ConfigUtils.writeIntConfig("main", "MULTIPLIER", Math.round(AHConfig.MULTIPLIER)));
addListener("GUI", () -> ConfigUtils.writeBooleanConfig("main", "GUI", AHConfig.GUI));
addListener("GUI_COLOR", () -> ConfigUtils.writeIntConfig("main", "GUI_COLOR", AHConfig.GUI_COLOR.getRGB()));
addListener("ITEM_1_NAME", () -> ConfigUtils.writeStringConfig("item1", "Name", AHConfig.ITEM_1_NAME));
addListener("ITEM_1_TYPE", () -> ConfigUtils.writeStringConfig("item1", "Type", AHConfig.ITEM_1_TYPE));
addListener("ITEM_1_PRICE", () -> ConfigUtils.writeIntConfig("item1", "Price", Math.round(AHConfig.ITEM_1_PRICE)));
addListener("ITEM_1_TIER", () -> ConfigUtils.writeStringConfig("item1", "Tier", AHConfig.ITEM_1_TIER));
addListener("ITEM_2_NAME", () -> ConfigUtils.writeStringConfig("item2", "Name", AHConfig.ITEM_2_NAME));
addListener("ITEM_2_TYPE", () -> ConfigUtils.writeStringConfig("item2", "Type", AHConfig.ITEM_2_TYPE));
addListener("ITEM_2_PRICE", () -> ConfigUtils.writeIntConfig("item2", "Price", Math.round(AHConfig.ITEM_2_PRICE)));
addListener("ITEM_2_TIER", () -> ConfigUtils.writeStringConfig("item2", "Tier", AHConfig.ITEM_2_TIER));
addListener("ITEM_3_NAME", () -> ConfigUtils.writeStringConfig("item3", "Name", AHConfig.ITEM_3_NAME));
addListener("ITEM_3_TYPE", () -> ConfigUtils.writeStringConfig("item3", "Type", AHConfig.ITEM_3_TYPE));
addListener("ITEM_3_PRICE", () -> ConfigUtils.writeIntConfig("item3", "Price", Math.round(AHConfig.ITEM_3_PRICE)));
addListener("ITEM_3_TIER", () -> ConfigUtils.writeStringConfig("item3", "Tier", AHConfig.ITEM_3_TIER));
addListener("ITEM_4_NAME", () -> ConfigUtils.writeStringConfig("item4", "Name", AHConfig.ITEM_4_NAME));
addListener("ITEM_4_TYPE", () -> ConfigUtils.writeStringConfig("item4", "Type", AHConfig.ITEM_4_TYPE));
addListener("ITEM_4_PRICE", () -> ConfigUtils.writeIntConfig("item4", "Price", Math.round(AHConfig.ITEM_4_PRICE)));
addListener("ITEM_4_TIER", () -> ConfigUtils.writeStringConfig("item4", "Tier", AHConfig.ITEM_4_TIER));
addListener("ITEM_5_NAME", () -> ConfigUtils.writeStringConfig("item5", "Name", AHConfig.ITEM_5_NAME));
addListener("ITEM_5_TYPE", () -> ConfigUtils.writeStringConfig("item5", "Type", AHConfig.ITEM_5_TYPE));
addListener("ITEM_5_PRICE", () -> ConfigUtils.writeIntConfig("item5", "Price", Math.round(AHConfig.ITEM_5_PRICE)));
addListener("ITEM_5_TIER", () -> ConfigUtils.writeStringConfig("item5", "Tier", AHConfig.ITEM_5_TIER));
addListener("ITEM_6_NAME", () -> ConfigUtils.writeStringConfig("item6", "Name", AHConfig.ITEM_6_NAME));
addListener("ITEM_6_TYPE", () -> ConfigUtils.writeStringConfig("item6", "Type", AHConfig.ITEM_6_TYPE));
addListener("ITEM_6_PRICE", () -> ConfigUtils.writeIntConfig("item6", "Price", Math.round(AHConfig.ITEM_6_PRICE)));
addListener("ITEM_6_TIER", () -> ConfigUtils.writeStringConfig("item6", "Tier", AHConfig.ITEM_6_TIER));
addListener("ITEM_7_NAME", () -> ConfigUtils.writeStringConfig("item7", "Name", AHConfig.ITEM_7_NAME));
addListener("ITEM_7_TYPE", () -> ConfigUtils.writeStringConfig("item7", "Type", AHConfig.ITEM_7_TYPE));
addListener("ITEM_7_PRICE", () -> ConfigUtils.writeIntConfig("item7", "Price", Math.round(AHConfig.ITEM_7_PRICE)));
addListener("ITEM_7_TIER", () -> ConfigUtils.writeStringConfig("item7", "Tier", AHConfig.ITEM_7_TIER));
addListener("ITEM_8_NAME", () -> ConfigUtils.writeStringConfig("item8", "Name", AHConfig.ITEM_8_NAME));
addListener("ITEM_8_TYPE", () -> ConfigUtils.writeStringConfig("item8", "Type", AHConfig.ITEM_8_TYPE));
addListener("ITEM_8_PRICE", () -> ConfigUtils.writeIntConfig("item8", "Price", Math.round(AHConfig.ITEM_8_PRICE)));
addListener("ITEM_8_TIER", () -> ConfigUtils.writeStringConfig("item8", "Tier", AHConfig.ITEM_8_TIER));
addListener("ITEM_9_NAME", () -> ConfigUtils.writeStringConfig("item9", "Name", AHConfig.ITEM_9_NAME));
addListener("ITEM_9_TYPE", () -> ConfigUtils.writeStringConfig("item9", "Type", AHConfig.ITEM_9_TYPE));
addListener("ITEM_9_PRICE", () -> ConfigUtils.writeIntConfig("item9", "Price", Math.round(AHConfig.ITEM_9_PRICE)));
addListener("ITEM_9_TIER", () -> ConfigUtils.writeStringConfig("item9", "Tier", AHConfig.ITEM_9_TIER));
addListener("ITEM_10_NAME", () -> ConfigUtils.writeStringConfig("item10", "Name", AHConfig.ITEM_10_NAME));
addListener("ITEM_10_TYPE", () -> ConfigUtils.writeStringConfig("item10", "Type", AHConfig.ITEM_10_TYPE));
addListener("ITEM_10_PRICE", () -> ConfigUtils.writeIntConfig("item10", "Price", Math.round(AHConfig.ITEM_10_PRICE)));
addListener("ITEM_10_TIER", () -> ConfigUtils.writeStringConfig("item10", "Tier", AHConfig.ITEM_10_TIER));
addDependency("MULTIPLIER", "CHECK_MULTIPLIER");
addDependency("GUI_COLOR", "GUI");
addDependency("ITEM_1_NAME", "addItem", () -> ConfigUtils.getString("item1", "Name").equals(""));
addDependency("ITEM_1_TYPE", "addItem", () -> ConfigUtils.getString("item1", "Type").equals(""));
addDependency("ITEM_1_PRICE", "addItem", () -> ConfigUtils.getString("item1", "Price").equals(""));
addDependency("ITEM_1_TIER", "addItem", () -> ConfigUtils.getString("item1", "Tier").equals(""));
addDependency("ITEM_2_NAME", "addItem", () -> ConfigUtils.getString("item2", "Name").equals(""));
addDependency("ITEM_2_TYPE", "addItem", () -> ConfigUtils.getString("item2", "Type").equals(""));
addDependency("ITEM_2_PRICE", "addItem", () -> ConfigUtils.getString("item2", "Price").equals(""));
addDependency("ITEM_2_TIER", "addItem", () -> ConfigUtils.getString("item2", "Tier").equals(""));
addDependency("ITEM_3_NAME", "addItem", () -> ConfigUtils.getString("item3", "Name").equals(""));
addDependency("ITEM_3_TYPE", "addItem", () -> ConfigUtils.getString("item3", "Type").equals(""));
addDependency("ITEM_3_PRICE", "addItem", () -> ConfigUtils.getString("item3", "Price").equals(""));
addDependency("ITEM_3_TIER", "addItem", () -> ConfigUtils.getString("item3", "Tier").equals(""));
addDependency("ITEM_4_NAME", "addItem", () -> ConfigUtils.getString("item4", "Name").equals(""));
addDependency("ITEM_4_TYPE", "addItem", () -> ConfigUtils.getString("item4", "Type").equals(""));
addDependency("ITEM_4_PRICE", "addItem", () -> ConfigUtils.getString("item4", "Price").equals(""));
addDependency("ITEM_4_TIER", "addItem", () -> ConfigUtils.getString("item4", "Tier").equals(""));
addDependency("ITEM_5_NAME", "addItem", () -> !ConfigUtils.getString("item5", "Name").equals(""));
addDependency("ITEM_5_TYPE", "addItem", () -> !ConfigUtils.getString("item5", "Type").equals(""));
addDependency("ITEM_5_PRICE", "addItem", () -> !ConfigUtils.getString("item5", "Price").equals(""));
addDependency("ITEM_5_TIER", "addItem", () -> !ConfigUtils.getString("item5", "Tier").equals(""));
addDependency("ITEM_6_NAME", "addItem", () -> !ConfigUtils.getString("item6", "Name").equals(""));
addDependency("ITEM_6_TYPE", "addItem", () -> !ConfigUtils.getString("item6", "Type").equals(""));
addDependency("ITEM_6_PRICE", "addItem", () -> !ConfigUtils.getString("item6", "Price").equals(""));
addDependency("ITEM_6_TIER", "addItem", () -> !ConfigUtils.getString("item6", "Tier").equals(""));
addDependency("ITEM_7_NAME", "addItem", () -> !ConfigUtils.getString("item7", "Name").equals(""));
addDependency("ITEM_7_TYPE", "addItem", () -> !ConfigUtils.getString("item7", "Type").equals(""));
addDependency("ITEM_7_PRICE", "addItem", () -> !ConfigUtils.getString("item7", "Price").equals(""));
addDependency("ITEM_7_TIER", "addItem", () -> !ConfigUtils.getString("item7", "Tier").equals(""));
addDependency("ITEM_8_NAME", "addItem", () -> !ConfigUtils.getString("item8", "Name").equals(""));
addDependency("ITEM_8_TYPE", "addItem", () -> !ConfigUtils.getString("item8", "Type").equals(""));
addDependency("ITEM_8_PRICE", "addItem", () -> !ConfigUtils.getString("item8", "Price").equals(""));
addDependency("ITEM_8_TIER", "addItem", () -> !ConfigUtils.getString("item8", "Tier").equals(""));
addDependency("ITEM_9_NAME", "addItem", () -> !ConfigUtils.getString("item9", "Name").equals(""));
addDependency("ITEM_9_TYPE", "addItem", () -> !ConfigUtils.getString("item9", "Type").equals(""));
addDependency("ITEM_9_PRICE", "addItem", () -> !ConfigUtils.getString("item9", "Price").equals(""));
addDependency("ITEM_9_TIER", "addItem", () -> !ConfigUtils.getString("item9", "Tier").equals(""));
addDependency("ITEM_10_NAME", "addItem", () -> !ConfigUtils.getString("item10", "Name").equals(""));
addDependency("ITEM_10_TYPE", "addItem", () -> !ConfigUtils.getString("item10", "Type").equals(""));
addDependency("ITEM_10_PRICE", "addItem", () -> !ConfigUtils.getString("item10", "Price").equals(""));
addDependency("ITEM_10_TIER", "addItem", () -> !ConfigUtils.getString("item10", "Tier").equals(""));
}
// @HUD(name = "Lilase")
// public CoordinateGUI hud = new CoordinateGUI();
@Slider(name = "Time per fetch (seconds)", min = 5, max = 15, step = 1, category = "Auction House")
@Slider(name = "Time per fetch (seconds)", min = 5, max = 15, step = 1, category = "Auction House", description = "Time between each fetch of the auction house, the faster the fetch, the more likely you will snipe the item")
public static int AUCTION_HOUSE_DELAY = 8;
@Text(name = "Discord Webhook", placeholder = "URL", category = "Auction House")
@Text(name = "Discord Webhook", placeholder = "URL", category = "Auction House", description = "Discord webhook to send messages to")
public static String WEBHOOK = "";
@Checkbox(name = "Check Multiplier Before Buying", category = "Flipper")
@Number(name = "Reconnect Delay", min = 5, max = 20, category = "Auction House", description = "Delay between each reconnect attempt to the server")
public static int RECONNECT_DELAY = 20;
@Switch(name = "Check Multiplier Before Buying", category = "Flipper", description = "Check the multiplier before buying the item, if the multiplier is too low, it will not buy the item")
public static boolean CHECK_MULTIPLIER = false;
@Number(name = "Multiplier", min = 100, max = 5000, step = 50, category = "Flipper")
@Number(name = "Multiplier", min = 100, max = 5000, step = 50, category = "Flipper", description = "Multiplier to check before buying the item, if the multiplier is too low, it will not buy the item")
public static int MULTIPLIER = 400;
@Switch(name = "Bed Spam & Skip Confirm", category = "Auction House", description = "Spam the bed to buy the item just after the grace period ends and skips the confirmation of buying the item")
public static boolean BED_SPAM = true;
@Checkbox(name = "GUI", category = "GUI", description = "Enable the GUI")
public static boolean GUI = true;
@Color(name = "GUI_COLOR", category = "GUI")
public static OneColor GUI_COLOR = new OneColor(0, 49, 83);
@Button(name = "Add Item", text = "Click to add an item to snipe", category = "Auction House")
public static void addItem() {
Utils.debugLog("[AHConfig] Add Item Button Clicked");
}
@Dropdown(name = "Remove Item", category = "Auction House", description = "Remove an item from the snipe list", options = {"Item 1", "Item 2", "Item 3", "Item 4", "Item 5"})
public static int value = 0;
@Text(name = "Item 1 Name", placeholder = "Item Name")
public static String ITEM_1_NAME = " ";
@Text(name = "Item 1 Type", placeholder = "Item Type")
public static String ITEM_1_TYPE = "ANY";
@Number(name = "Item 1 Price", min = 1, max = 1000000000)
public static int ITEM_1_PRICE = 1;
@Text(name = "Item 1 Tier", placeholder = "Item Tier")
public static String ITEM_1_TIER = "ANY";
@Text(name = "Item 2 Name", placeholder = "Item Name")
public static String ITEM_2_NAME = " ";
@Text(name = "Item 2 Type", placeholder = "Item Type")
public static String ITEM_2_TYPE = "ANY";
@Number(name = "Item 2 Price", min = 1, max = 1000000000)
public static int ITEM_2_PRICE = 1;
@Text(name = "Item 2 Tier", placeholder = "Item Tier")
public static String ITEM_2_TIER = "ANY";
@Text(name = "Item 3 Name", placeholder = "Item Name")
public static String ITEM_3_NAME = " ";
@Text(name = "Item 3 Type", placeholder = "Item Type")
public static String ITEM_3_TYPE = "ANY";
@Number(name = "Item 3 Price", min = 1, max = 1000000000)
public static int ITEM_3_PRICE = 1;
@Text(name = "Item 3 Tier", placeholder = "Item Tier")
public static String ITEM_3_TIER = "ANY";
@Text(name = "Item 4 Name", placeholder = "Item Name")
public static String ITEM_4_NAME = " ";
@Text(name = "Item 4 Type", placeholder = "Item Type")
public static String ITEM_4_TYPE = "ANY";
@Number(name = "Item 4 Price", min = 1, max = 1000000000)
public static int ITEM_4_PRICE = 1;
@Text(name = "Item 4 Tier", placeholder = "Item Tier")
public static String ITEM_4_TIER = "ANY";
@Text(name = "Item 5 Name", placeholder = "Item Name")
public static String ITEM_5_NAME = " ";
@Text(name = "Item 5 Type", placeholder = "Item Type")
public static String ITEM_5_TYPE = "ANY";
@Number(name = "Item 5 Price", min = 1, max = 1000000000)
public static int ITEM_5_PRICE = 1;
@Text(name = "Item 5 Tier", placeholder = "Item Tier")
public static String ITEM_5_TIER = "ANY";
@Text(name = "Item 6 Name", placeholder = "Item Name")
public static String ITEM_6_NAME = " ";
@Text(name = "Item 6 Type", placeholder = "Item Type")
public static String ITEM_6_TYPE = "ANY";
@Number(name = "Item 6 Price", min = 1, max = 1000000000)
public static int ITEM_6_PRICE = 1;
@Text(name = "Item 6 Tier", placeholder = "Item Tier")
public static String ITEM_6_TIER = "ANY";
@Text(name = "Item 7 Name", placeholder = "Item Name")
public static String ITEM_7_NAME = " ";
@Text(name = "Item 7 Type", placeholder = "Item Type")
public static String ITEM_7_TYPE = "ANY";
@Number(name = "Item 7 Price", min = 1, max = 1000000000)
public static int ITEM_7_PRICE = 1;
@Text(name = "Item 7 Tier", placeholder = "Item Tier")
public static String ITEM_7_TIER = "ANY";
@Text(name = "Item 8 Name", placeholder = "Item Name")
public static String ITEM_8_NAME = " ";
@Text(name = "Item 8 Type", placeholder = "Item Type")
public static String ITEM_8_TYPE = "ANY";
@Number(name = "Item 8 Price", min = 1, max = 1000000000)
public static int ITEM_8_PRICE = 1;
@Text(name = "Item 8 Tier", placeholder = "Item Tier")
public static String ITEM_8_TIER = "ANY";
@Text(name = "Item 9 Name", placeholder = "Item Name")
public static String ITEM_9_NAME = " ";
@Text(name = "Item 9 Type", placeholder = "Item Type")
public static String ITEM_9_TYPE = "ANY";
@Number(name = "Item 9 Price", min = 1, max = 1000000000)
public static int ITEM_9_PRICE = 1;
@Text(name = "Item 9 Tier", placeholder = "Item Tier")
public static String ITEM_9_TIER = "ANY";
@Text(name = "Item 10 Name", placeholder = "Item Name")
public static String ITEM_10_NAME = " ";
@Text(name = "Item 10 Type", placeholder = "Item Type")
public static String ITEM_10_TYPE = "ANY";
@Number(name = "Item 10 Price", min = 1, max = 1000000000)
public static int ITEM_10_PRICE = 1;
@Text(name = "Item 10 Tier", placeholder = "Item Tier")
public static String ITEM_10_TIER = "ANY";
}

View file

@ -1,21 +1,10 @@
package me.night0721.lilase.events;
import io.netty.channel.ChannelHandlerContext;
import me.night0721.lilase.features.flip.Flipper;
import me.night0721.lilase.utils.Utils;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C12PacketUpdateSign;
import net.minecraft.network.play.server.S33PacketUpdateSign;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import java.io.IOException;
import static me.night0721.lilase.features.ah.AuctionHouse.flipper;
import static me.night0721.lilase.features.flip.FlipperState.START;
import static me.night0721.lilase.utils.PlayerUtils.sendPacketWithoutEvent;
@Cancelable
public class PacketReceivedEvent extends Event {
public final Packet<?> packet;
@ -24,21 +13,5 @@ public class PacketReceivedEvent extends Event {
public PacketReceivedEvent(final Packet<?> packet, final ChannelHandlerContext context) {
this.packet = packet;
this.context = context;
if (packet instanceof S33PacketUpdateSign && Utils.checkInHub() && Flipper.state.equals(START)) {
new Thread(() -> {
try {
S33PacketUpdateSign packetUpdateSign = (S33PacketUpdateSign) packet;
IChatComponent[] lines = packetUpdateSign.getLines();
Utils.debugLog("[Flipper] Item price should be " + flipper.getItemPrice());
lines[0] = IChatComponent.Serializer.jsonToComponent("{\"text\":\"" + flipper.getItemPrice() + "\"}");
Thread.sleep(1500);
C12PacketUpdateSign packetUpdateSign1 = new C12PacketUpdateSign(packetUpdateSign.getPos(), lines);
sendPacketWithoutEvent(packetUpdateSign1);
} catch (IOException | InterruptedException | RuntimeException e) {
e.printStackTrace();
}
}).start();
}
}
}

View file

@ -1,43 +1,63 @@
package me.night0721.lilase.managers;
package me.night0721.lilase.events;
import me.night0721.lilase.Lilase;
import me.night0721.lilase.features.ah.AuctionHouse;
import me.night0721.lilase.features.ah.States;
import me.night0721.lilase.config.AHConfig;
import me.night0721.lilase.features.flip.Flipper;
import me.night0721.lilase.features.flip.FlipperState;
import me.night0721.lilase.gui.TextRenderer;
import me.night0721.lilase.utils.*;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.C12PacketUpdateSign;
import net.minecraft.network.play.server.S33PacketUpdateSign;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard;
import java.io.IOException;
import java.util.Calendar;
import java.util.TimeZone;
import static me.night0721.lilase.config.AHConfig.GUI_COLOR;
import static me.night0721.lilase.features.ah.AuctionHouse.flipper;
import static me.night0721.lilase.features.ah.AuctionHouse.webhook;
import static me.night0721.lilase.features.flip.Flipper.rotation;
import static me.night0721.lilase.features.flip.FlipperState.START;
import static me.night0721.lilase.utils.PlayerUtils.sendPacketWithoutEvent;
public class SniperFlipperEvents {
Thread bzchillingthread;
private static int windowId = 1;
private static boolean buying = false;
@SubscribeEvent
public void onChat(ClientChatReceivedEvent event) throws InterruptedException {
public void onChat(ClientChatReceivedEvent event) throws InterruptedException, IOException {
String message = event.message.getUnformattedText();
if (!message.contains(":")) {
if (message.equals("You didn't participate in this auction!")) {
Utils.debugLog("[Sniper] Failed to buy item, not fast enough. Closing the menu");
PlayerUtils.mc.playerController.windowClick(PlayerUtils.mc.thePlayer.openContainer.windowId, 49, 0, 0, PlayerUtils.mc.thePlayer); // Close the window as could not buy
InventoryUtils.clickOpenContainerSlot(49);
} else if (message.equals("You don't have enough coins to afford this bid!")) {
Utils.debugLog("[Sniper] Failed to buy item, not enough money. Closing the menu");
AuctionHouse.clickState = States.NONE;
PlayerUtils.mc.playerController.windowClick(PlayerUtils.mc.thePlayer.openContainer.windowId, 49, 0, 0, PlayerUtils.mc.thePlayer); // Close the window as could not buy
InventoryUtils.clickOpenContainerSlot(49);
} else if (message.contains("Your new API key is")) {
Utils.debugLog("[Sniper] Detected new API key, saving it to config");
Utils.debugLog("[Sniper] Saved new API key to config");
String apiKey = message.replace("Your new API key is ", "");
ConfigUtils.writeStringConfig("main", "APIKey", apiKey);
} else if (message.equals("Claiming BIN auction...")) {
AuctionHouse.clickState = States.EXECUTE;
} else if (message.equals("This BIN sale is still in its grace period!")) {
AuctionHouse.clickState = States.CLICK;
} else if (message.equals("Claiming BIN auction...") && buying) {
Utils.debugLog("[Sniper] Bought an item, starting to sell");
webhook.execute();
flipper.sellItem();
} else if (message.equals("Your starting bid must be at least 10 coins!")) {
InventoryUtils.clickOpenContainerSlot(13);
PlayerUtils.mc.thePlayer.closeScreen();
@ -52,9 +72,7 @@ public class SniperFlipperEvents {
} else if (message.contains("You were spawned in Limbo")) {
Utils.sendMessage("Detected in Limbo, stopping everything for 5 minutes");
Flipper.state = FlipperState.NONE;
AuctionHouse.clickState = States.NONE;
if (Lilase.auctionHouse.open)
Lilase.auctionHouse.toggleAuction();
if (Lilase.auctionHouse.open) Lilase.auctionHouse.toggleAuction();
Thread.sleep(5000);
Utils.sendServerMessage("/hub");
bzchillingthread = new Thread(bazaarChilling);
@ -133,4 +151,69 @@ public class SniperFlipperEvents {
}
}
}
@SubscribeEvent
public void onGuiRender(RenderGameOverlayEvent event) {
if (event.type == RenderGameOverlayEvent.ElementType.TEXT) {
if (AHConfig.GUI) {
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getDefault());
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
String time = String.format("%02d:%02d", hour, minute);
String lines = "X: " + Math.round(PlayerUtils.mc.thePlayer.posX) + "\n" + "Y: " + Math.round(PlayerUtils.mc.thePlayer.posY) + "\n" + "Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ) + "\n" + time + "\n" + "FPS: " + Minecraft.getDebugFPS();
TextRenderer.drawString(lines, 0, 0, 1.5, GUI_COLOR.getRGB());
}
}
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onInventoryRendering(GuiScreenEvent.BackgroundDrawnEvent event) {
String windowName = InventoryUtils.getInventoryName();
if ("BIN Auction View".equals(windowName)) {
ItemStack is = InventoryUtils.getStackInOpenContainerSlot(31);
if (is != null && (is.getItem() == Items.gold_nugget || (AHConfig.BED_SPAM && is.getItem() == Items.bed))) {
buying = true;
windowId = PlayerUtils.mc.thePlayer.openContainer.windowId;
PlayerUtils.mc.playerController.windowClick(windowId, 31, 0, 0, PlayerUtils.mc.thePlayer);
} else if (is != null && is.getItem() == Items.potato) {
buying = false;
PlayerUtils.mc.thePlayer.closeScreen();
}
}
if (AHConfig.BED_SPAM) {
if (buying && "Confirm Purchase".equals(windowName)) {
PlayerUtils.mc.playerController.windowClick(windowId + 1, 11, 0, 0, PlayerUtils.mc.thePlayer);
buying = false;
}
}
}
@SubscribeEvent
public void onWindowClick(PacketReceivedEvent event) {
if (event.packet instanceof S33PacketUpdateSign && Utils.checkInHub() && Flipper.state.equals(START)) {
new Thread(() -> {
try {
S33PacketUpdateSign packetUpdateSign = (S33PacketUpdateSign) event.packet;
IChatComponent[] lines = packetUpdateSign.getLines();
Utils.debugLog("[Flipper] Item price should be " + flipper.getItemPrice());
lines[0] = IChatComponent.Serializer.jsonToComponent("{\"text\":\"" + flipper.getItemPrice() + "\"}");
Thread.sleep(1500);
C12PacketUpdateSign packetUpdateSign1 = new C12PacketUpdateSign(packetUpdateSign.getPos(), lines);
sendPacketWithoutEvent(packetUpdateSign1);
} catch (IOException | InterruptedException | RuntimeException e) {
e.printStackTrace();
}
}).start();
}
}
@SubscribeEvent
public void onWorldChange(WorldEvent.Unload event) {
buying = false;
}
}

View file

@ -1,12 +1,7 @@
package me.night0721.lilase.features.ah;
import me.night0721.lilase.features.flip.Flipper;
import me.night0721.lilase.features.flip.FlipperState;
import me.night0721.lilase.misc.DiscordWebhook;
import me.night0721.lilase.utils.ConfigUtils;
import me.night0721.lilase.utils.InventoryUtils;
import me.night0721.lilase.utils.PlayerUtils;
import me.night0721.lilase.utils.Utils;
import me.night0721.lilase.utils.*;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -22,6 +17,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -29,12 +25,8 @@ import java.util.regex.Pattern;
public class AuctionHouse {
private static String uuid;
private static String message_toSend;
private static long lastAction;
private static String name;
private static String bytedata;
public static States clickState = States.NONE;
public static Flipper flipper;
private static final DiscordWebhook webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
public static final DiscordWebhook webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
public Boolean open = false;
private final List<Item> items = new ArrayList<>();
@ -69,6 +61,10 @@ public class AuctionHouse {
return new JSONObject(content.toString());
}
private float generateRandomFloat() {
return (float) (ThreadLocalRandom.current().nextFloat() * 180);
}
public void getItem() throws IOException, JSONException {
if (open == false) return;
if (!Utils.checkInHub()) {
@ -86,11 +82,8 @@ public class AuctionHouse {
open = false;
return;
}
if (Flipper.state != FlipperState.NONE) {
Utils.sendMessage("Flipper is running, stopping, will resume when flipper is done");
open = false;
return;
}
Utils.debugLog("[Sniper] Randomizing motion as we don't want to be AFK");
KeyBindingManager.leftClick();
URL url = new URL("https://api.hypixel.net/skyblock/auctions");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestProperty("Content-Type", "application/json");
@ -135,7 +128,6 @@ public class AuctionHouse {
lore = "Water Bender";
break;
}
if (posted.contains(auction.getString("uuid"))) break;
if (!auction.getString("item_name").toLowerCase().contains(item.query.toLowerCase())) break;
if (!auction.getString("item_lore").contains(lore)) break;
@ -148,7 +140,8 @@ public class AuctionHouse {
flipper = new Flipper(auction.getString("item_name"), auction.getString("item_bytes"), auction.getInt("starting_bid"));
NumberFormat format = NumberFormat.getInstance(Locale.US);
JSONObject profile = getHypixelData(auction.getString("auctioneer"));
if (profile.getJSONObject("player").getString("displayname").toLowerCase() == PlayerUtils.mc.thePlayer.getName().toLowerCase()) break;
if (profile.getJSONObject("player").getString("displayname").toLowerCase() == PlayerUtils.mc.thePlayer.getName().toLowerCase())
break;
Pattern pattern = Pattern.compile("§[0-9a-z]", Pattern.MULTILINE);
Matcher matcher = pattern.matcher(auction.getString("item_lore"));
String updated = matcher.replaceAll("");
@ -161,11 +154,11 @@ public class AuctionHouse {
Utils.debugLog("[Sniper] Found an item, checking profit multiplier");
if (multi > ConfigUtils.getInt("main", "Multiplier")) {
Utils.debugLog("[Sniper] Higher than required multiplier, buying now");
clickState = States.OPEN;
sendAuction();
}
} else {
Utils.debugLog("[Sniper] Found an item, trying to buy");
clickState = States.OPEN;
sendAuction();
}
return;
}
@ -213,43 +206,15 @@ public class AuctionHouse {
if (open) {
Utils.sendMessage("Stopped Auction House");
open = false;
UngrabUtils.regrabMouse();
} else {
if (Utils.checkInHub()) {
Utils.sendMessage("Started Auction House");
open = true;
UngrabUtils.ungrabMouse();
} else Utils.sendMessage("Detected not in hub, please go to hub to start");
}
}
public static void switchStates() throws IOException {
switch (clickState) {
case CLICK:
if (System.currentTimeMillis() - lastAction < 500) return;
InventoryUtils.clickOpenContainerSlot(31);
lastAction = System.currentTimeMillis();
clickState = States.CONFIRM;
break;
case CONFIRM:
if (System.currentTimeMillis() - lastAction < 500) return;
InventoryUtils.clickOpenContainerSlot(11);
lastAction = System.currentTimeMillis();
clickState = States.NONE;
break;
case OPEN:
AuctionHouse.sendAuction();
lastAction = System.currentTimeMillis();
clickState = States.CLICK;
break;
case EXECUTE:
Utils.debugLog("[Sniper] Bought an item, starting to sell");
webhook.execute();
flipper.sellItem();
clickState = States.NONE;
break;
case NONE:
break;
}
}
}

View file

@ -1,5 +0,0 @@
package me.night0721.lilase.features.ah;
public enum States {
OPEN, NONE, CLICK, CONFIRM, EXECUTE
}

View file

@ -1,8 +1,6 @@
package me.night0721.lilase.features.flip;
import me.night0721.lilase.Lilase;
import me.night0721.lilase.managers.KeyBindingManager;
import me.night0721.lilase.player.Rotation;
import me.night0721.lilase.utils.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
@ -43,6 +41,9 @@ public class Flipper {
}
public void sellItem() {
Utils.sendMessage("Flipper is running, stopping, will resume when flipper is done");
if (Lilase.auctionHouse.open) Lilase.auctionHouse.toggleAuction();
UngrabUtils.ungrabMouse();
Utils.sendServerMessage("/hub");
state = FlipperState.WALKING_TO_FIRST_POINT;
}
@ -95,6 +96,12 @@ public class Flipper {
buyWait.schedule(1500);
} else if (InventoryUtils.inventoryNameContains("Create BIN Auction")) {
if (InventoryUtils.isStoneButton() && buyWait.passed()) {
if (InventoryUtils.getSlotForItem(itemname) == -1) {
Utils.sendMessage("Cannot find item in inventory, stopping flipper");
state = FlipperState.NONE;
Lilase.auctionHouse.open = true;
return;
}
InventoryUtils.clickOpenContainerSlot(InventoryUtils.getSlotForItem(itemname));
buyWait.schedule(1000);
} else if (!InventoryUtils.isStoneButton() && InventoryUtils.isToAuctionItem(itemname) && buyWait.passed()) {

View file

@ -1,21 +0,0 @@
package me.night0721.lilase.gui;
import cc.polyfrost.oneconfig.hud.TextHud;
import me.night0721.lilase.utils.PlayerUtils;
import java.util.List;
public class CoordinateGUI extends TextHud {
public CoordinateGUI() {
super(true, 0, 0);
}
@Override
protected void getLines(List<String> lines, boolean example) {
if (PlayerUtils.mc.thePlayer == null) return;
lines.add("X: " + Math.round(PlayerUtils.mc.thePlayer.posX));
lines.add("Y: " + Math.round(PlayerUtils.mc.thePlayer.posY));
lines.add("Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ));
// get the time in real life and format it to xx:xx, eg 23:54
}
}

View file

@ -1,62 +1,34 @@
package me.night0721.lilase.gui;
import me.night0721.lilase.utils.PlayerUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class TextRenderer {
public TextRenderer(Minecraft mc, String text, int x, int y, double scale) {
double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale);
y -= mc.fontRendererObj.FONT_HEIGHT;
for (String line : text.split("\n")) {
y += mc.fontRendererObj.FONT_HEIGHT * scale;
/*if (ToggleCommand.outlineTextToggled) {
String noColorLine = StringUtils.stripControlCodes(line);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) - 1, (int) Math.round(y / scale), 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) + 1, (int) Math.round(y / scale), 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) - 1, 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) + 1, 0x000000, false);
mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, false);
} else {*/
mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true);
//}
}
GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1);
}
public TextRenderer(Minecraft mc, String text, int x, int y, double scale, Color color) {
double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale);
y -= mc.fontRendererObj.FONT_HEIGHT;
for (String line : text.split("\n")) {
y += mc.fontRendererObj.FONT_HEIGHT * scale;
/*if (ToggleCommand.outlineTextToggled) {
String noColorLine = StringUtils.stripControlCodes(line);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) - 1, (int) Math.round(y / scale), 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) + 1, (int) Math.round(y / scale), 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) - 1, 0x000000, false);
mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) + 1, 0x000000, false);
mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, false);
} else {*/
mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), color.getRGB(), true);
//}
}
GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1);
}
public static void drawString(String text, int x, int y, double scale) {
new TextRenderer(Minecraft.getMinecraft(), text, x, y, scale);
double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale);
y -= PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale;
for (String line : text.split("\n")) {
y += PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale;
PlayerUtils.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true);
}
GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1);
}
public static void drawString(String text, int x, int y, double scale, Color color) {
new TextRenderer(Minecraft.getMinecraft(), text, x, y, scale, color);
public static void drawString(String text, int x, int y, double scale, int color) {
double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale);
y -= PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale;
for (String line : text.split("\n")) {
y += PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale;
PlayerUtils.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), color, false);
}
GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1);
}
public void drawCenteredString(String text, int x, int y, double scale) {

View file

@ -1,9 +1,9 @@
package me.night0721.lilase.mixins;
import io.netty.channel.ChannelHandlerContext;
import me.night0721.lilase.events.PacketReceivedEvent;
import me.night0721.lilase.events.PacketSentEvent;
import me.night0721.lilase.utils.PlayerUtils;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraftforge.common.MinecraftForge;
@ -14,14 +14,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = {NetworkManager.class})
public class MixinNetworkManager {
@Inject(method={"channelRead0"}, at={@At(value="HEAD")}, cancellable=true)
@Inject(method = {"channelRead0*"}, at = {@At(value = "HEAD")}, cancellable = true)
private void read(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
if (MinecraftForge.EVENT_BUS.post(new PacketReceivedEvent(packet, context))) {
ci.cancel();
}
}
@Inject(method = {"sendPacket(Lnet/minecraft/network/Packet;)V"}, at = {@At(value = "HEAD")}, cancellable = true)
private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
if (!PlayerUtils.packets.contains(packet)) {

View file

@ -23,21 +23,24 @@ public class ConfigUtils {
public static void reloadConfig() {
if (!hasKey("main", "APIKey")) writeStringConfig("main", "APIKey", "");
if (!hasKey("main", "Webhook")) writeStringConfig("main", "Webhook", "");
if (!hasKey("main", "ReconnectDelay")) writeIntConfig("main", "ReconnectDelay", 20);
if (!hasKey("main", "AuctionHouseDelay")) writeIntConfig("main", "AuctionHouseDelay", 8);
if (!hasKey("main", "checkMultiplierBeforeBuy")) writeBooleanConfig("main", "checkMultiplierBeforeBuy", false);
if (!hasKey("main", "Multiplier")) writeIntConfig("main", "Multiplier", 400); //400%
if (!hasKey("item1", "Name")) writeStringConfig("item1", "Name", "");
if (!hasKey("item1", "Type")) writeStringConfig("item1", "Type", "");
if (!hasKey("item1", "Price")) writeIntConfig("item1", "Price", 0);
if (!hasKey("item1", "Tier")) writeStringConfig("item1", "Tier", "");
if (!hasKey("item2", "Name")) writeStringConfig("item2", "Name", "");
if (!hasKey("item2", "Type")) writeStringConfig("item2", "Type", "");
if (!hasKey("item2", "Price")) writeIntConfig("item2", "Price", 0);
if (!hasKey("item2", "Tier")) writeStringConfig("item2", "Tier", "");
if (!hasKey("item3", "Name")) writeStringConfig("item3", "Name", "");
if (!hasKey("item3", "Type")) writeStringConfig("item3", "Type", "");
if (!hasKey("item3", "Price")) writeIntConfig("item3", "Price", 0);
if (!hasKey("item3", "Tier")) writeStringConfig("item3", "Tier", "");
if (!hasKey("main", "GUI")) writeBooleanConfig("main", "GUI", true);
if (!hasKey("main", "GUI_COLOR")) writeIntConfig("main", "GUI_COLOR", 0x003153);
// if (!hasKey("item1", "Name")) writeStringConfig("item1", "Name", "");
// if (!hasKey("item1", "Type")) writeStringConfig("item1", "Type", "");
// if (!hasKey("item1", "Price")) writeIntConfig("item1", "Price", 0);
// if (!hasKey("item1", "Tier")) writeStringConfig("item1", "Tier", "");
// if (!hasKey("item2", "Name")) writeStringConfig("item2", "Name", "");
// if (!hasKey("item2", "Type")) writeStringConfig("item2", "Type", "");
// if (!hasKey("item2", "Price")) writeIntConfig("item2", "Price", 0);
// if (!hasKey("item2", "Tier")) writeStringConfig("item2", "Tier", "");
// if (!hasKey("item3", "Name")) writeStringConfig("item3", "Name", "");
// if (!hasKey("item3", "Type")) writeStringConfig("item3", "Type", "");
// if (!hasKey("item3", "Price")) writeIntConfig("item3", "Price", 0);
// if (!hasKey("item3", "Tier")) writeStringConfig("item3", "Tier", "");
}
public static void init() {

View file

@ -1,4 +1,4 @@
package me.night0721.lilase.misc;
package me.night0721.lilase.utils;
import javax.net.ssl.HttpsURLConnection;
import java.awt.*;

View file

@ -1,8 +1,6 @@
package me.night0721.lilase.managers;
package me.night0721.lilase.utils;
import me.night0721.lilase.Lilase;
import me.night0721.lilase.utils.PlayerUtils;
import me.night0721.lilase.utils.ReflectionUtils;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -11,11 +9,9 @@ import org.lwjgl.input.Keyboard;
public class KeyBindingManager {
private static final KeyBinding[] keyBindings = new KeyBinding[4];
// private static final ArrayList<Block> interactables = new ArrayList<>(Arrays.asList(Blocks.acacia_door, Blocks.anvil, Blocks.beacon, Blocks.bed, Blocks.birch_door, Blocks.brewing_stand, Blocks.command_block, Blocks.crafting_table, Blocks.chest, Blocks.dark_oak_door, Blocks.daylight_detector, Blocks.daylight_detector_inverted, Blocks.dispenser, Blocks.dropper, Blocks.enchanting_table, Blocks.ender_chest, Blocks.furnace, Blocks.hopper, Blocks.jungle_door, Blocks.lever, Blocks.noteblock, Blocks.powered_comparator, Blocks.unpowered_comparator, Blocks.powered_repeater, Blocks.unpowered_repeater, Blocks.standing_sign, Blocks.wall_sign, Blocks.trapdoor, Blocks.trapped_chest, Blocks.wooden_button, Blocks.stone_button, Blocks.oak_door, Blocks.skull));
public static void registerKeyBindings() {
//keyBindings[0] = new KeyBinding("Ghost Block Bind", Keyboard.KEY_G, Lilase.MOD_NAME);
keyBindings[0] = new KeyBinding("Auction House", Keyboard.KEY_END, Lilase.MOD_NAME);
keyBindings[0] = new KeyBinding("Auction House Toggle", Keyboard.KEY_END, Lilase.MOD_NAME);
keyBindings[1] = new KeyBinding("Config", Keyboard.KEY_MULTIPLY, Lilase.MOD_NAME);
for (KeyBinding keyBinding : keyBindings) {
ClientRegistry.registerKeyBinding(keyBinding);
@ -24,22 +20,6 @@ public class KeyBindingManager {
@SubscribeEvent
public void onKeyPress(InputEvent.KeyInputEvent event) {
// if (keyBindings[0].isKeyDown()) {
// if (PlayerUtils.mc.objectMouseOver.getBlockPos() == null) return;
// Block block = PlayerUtils.mc.theWorld.getBlockState(PlayerUtils.mc.objectMouseOver.getBlockPos()).getBlock();
// if (!interactables.contains(block)) {
// PlayerUtils.mc.theWorld.setBlockToAir(PlayerUtils.mc.objectMouseOver.getBlockPos());
// }
// }
// if (keyBindings[1].isKeyDown()) {
// List<String> lines = new ArrayList<>();
// lines.add("X: " + Math.round(PlayerUtils.mc.thePlayer.posX));
// lines.add("Y: " + Math.round(PlayerUtils.mc.thePlayer.posY));
// lines.add("Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ));
// for (String line : lines) {
// TextRenderer.drawString(line, 0, 0, 1);
// }
// }
if (keyBindings[0].isPressed()) {
Lilase.auctionHouse.toggleAuction();
}

View file

@ -1,6 +1,5 @@
package me.night0721.lilase.player;
package me.night0721.lilase.utils;
import me.night0721.lilase.utils.AngleUtils;
import net.minecraft.client.Minecraft;
import org.apache.commons.lang3.tuple.MutablePair;

View file

@ -0,0 +1,49 @@
package me.night0721.lilase.utils;
import net.minecraft.client.Minecraft;
import net.minecraft.util.MouseHelper;
import org.lwjgl.input.Mouse;
public class UngrabUtils {
public static boolean isUngrabbed = false;
private static MouseHelper oldMouseHelper;
private static boolean doesGameWantUngrabbed;
public static void ungrabMouse() {
Minecraft m = Minecraft.getMinecraft();
if (isUngrabbed) return;
m.gameSettings.pauseOnLostFocus = false;
if (oldMouseHelper == null) oldMouseHelper = m.mouseHelper;
doesGameWantUngrabbed = !Mouse.isGrabbed();
oldMouseHelper.ungrabMouseCursor();
m.inGameHasFocus = true;
m.mouseHelper = new MouseHelper() {
@Override
public void mouseXYChange() {
}
@Override
public void grabMouseCursor() {
doesGameWantUngrabbed = false;
}
@Override
public void ungrabMouseCursor() {
doesGameWantUngrabbed = true;
}
};
isUngrabbed = true;
}
/**
* This function performs all the steps required to regrab the mouse.
*/
public static void regrabMouse() {
if (!isUngrabbed) return;
Minecraft m = Minecraft.getMinecraft();
m.mouseHelper = oldMouseHelper;
if (!doesGameWantUngrabbed) m.mouseHelper.grabMouseCursor();
oldMouseHelper = null;
isUngrabbed = false;
}
}