Merge remote-tracking branch 'origin/master'
# Conflicts: # build.gradle
This commit is contained in:
commit
53535e4f93
12 changed files with 157 additions and 155 deletions
|
@ -3,56 +3,51 @@ package me.night0721.lilase;
|
|||
import cc.polyfrost.oneconfig.events.EventManager;
|
||||
import cc.polyfrost.oneconfig.events.event.InitializationEvent;
|
||||
import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
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.utils.KeyBindingManager;
|
||||
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.Clock;
|
||||
import me.night0721.lilase.utils.ConfigUtils;
|
||||
import me.night0721.lilase.utils.Utils;
|
||||
import me.night0721.lilase.utils.KeyBindingManager;
|
||||
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;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
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;
|
||||
import static me.night0721.lilase.features.ah.AHConfig.AUCTION_HOUSE_DELAY;
|
||||
import static me.night0721.lilase.features.ah.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.21";
|
||||
static int tickAmount;
|
||||
int waitTime;
|
||||
public static final String VERSION = "1.0.22";
|
||||
public static final Minecraft mc = Minecraft.getMinecraft();
|
||||
public static AuctionHouse auctionHouse;
|
||||
public static AHConfig config;
|
||||
static final Minecraft mc = Minecraft.getMinecraft();
|
||||
private int tickAmount;
|
||||
private final Clock clock = new Clock();
|
||||
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
KeyBindingManager keyBindingManager = new KeyBindingManager();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new KeyBindingManager());
|
||||
MinecraftForge.EVENT_BUS.register(keyBindingManager);
|
||||
MinecraftForge.EVENT_BUS.register(new SniperFlipperEvents());
|
||||
EventManager.INSTANCE.register(this);
|
||||
ConfigUtils.register();
|
||||
auctionHouse = new AuctionHouse();
|
||||
KeyBindingManager.registerKeyBindings();
|
||||
Display.setTitle("Lilase v" + VERSION + " | night0721");
|
||||
keyBindingManager.registerKeyBindings();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -64,31 +59,15 @@ public class Lilase {
|
|||
public void onTick(TickEvent.ClientTickEvent event) throws IOException {
|
||||
if (mc.thePlayer == null || event.phase != TickEvent.Phase.START) return;
|
||||
tickAmount++;
|
||||
if (tickAmount % 20 == 0) {
|
||||
Utils.checkForDungeon();
|
||||
}
|
||||
if (tickAmount % (20 * AUCTION_HOUSE_DELAY) == 0) {
|
||||
auctionHouse.getItem();
|
||||
}
|
||||
if (tickAmount % 2400 == 0) {
|
||||
ConfigUtils.checkWebhookAndAPI();
|
||||
}
|
||||
Flipper.switchStates();
|
||||
if ((mc.currentScreen instanceof GuiDisconnected)) {
|
||||
if (waitTime >= (RECONNECT_DELAY * 20)) {
|
||||
waitTime = 0;
|
||||
if (tickAmount % (20 * AUCTION_HOUSE_DELAY) == 0) auctionHouse.getItem();
|
||||
if (tickAmount % 2400 == 0) ConfigUtils.checkWebhookAndAPI();
|
||||
if (AuctionHouse.flipper != null) AuctionHouse.flipper.switchStates();
|
||||
if (mc.currentScreen instanceof GuiDisconnected) {
|
||||
if (clock.passed()) {
|
||||
clock.schedule(RECONNECT_DELAY * 1000L);
|
||||
FMLClientHandler.instance().connectToServer(new GuiMultiplayer(new GuiMainMenu()), new ServerData(" ", "mc.hypixel.net", false));
|
||||
} else {
|
||||
waitTime++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPacket(PacketReceivedEvent event) {
|
||||
if (Utils.inDungeon && event.packet instanceof S2DPacketOpenWindow && ChatFormatting.stripFormatting(((S2DPacketOpenWindow) event.packet).getWindowTitle().getFormattedText()).equals("Chest")) {
|
||||
event.setCanceled(true);
|
||||
mc.getNetHandler().getNetworkManager().sendPacket(new C0DPacketCloseWindow(((S2DPacketOpenWindow) event.packet).getWindowId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package me.night0721.lilase.events;
|
||||
|
||||
import me.night0721.lilase.Lilase;
|
||||
import me.night0721.lilase.config.AHConfig;
|
||||
import me.night0721.lilase.features.ah.AHConfig;
|
||||
import me.night0721.lilase.features.flip.Flipper;
|
||||
import me.night0721.lilase.features.flip.FlipperState;
|
||||
import me.night0721.lilase.gui.TextRenderer;
|
||||
|
@ -27,17 +27,15 @@ 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.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;
|
||||
private int windowId = 1;
|
||||
private boolean buying = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChat(ClientChatReceivedEvent event) throws InterruptedException, IOException {
|
||||
|
@ -56,26 +54,26 @@ public class SniperFlipperEvents {
|
|||
ConfigUtils.writeStringConfig("main", "APIKey", apiKey);
|
||||
} else if (message.equals("Claiming BIN auction...") && buying) {
|
||||
Utils.debugLog("[Sniper] Bought an item, starting to sell");
|
||||
webhook.execute();
|
||||
Lilase.auctionHouse.webhook.execute();
|
||||
flipper.sellItem();
|
||||
} else if (message.equals("Your starting bid must be at least 10 coins!")) {
|
||||
InventoryUtils.clickOpenContainerSlot(13);
|
||||
PlayerUtils.mc.thePlayer.closeScreen();
|
||||
Lilase.mc.thePlayer.closeScreen();
|
||||
Utils.debugLog("[Flipper] Cannot post item as the cost is too low, stopping fliiper and starting sniper");
|
||||
Lilase.auctionHouse.toggleAuction();
|
||||
Flipper.state = FlipperState.NONE;
|
||||
} else if (message.contains("Can't create a BIN auction for this item for a PRICE this LOW!")) {
|
||||
PlayerUtils.mc.thePlayer.closeScreen();
|
||||
Lilase.mc.thePlayer.closeScreen();
|
||||
Utils.debugLog("[Flipper] Cannot post item as the cost is too low, stopping fliiper and starting sniper");
|
||||
Lilase.auctionHouse.toggleAuction();
|
||||
Flipper.state = FlipperState.NONE;
|
||||
} else if (message.contains("You were spawned in Limbo")) {
|
||||
Utils.sendMessage("Detected in Limbo, stopping everything for 5 minutes");
|
||||
Flipper.state = FlipperState.NONE;
|
||||
if (Lilase.auctionHouse.open) Lilase.auctionHouse.toggleAuction();
|
||||
if (Lilase.auctionHouse.getOpen()) Lilase.auctionHouse.toggleAuction();
|
||||
Thread.sleep(5000);
|
||||
Utils.sendServerMessage("/hub");
|
||||
bzchillingthread = new Thread(bazaarChilling);
|
||||
Thread bzchillingthread = new Thread(bazaarChilling);
|
||||
bzchillingthread.start();
|
||||
}
|
||||
}
|
||||
|
@ -112,12 +110,12 @@ public class SniperFlipperEvents {
|
|||
Thread.sleep(3000);
|
||||
InventoryUtils.clickOpenContainerSlot(10);
|
||||
Thread.sleep(3000);
|
||||
PlayerUtils.mc.thePlayer.closeScreen();
|
||||
Lilase.mc.thePlayer.closeScreen();
|
||||
}
|
||||
} else {
|
||||
Thread.sleep(1000 * 60 * 5);
|
||||
}
|
||||
PlayerUtils.mc.thePlayer.sendChatMessage("/hub");
|
||||
Lilase.mc.thePlayer.sendChatMessage("/hub");
|
||||
Thread.sleep(6000);
|
||||
Lilase.auctionHouse.toggleAuction();
|
||||
} catch (Exception ignore) {
|
||||
|
@ -140,7 +138,7 @@ public class SniperFlipperEvents {
|
|||
try {
|
||||
Utils.debugLog("[Flipper] Interrupting Flipper selling");
|
||||
Thread.sleep(500);
|
||||
PlayerUtils.mc.thePlayer.closeScreen();
|
||||
Lilase.mc.thePlayer.closeScreen();
|
||||
Flipper.state = FlipperState.NONE;
|
||||
Lilase.auctionHouse.toggleAuction();
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -161,7 +159,12 @@ public class SniperFlipperEvents {
|
|||
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();
|
||||
String lines = "X: " + Math.round(Lilase.mc.thePlayer.posX) + "\n" +
|
||||
"Y: " + Math.round(Lilase.mc.thePlayer.posY) + "\n" +
|
||||
"Z: " + Math.round(Lilase.mc.thePlayer.posZ) + "\n" +
|
||||
time + "\n" +
|
||||
"FPS: " + Minecraft.getDebugFPS() + "\n" +
|
||||
"Auctions Sniped: " + Lilase.auctionHouse.getAuctionsSniped();
|
||||
TextRenderer.drawString(lines, 0, 0, 1.5, GUI_COLOR.getRGB());
|
||||
}
|
||||
}
|
||||
|
@ -174,23 +177,23 @@ public class SniperFlipperEvents {
|
|||
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);
|
||||
windowId = Lilase.mc.thePlayer.openContainer.windowId;
|
||||
Lilase.mc.playerController.windowClick(windowId, 31, 0, 0, Lilase.mc.thePlayer);
|
||||
} else if (is != null && is.getItem() == Items.potato) {
|
||||
buying = false;
|
||||
PlayerUtils.mc.thePlayer.closeScreen();
|
||||
Lilase.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);
|
||||
Lilase.mc.playerController.windowClick(windowId + 1, 11, 0, 0, Lilase.mc.thePlayer);
|
||||
buying = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWindowClick(PacketReceivedEvent event) {
|
||||
public void onPacketReceive(PacketReceivedEvent event) {
|
||||
if (event.packet instanceof S33PacketUpdateSign && Utils.checkInHub() && Flipper.state.equals(START)) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package me.night0721.lilase.config;
|
||||
package me.night0721.lilase.features.ah;
|
||||
|
||||
import cc.polyfrost.oneconfig.config.Config;
|
||||
import cc.polyfrost.oneconfig.config.annotations.Number;
|
|
@ -1,5 +1,6 @@
|
|||
package me.night0721.lilase.features.ah;
|
||||
|
||||
import me.night0721.lilase.Lilase;
|
||||
import me.night0721.lilase.features.flip.Flipper;
|
||||
import me.night0721.lilase.utils.*;
|
||||
import org.json.JSONArray;
|
||||
|
@ -23,14 +24,14 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
public class AuctionHouse {
|
||||
private static String uuid;
|
||||
private static String message_toSend;
|
||||
public static Flipper flipper;
|
||||
public static final DiscordWebhook webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
|
||||
|
||||
public Boolean open = false;
|
||||
private String uuid;
|
||||
private String message_toSend;
|
||||
private Boolean open = false;
|
||||
private int auctionsSniped = 0;
|
||||
public DiscordWebhook webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
|
||||
private final List<Item> items = new ArrayList<>();
|
||||
private final List<String> posted = new ArrayList<>();
|
||||
public static Flipper flipper;
|
||||
|
||||
public AuctionHouse() {
|
||||
if (!ConfigUtils.getString("item1", "Name").equals("") && !ConfigUtils.getString("item1", "Type").equals("") && !ConfigUtils.getString("item1", "Tier").equals("") && ConfigUtils.getInt("item1", "Price") != 0)
|
||||
|
@ -141,7 +142,7 @@ 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())
|
||||
if (profile.getJSONObject("player").getString("displayname").toLowerCase() == Lilase.mc.thePlayer.getName().toLowerCase())
|
||||
break;
|
||||
Pattern pattern = Pattern.compile("§[0-9a-z]", Pattern.MULTILINE);
|
||||
Matcher matcher = pattern.matcher(auction.getString("item_lore"));
|
||||
|
@ -167,7 +168,7 @@ public class AuctionHouse {
|
|||
}
|
||||
}
|
||||
|
||||
public static void sendAuction() {
|
||||
private void sendAuction() {
|
||||
Utils.sendServerMessage("/viewauction " + uuid);
|
||||
Utils.sendMessage(message_toSend);
|
||||
}
|
||||
|
@ -176,7 +177,6 @@ public class AuctionHouse {
|
|||
private final List<String> timesString = Arrays.asList("year", "month", "day", "hour", "minute", "second");
|
||||
|
||||
public String toDuration(long duration) {
|
||||
|
||||
StringBuilder res = new StringBuilder();
|
||||
for (int i = 0; i < times.size(); i++) {
|
||||
Long current = times.get(i);
|
||||
|
@ -190,12 +190,11 @@ public class AuctionHouse {
|
|||
else return res.toString();
|
||||
}
|
||||
|
||||
private static String getTimeSinceDate(long timeSinceDate) {
|
||||
private String getTimeSinceDate(long timeSinceDate) {
|
||||
long seconds = TimeUnit.MILLISECONDS.toSeconds(timeSinceDate);
|
||||
long minutes = TimeUnit.MILLISECONDS.toMinutes(timeSinceDate);
|
||||
long hours = TimeUnit.MILLISECONDS.toHours(timeSinceDate);
|
||||
long days = TimeUnit.MILLISECONDS.toDays(timeSinceDate);
|
||||
|
||||
if (seconds < 60) return "in " + seconds + " seconds";
|
||||
else if (minutes < 60) return "in " + minutes + " minutes";
|
||||
else if (hours < 24) return "in " + hours + " hours";
|
||||
|
@ -205,17 +204,33 @@ public class AuctionHouse {
|
|||
|
||||
public void toggleAuction() {
|
||||
if (open) {
|
||||
Utils.sendMessage("Stopped Auction House");
|
||||
Utils.sendMessage("Stopped AH Sniper");
|
||||
open = false;
|
||||
UngrabUtils.regrabMouse();
|
||||
} else {
|
||||
if (Utils.checkInHub()) {
|
||||
Utils.sendMessage("Started Auction House");
|
||||
Utils.sendMessage("Started AH Sniper");
|
||||
open = true;
|
||||
UngrabUtils.ungrabMouse();
|
||||
} else Utils.sendMessage("Detected not in hub, please go to hub to start");
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean getOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
public void setOpen(Boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
|
||||
public int getAuctionsSniped() {
|
||||
return auctionsSniped;
|
||||
}
|
||||
|
||||
public void incrementAuctionsSniped() {
|
||||
this.auctionsSniped += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@ import java.nio.charset.StandardCharsets;
|
|||
|
||||
|
||||
public class Flipper {
|
||||
private static String itemname = null;
|
||||
private final String itemname;
|
||||
private final String bytedata;
|
||||
private final int itemprice;
|
||||
public static FlipperState state = FlipperState.NONE;
|
||||
public static final Rotation rotation = new Rotation();
|
||||
private static final Clock buyWait = new Clock();
|
||||
private final Clock buyWait = new Clock();
|
||||
|
||||
public Flipper(String name, String data, int price) {
|
||||
itemname = name;
|
||||
|
@ -42,17 +42,17 @@ 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();
|
||||
if (Lilase.auctionHouse.getOpen()) Lilase.auctionHouse.toggleAuction();
|
||||
UngrabUtils.ungrabMouse();
|
||||
Utils.sendServerMessage("/hub");
|
||||
state = FlipperState.WALKING_TO_FIRST_POINT;
|
||||
}
|
||||
|
||||
public static void switchStates() {
|
||||
public void switchStates() {
|
||||
switch (state) {
|
||||
case WALKING_TO_FIRST_POINT:
|
||||
if (PlayerUtils.mc.currentScreen != null) {
|
||||
PlayerUtils.mc.thePlayer.closeScreen();
|
||||
if (Lilase.mc.currentScreen != null) {
|
||||
Lilase.mc.thePlayer.closeScreen();
|
||||
} else if (distanceToFirstPoint() < 0.7f) {
|
||||
Utils.debugLog("[Flipper] Moving to auction house");
|
||||
KeyBindingManager.updateKeys(false, false, false, false, false);
|
||||
|
@ -65,11 +65,11 @@ public class Flipper {
|
|||
}
|
||||
break;
|
||||
case WALKING_INTO_AUCTION_HOUSE:
|
||||
if (PlayerUtils.mc.currentScreen != null) {
|
||||
PlayerUtils.mc.thePlayer.closeScreen();
|
||||
if (Lilase.mc.currentScreen != null) {
|
||||
Lilase.mc.thePlayer.closeScreen();
|
||||
} else if (AngleUtils.smallestAngleDifference(AngleUtils.get360RotationYaw(), 88f) > 1.2) {
|
||||
Utils.debugLog("[Flipper] Rotating to Auction Master");
|
||||
rotation.easeTo(88f, PlayerUtils.mc.thePlayer.rotationPitch, 500);
|
||||
rotation.easeTo(88f, Lilase.mc.thePlayer.rotationPitch, 500);
|
||||
} else if (distanceToAuctionMaster() < 0.7f) {
|
||||
Utils.debugLog("[Flipper] At Auction Master, opening shop");
|
||||
KeyBindingManager.updateKeys(false, false, false, false, false);
|
||||
|
@ -82,13 +82,13 @@ public class Flipper {
|
|||
}
|
||||
break;
|
||||
case BUYING:
|
||||
if (PlayerUtils.mc.currentScreen == null && buyWait.passed()) {
|
||||
if (Lilase.mc.currentScreen == null && buyWait.passed()) {
|
||||
final Entity auctionMaster = getAuctionMaster();
|
||||
if (auctionMaster == null) {
|
||||
Utils.debugLog("[Flipper] Cannot find shop NPC, retrying");
|
||||
buyWait.schedule(500);
|
||||
} else {
|
||||
PlayerUtils.mc.playerController.interactWithEntitySendPacket(PlayerUtils.mc.thePlayer, auctionMaster);
|
||||
Lilase.mc.playerController.interactWithEntitySendPacket(Lilase.mc.thePlayer, auctionMaster);
|
||||
buyWait.schedule(1500);
|
||||
}
|
||||
} else if (InventoryUtils.inventoryNameContains("Auction House") && buyWait.passed()) {
|
||||
|
@ -99,7 +99,7 @@ public class Flipper {
|
|||
if (InventoryUtils.getSlotForItem(itemname) == -1) {
|
||||
Utils.sendMessage("Cannot find item in inventory, stopping flipper");
|
||||
state = FlipperState.NONE;
|
||||
Lilase.auctionHouse.open = true;
|
||||
Lilase.auctionHouse.setOpen(true);
|
||||
return;
|
||||
}
|
||||
InventoryUtils.clickOpenContainerSlot(InventoryUtils.getSlotForItem(itemname));
|
||||
|
@ -125,7 +125,10 @@ public class Flipper {
|
|||
buyWait.schedule(1000);
|
||||
} else if (InventoryUtils.inventoryNameContains("BIN Auction View") && buyWait.passed()) {
|
||||
InventoryUtils.clickOpenContainerSlot(49);
|
||||
PlayerUtils.mc.thePlayer.closeScreen();
|
||||
Lilase.auctionHouse.incrementAuctionsSniped();
|
||||
buyWait.schedule(500);
|
||||
Lilase.mc.thePlayer.closeScreen();
|
||||
buyWait.schedule(500);
|
||||
Utils.sendMessage("Posted item on Auction House, continue sniping now");
|
||||
state = FlipperState.NONE;
|
||||
Lilase.auctionHouse.toggleAuction();
|
||||
|
@ -158,16 +161,16 @@ public class Flipper {
|
|||
return new JSONObject(content.toString());
|
||||
}
|
||||
|
||||
private static float distanceToFirstPoint() {
|
||||
return (float) Math.sqrt(Math.pow(PlayerUtils.mc.thePlayer.posX - (-2.5), 2) + Math.pow(PlayerUtils.mc.thePlayer.posZ - (-91.5), 2));
|
||||
private float distanceToFirstPoint() {
|
||||
return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-2.5), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-91.5), 2));
|
||||
}
|
||||
|
||||
private static float distanceToAuctionMaster() {
|
||||
return (float) Math.sqrt(Math.pow(PlayerUtils.mc.thePlayer.posX - (-45), 2) + Math.pow(PlayerUtils.mc.thePlayer.posZ - (-90), 2));
|
||||
private float distanceToAuctionMaster() {
|
||||
return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-45), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-90), 2));
|
||||
}
|
||||
|
||||
private static Entity getAuctionMaster() {
|
||||
for (final Entity e : PlayerUtils.mc.theWorld.loadedEntityList) {
|
||||
private Entity getAuctionMaster() {
|
||||
for (final Entity e : Lilase.mc.theWorld.loadedEntityList) {
|
||||
if (e instanceof EntityArmorStand) {
|
||||
final String name = StringUtils.stripControlCodes(e.getDisplayName().getUnformattedText());
|
||||
if (name.startsWith("Auction Master")) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package me.night0721.lilase.gui;
|
||||
|
||||
import me.night0721.lilase.utils.PlayerUtils;
|
||||
import me.night0721.lilase.Lilase;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -9,10 +9,10 @@ public class TextRenderer {
|
|||
public static void drawString(String text, int x, int y, double scale) {
|
||||
double scaleReset = Math.pow(scale, -1);
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
y -= PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale;
|
||||
y -= Lilase.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);
|
||||
y += Lilase.mc.fontRendererObj.FONT_HEIGHT * scale;
|
||||
Lilase.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);
|
||||
|
@ -22,10 +22,10 @@ public class TextRenderer {
|
|||
double scaleReset = Math.pow(scale, -1);
|
||||
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
y -= PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale;
|
||||
y -= Lilase.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);
|
||||
y += Lilase.mc.fontRendererObj.FONT_HEIGHT * scale;
|
||||
Lilase.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);
|
||||
|
|
18
src/main/java/me/night0721/lilase/mixins/MixinMinecraft.java
Normal file
18
src/main/java/me/night0721/lilase/mixins/MixinMinecraft.java
Normal 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");
|
||||
}
|
||||
}
|
|
@ -8,10 +8,10 @@ import net.minecraftforge.fml.common.gameevent.InputEvent;
|
|||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class KeyBindingManager {
|
||||
private static final KeyBinding[] keyBindings = new KeyBinding[4];
|
||||
private final KeyBinding[] keyBindings = new KeyBinding[2];
|
||||
|
||||
public static void registerKeyBindings() {
|
||||
keyBindings[0] = new KeyBinding("Auction House Toggle", Keyboard.KEY_END, Lilase.MOD_NAME);
|
||||
public void registerKeyBindings() {
|
||||
keyBindings[0] = new KeyBinding("Sniper 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);
|
||||
|
@ -29,49 +29,44 @@ public class KeyBindingManager {
|
|||
}
|
||||
|
||||
public static void rightClick() {
|
||||
if (!ReflectionUtils.invoke(PlayerUtils.mc, "func_147121_ag")) {
|
||||
ReflectionUtils.invoke(PlayerUtils.mc, "rightClickMouse");
|
||||
if (!ReflectionUtils.invoke(Lilase.mc, "func_147121_ag")) {
|
||||
ReflectionUtils.invoke(Lilase.mc, "rightClickMouse");
|
||||
}
|
||||
}
|
||||
|
||||
public static void leftClick() {
|
||||
if (!ReflectionUtils.invoke(PlayerUtils.mc, "func_147116_af")) {
|
||||
ReflectionUtils.invoke(PlayerUtils.mc, "clickMouse");
|
||||
if (!ReflectionUtils.invoke(Lilase.mc, "func_147116_af")) {
|
||||
ReflectionUtils.invoke(Lilase.mc, "clickMouse");
|
||||
}
|
||||
}
|
||||
|
||||
public static void middleClick() {
|
||||
if (!ReflectionUtils.invoke(PlayerUtils.mc, "func_147112_ai")) {
|
||||
ReflectionUtils.invoke(PlayerUtils.mc, "middleClickMouse");
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateKeys(boolean forward, boolean back, boolean right, boolean left, boolean attack) {
|
||||
updateKeys(forward, back, right, left, attack, false, false);
|
||||
}
|
||||
|
||||
public static void updateKeys(boolean forward, boolean back, boolean right, boolean left, boolean attack, boolean crouch, boolean space) {
|
||||
if (PlayerUtils.mc.currentScreen != null) {
|
||||
if (Lilase.mc.currentScreen != null) {
|
||||
stopMovement();
|
||||
return;
|
||||
}
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindForward.getKeyCode(), forward);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindBack.getKeyCode(), back);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindRight.getKeyCode(), right);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindLeft.getKeyCode(), left);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindAttack.getKeyCode(), attack);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindSneak.getKeyCode(), crouch);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindJump.getKeyCode(), space);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindForward.getKeyCode(), forward);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindBack.getKeyCode(), back);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindRight.getKeyCode(), right);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindLeft.getKeyCode(), left);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindAttack.getKeyCode(), attack);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindSneak.getKeyCode(), crouch);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindJump.getKeyCode(), space);
|
||||
}
|
||||
|
||||
public static void stopMovement() {
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindForward.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindBack.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindRight.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindLeft.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindAttack.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindSneak.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindJump.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindForward.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindBack.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindRight.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindLeft.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindAttack.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindSneak.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindJump.getKeyCode(), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package me.night0721.lilase.utils;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import me.night0721.lilase.Lilase;
|
||||
import net.minecraft.network.Packet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PlayerUtils {
|
||||
public static final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
public static final ArrayList<Packet<?>> packets = new ArrayList<>();
|
||||
|
||||
public static void sendPacketWithoutEvent(Packet<?> packet) {
|
||||
packets.add(packet);
|
||||
mc.getNetHandler().getNetworkManager().sendPacket(packet);
|
||||
|
||||
Lilase.mc.getNetHandler().getNetworkManager().sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package me.night0721.lilase.utils;
|
|||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import me.night0721.lilase.Lilase;
|
||||
import net.minecraft.scoreboard.Score;
|
||||
import net.minecraft.scoreboard.ScoreObjective;
|
||||
import net.minecraft.scoreboard.ScorePlayerTeam;
|
||||
|
@ -37,8 +38,8 @@ public class ScoreboardUtils {
|
|||
|
||||
public static List<String> getSidebarLines() {
|
||||
List<String> lines = new ArrayList<>();
|
||||
if (PlayerUtils.mc.theWorld == null) return lines;
|
||||
Scoreboard scoreboard = PlayerUtils.mc.theWorld.getScoreboard();
|
||||
if (Lilase.mc.theWorld == null) return lines;
|
||||
Scoreboard scoreboard = Lilase.mc.theWorld.getScoreboard();
|
||||
if (scoreboard == null) return lines;
|
||||
|
||||
ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.night0721.lilase.utils;
|
||||
|
||||
import me.night0721.lilase.Lilase;
|
||||
import net.minecraft.network.play.server.S45PacketTitle;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
@ -7,8 +8,6 @@ import net.minecraft.util.EnumChatFormatting;
|
|||
import java.util.List;
|
||||
|
||||
public class Utils {
|
||||
|
||||
public static boolean inDungeon;
|
||||
public static boolean inHub = false;
|
||||
|
||||
public static String translateAlternateColorCodes(String text) {
|
||||
|
@ -25,20 +24,8 @@ public class Utils {
|
|||
public static void addTitle(String title) {
|
||||
S45PacketTitle p1 = new S45PacketTitle(0, 20, 0);
|
||||
S45PacketTitle p2 = new S45PacketTitle(S45PacketTitle.Type.TITLE, new ChatComponentText(Utils.translateAlternateColorCodes(title)));
|
||||
PlayerUtils.mc.thePlayer.sendQueue.handleTitle(p1);
|
||||
PlayerUtils.mc.thePlayer.sendQueue.handleTitle(p2);
|
||||
}
|
||||
|
||||
public static void checkForDungeon() {
|
||||
List<String> scoreboard = ScoreboardUtils.getSidebarLines();
|
||||
for (String s : scoreboard) {
|
||||
String sCleaned = ScoreboardUtils.cleanSB(s);
|
||||
if (sCleaned.contains("The Catacombs") || (sCleaned.contains("Cleared:") && sCleaned.contains("% ("))) {
|
||||
inDungeon = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
inDungeon = false;
|
||||
Lilase.mc.thePlayer.sendQueue.handleTitle(p1);
|
||||
Lilase.mc.thePlayer.sendQueue.handleTitle(p2);
|
||||
}
|
||||
|
||||
public static boolean checkInHub() {
|
||||
|
@ -52,14 +39,14 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static void sendMessage(String message) {
|
||||
PlayerUtils.mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "" + EnumChatFormatting.BOLD + "Liliase" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_GRAY + " » " + EnumChatFormatting.RESET + EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + message));
|
||||
Lilase.mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "" + EnumChatFormatting.BOLD + "Liliase" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_GRAY + " » " + EnumChatFormatting.RESET + EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + message));
|
||||
}
|
||||
|
||||
public static void debugLog(String message) {
|
||||
PlayerUtils.mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "" + "Liliase" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_GRAY + " » " + EnumChatFormatting.RESET + EnumChatFormatting.WHITE + message));
|
||||
Lilase.mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "" + "Liliase" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_GRAY + " » " + EnumChatFormatting.RESET + EnumChatFormatting.WHITE + message));
|
||||
}
|
||||
|
||||
public static void sendServerMessage(String message) {
|
||||
PlayerUtils.mc.thePlayer.sendChatMessage(message);
|
||||
Lilase.mc.thePlayer.sendChatMessage(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
"package": "me.night0721.lilase.mixins",
|
||||
"refmap": "mixins.night0721.refmap.json",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"minVersion": "0.8.2",
|
||||
"mixins": [
|
||||
"MixinNetworkManager"
|
||||
],
|
||||
"client": [
|
||||
"MixinMinecraft"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue