v1.0.22 release

This commit is contained in:
NK 2023-02-26 00:20:51 +00:00
parent 86ec615bd6
commit 9679d0caa0
10 changed files with 73 additions and 100 deletions

View file

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

View file

@ -3,21 +3,17 @@ package me.night0721.lilase;
import cc.polyfrost.oneconfig.events.EventManager; 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 me.night0721.lilase.events.PacketReceivedEvent;
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.AHConfig;
import me.night0721.lilase.features.ah.AuctionHouse; import me.night0721.lilase.features.ah.AuctionHouse;
import me.night0721.lilase.utils.Clock;
import me.night0721.lilase.utils.ConfigUtils; import me.night0721.lilase.utils.ConfigUtils;
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;
import net.minecraft.client.gui.GuiMultiplayer; import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.multiplayer.ServerData; 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.common.MinecraftForge;
import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
@ -34,12 +30,13 @@ import static me.night0721.lilase.features.ah.AHConfig.RECONNECT_DELAY;
public class Lilase { public class Lilase {
public static final String MOD_NAME = "Lilase"; public static final String MOD_NAME = "Lilase";
public static final String MODID = "Lilase"; public static final String MODID = "Lilase";
public static final String VERSION = "1.0.21"; public static final String VERSION = "1.0.22";
static int tickAmount; public static final Minecraft mc = Minecraft.getMinecraft();
int waitTime;
public static AuctionHouse auctionHouse; public static AuctionHouse auctionHouse;
public static AHConfig config; public static AHConfig config;
static final Minecraft mc = Minecraft.getMinecraft(); private int tickAmount;
private final Clock clock = new Clock();
@Mod.EventHandler @Mod.EventHandler
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
@ -62,25 +59,15 @@ 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 == 0) Utils.checkForDungeon();
if (tickAmount % (20 * AUCTION_HOUSE_DELAY) == 0) auctionHouse.getItem(); if (tickAmount % (20 * AUCTION_HOUSE_DELAY) == 0) auctionHouse.getItem();
if (tickAmount % 2400 == 0) ConfigUtils.checkWebhookAndAPI(); if (tickAmount % 2400 == 0) ConfigUtils.checkWebhookAndAPI();
if (AuctionHouse.flipper != null) AuctionHouse.flipper.switchStates(); if (AuctionHouse.flipper != null) AuctionHouse.flipper.switchStates();
if (mc.currentScreen instanceof GuiDisconnected) { if (mc.currentScreen instanceof GuiDisconnected) {
if (waitTime >= (RECONNECT_DELAY * 20)) { if (clock.passed()) {
waitTime = 0; 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));
} 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()));
} }
} }
/* /*

View file

@ -58,12 +58,12 @@ public class SniperFlipperEvents {
flipper.sellItem(); flipper.sellItem();
} else if (message.equals("Your starting bid must be at least 10 coins!")) { } else if (message.equals("Your starting bid must be at least 10 coins!")) {
InventoryUtils.clickOpenContainerSlot(13); 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"); Utils.debugLog("[Flipper] Cannot post item as the cost is too low, stopping fliiper and starting sniper");
Lilase.auctionHouse.toggleAuction(); Lilase.auctionHouse.toggleAuction();
Flipper.state = FlipperState.NONE; Flipper.state = FlipperState.NONE;
} else if (message.contains("Can't create a BIN auction for this item for a PRICE this LOW!")) { } 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"); Utils.debugLog("[Flipper] Cannot post item as the cost is too low, stopping fliiper and starting sniper");
Lilase.auctionHouse.toggleAuction(); Lilase.auctionHouse.toggleAuction();
Flipper.state = FlipperState.NONE; Flipper.state = FlipperState.NONE;
@ -110,12 +110,12 @@ public class SniperFlipperEvents {
Thread.sleep(3000); Thread.sleep(3000);
InventoryUtils.clickOpenContainerSlot(10); InventoryUtils.clickOpenContainerSlot(10);
Thread.sleep(3000); Thread.sleep(3000);
PlayerUtils.mc.thePlayer.closeScreen(); Lilase.mc.thePlayer.closeScreen();
} }
} else { } else {
Thread.sleep(1000 * 60 * 5); Thread.sleep(1000 * 60 * 5);
} }
PlayerUtils.mc.thePlayer.sendChatMessage("/hub"); Lilase.mc.thePlayer.sendChatMessage("/hub");
Thread.sleep(6000); Thread.sleep(6000);
Lilase.auctionHouse.toggleAuction(); Lilase.auctionHouse.toggleAuction();
} catch (Exception ignore) { } catch (Exception ignore) {
@ -138,7 +138,7 @@ public class SniperFlipperEvents {
try { try {
Utils.debugLog("[Flipper] Interrupting Flipper selling"); Utils.debugLog("[Flipper] Interrupting Flipper selling");
Thread.sleep(500); Thread.sleep(500);
PlayerUtils.mc.thePlayer.closeScreen(); Lilase.mc.thePlayer.closeScreen();
Flipper.state = FlipperState.NONE; Flipper.state = FlipperState.NONE;
Lilase.auctionHouse.toggleAuction(); Lilase.auctionHouse.toggleAuction();
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -159,9 +159,9 @@ public class SniperFlipperEvents {
int hour = cal.get(Calendar.HOUR_OF_DAY); int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE); int minute = cal.get(Calendar.MINUTE);
String time = String.format("%02d:%02d", hour, minute); String time = String.format("%02d:%02d", hour, minute);
String lines = "X: " + Math.round(PlayerUtils.mc.thePlayer.posX) + "\n" + String lines = "X: " + Math.round(Lilase.mc.thePlayer.posX) + "\n" +
"Y: " + Math.round(PlayerUtils.mc.thePlayer.posY) + "\n" + "Y: " + Math.round(Lilase.mc.thePlayer.posY) + "\n" +
"Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ) + "\n" + "Z: " + Math.round(Lilase.mc.thePlayer.posZ) + "\n" +
time + "\n" + time + "\n" +
"FPS: " + Minecraft.getDebugFPS() + "\n" + "FPS: " + Minecraft.getDebugFPS() + "\n" +
"Auctions Sniped: " + Lilase.auctionHouse.getAuctionsSniped(); "Auctions Sniped: " + Lilase.auctionHouse.getAuctionsSniped();
@ -177,16 +177,16 @@ public class SniperFlipperEvents {
ItemStack is = InventoryUtils.getStackInOpenContainerSlot(31); ItemStack is = InventoryUtils.getStackInOpenContainerSlot(31);
if (is != null && (is.getItem() == Items.gold_nugget || (AHConfig.BED_SPAM && is.getItem() == Items.bed))) { if (is != null && (is.getItem() == Items.gold_nugget || (AHConfig.BED_SPAM && is.getItem() == Items.bed))) {
buying = true; buying = true;
windowId = PlayerUtils.mc.thePlayer.openContainer.windowId; windowId = Lilase.mc.thePlayer.openContainer.windowId;
PlayerUtils.mc.playerController.windowClick(windowId, 31, 0, 0, PlayerUtils.mc.thePlayer); Lilase.mc.playerController.windowClick(windowId, 31, 0, 0, Lilase.mc.thePlayer);
} else if (is != null && is.getItem() == Items.potato) { } else if (is != null && is.getItem() == Items.potato) {
buying = false; buying = false;
PlayerUtils.mc.thePlayer.closeScreen(); Lilase.mc.thePlayer.closeScreen();
} }
} }
if (AHConfig.BED_SPAM) { if (AHConfig.BED_SPAM) {
if (buying && "Confirm Purchase".equals(windowName)) { 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; buying = false;
} }
} }

View file

@ -1,5 +1,6 @@
package me.night0721.lilase.features.ah; package me.night0721.lilase.features.ah;
import me.night0721.lilase.Lilase;
import me.night0721.lilase.features.flip.Flipper; import me.night0721.lilase.features.flip.Flipper;
import me.night0721.lilase.utils.*; import me.night0721.lilase.utils.*;
import org.json.JSONArray; import org.json.JSONArray;
@ -140,7 +141,7 @@ public class AuctionHouse {
flipper = new Flipper(auction.getString("item_name"), auction.getString("item_bytes"), auction.getInt("starting_bid")); flipper = new Flipper(auction.getString("item_name"), auction.getString("item_bytes"), auction.getInt("starting_bid"));
NumberFormat format = NumberFormat.getInstance(Locale.US); NumberFormat format = NumberFormat.getInstance(Locale.US);
JSONObject profile = getHypixelData(auction.getString("auctioneer")); 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; break;
Pattern pattern = Pattern.compile("§[0-9a-z]", Pattern.MULTILINE); Pattern pattern = Pattern.compile("§[0-9a-z]", Pattern.MULTILINE);
Matcher matcher = pattern.matcher(auction.getString("item_lore")); Matcher matcher = pattern.matcher(auction.getString("item_lore"));

View file

@ -17,7 +17,7 @@ import java.nio.charset.StandardCharsets;
public class Flipper { public class Flipper {
private static String itemname = null; private final String itemname;
private final String bytedata; private final String bytedata;
private final int itemprice; private final int itemprice;
public static FlipperState state = FlipperState.NONE; public static FlipperState state = FlipperState.NONE;
@ -51,8 +51,8 @@ public class Flipper {
public void switchStates() { public void switchStates() {
switch (state) { switch (state) {
case WALKING_TO_FIRST_POINT: case WALKING_TO_FIRST_POINT:
if (PlayerUtils.mc.currentScreen != null) { if (Lilase.mc.currentScreen != null) {
PlayerUtils.mc.thePlayer.closeScreen(); Lilase.mc.thePlayer.closeScreen();
} else if (distanceToFirstPoint() < 0.7f) { } else if (distanceToFirstPoint() < 0.7f) {
Utils.debugLog("[Flipper] Moving to auction house"); Utils.debugLog("[Flipper] Moving to auction house");
KeyBindingManager.updateKeys(false, false, false, false, false); KeyBindingManager.updateKeys(false, false, false, false, false);
@ -65,11 +65,11 @@ public class Flipper {
} }
break; break;
case WALKING_INTO_AUCTION_HOUSE: case WALKING_INTO_AUCTION_HOUSE:
if (PlayerUtils.mc.currentScreen != null) { if (Lilase.mc.currentScreen != null) {
PlayerUtils.mc.thePlayer.closeScreen(); Lilase.mc.thePlayer.closeScreen();
} else if (AngleUtils.smallestAngleDifference(AngleUtils.get360RotationYaw(), 88f) > 1.2) { } else if (AngleUtils.smallestAngleDifference(AngleUtils.get360RotationYaw(), 88f) > 1.2) {
Utils.debugLog("[Flipper] Rotating to Auction Master"); 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) { } else if (distanceToAuctionMaster() < 0.7f) {
Utils.debugLog("[Flipper] At Auction Master, opening shop"); Utils.debugLog("[Flipper] At Auction Master, opening shop");
KeyBindingManager.updateKeys(false, false, false, false, false); KeyBindingManager.updateKeys(false, false, false, false, false);
@ -82,13 +82,13 @@ public class Flipper {
} }
break; break;
case BUYING: case BUYING:
if (PlayerUtils.mc.currentScreen == null && buyWait.passed()) { if (Lilase.mc.currentScreen == null && buyWait.passed()) {
final Entity auctionMaster = getAuctionMaster(); final Entity auctionMaster = getAuctionMaster();
if (auctionMaster == null) { if (auctionMaster == null) {
Utils.debugLog("[Flipper] Cannot find shop NPC, retrying"); Utils.debugLog("[Flipper] Cannot find shop NPC, retrying");
buyWait.schedule(500); buyWait.schedule(500);
} else { } else {
PlayerUtils.mc.playerController.interactWithEntitySendPacket(PlayerUtils.mc.thePlayer, auctionMaster); Lilase.mc.playerController.interactWithEntitySendPacket(Lilase.mc.thePlayer, auctionMaster);
buyWait.schedule(1500); buyWait.schedule(1500);
} }
} else if (InventoryUtils.inventoryNameContains("Auction House") && buyWait.passed()) { } else if (InventoryUtils.inventoryNameContains("Auction House") && buyWait.passed()) {
@ -127,7 +127,7 @@ public class Flipper {
InventoryUtils.clickOpenContainerSlot(49); InventoryUtils.clickOpenContainerSlot(49);
Lilase.auctionHouse.incrementAuctionsSniped(); Lilase.auctionHouse.incrementAuctionsSniped();
buyWait.schedule(500); buyWait.schedule(500);
PlayerUtils.mc.thePlayer.closeScreen(); Lilase.mc.thePlayer.closeScreen();
buyWait.schedule(500); buyWait.schedule(500);
Utils.sendMessage("Posted item on Auction House, continue sniping now"); Utils.sendMessage("Posted item on Auction House, continue sniping now");
state = FlipperState.NONE; state = FlipperState.NONE;
@ -162,15 +162,15 @@ public class Flipper {
} }
private float distanceToFirstPoint() { private float distanceToFirstPoint() {
return (float) Math.sqrt(Math.pow(PlayerUtils.mc.thePlayer.posX - (-2.5), 2) + Math.pow(PlayerUtils.mc.thePlayer.posZ - (-91.5), 2)); return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-2.5), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-91.5), 2));
} }
private float distanceToAuctionMaster() { private float distanceToAuctionMaster() {
return (float) Math.sqrt(Math.pow(PlayerUtils.mc.thePlayer.posX - (-45), 2) + Math.pow(PlayerUtils.mc.thePlayer.posZ - (-90), 2)); return (float) Math.sqrt(Math.pow(Lilase.mc.thePlayer.posX - (-45), 2) + Math.pow(Lilase.mc.thePlayer.posZ - (-90), 2));
} }
private Entity getAuctionMaster() { private Entity getAuctionMaster() {
for (final Entity e : PlayerUtils.mc.theWorld.loadedEntityList) { for (final Entity e : Lilase.mc.theWorld.loadedEntityList) {
if (e instanceof EntityArmorStand) { if (e instanceof EntityArmorStand) {
final String name = StringUtils.stripControlCodes(e.getDisplayName().getUnformattedText()); final String name = StringUtils.stripControlCodes(e.getDisplayName().getUnformattedText());
if (name.startsWith("Auction Master")) { if (name.startsWith("Auction Master")) {

View file

@ -1,6 +1,6 @@
package me.night0721.lilase.gui; 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.Minecraft;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -9,10 +9,10 @@ public class TextRenderer {
public static void drawString(String text, int x, int y, double scale) { public static void drawString(String text, int x, int y, double scale) {
double scaleReset = Math.pow(scale, -1); double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale); 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")) { for (String line : text.split("\n")) {
y += PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale; y += Lilase.mc.fontRendererObj.FONT_HEIGHT * scale;
PlayerUtils.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true); Lilase.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true);
} }
GL11.glScaled(scaleReset, scaleReset, scaleReset); GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1); GlStateManager.color(1, 1, 1, 1);
@ -22,10 +22,10 @@ public class TextRenderer {
double scaleReset = Math.pow(scale, -1); double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale); 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")) { for (String line : text.split("\n")) {
y += PlayerUtils.mc.fontRendererObj.FONT_HEIGHT * scale; y += Lilase.mc.fontRendererObj.FONT_HEIGHT * scale;
PlayerUtils.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), color, false); Lilase.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), color, false);
} }
GL11.glScaled(scaleReset, scaleReset, scaleReset); GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1); GlStateManager.color(1, 1, 1, 1);

View file

@ -29,14 +29,14 @@ public class KeyBindingManager {
} }
public static void rightClick() { public static void rightClick() {
if (!ReflectionUtils.invoke(PlayerUtils.mc, "func_147121_ag")) { if (!ReflectionUtils.invoke(Lilase.mc, "func_147121_ag")) {
ReflectionUtils.invoke(PlayerUtils.mc, "rightClickMouse"); ReflectionUtils.invoke(Lilase.mc, "rightClickMouse");
} }
} }
public static void leftClick() { public static void leftClick() {
if (!ReflectionUtils.invoke(PlayerUtils.mc, "func_147116_af")) { if (!ReflectionUtils.invoke(Lilase.mc, "func_147116_af")) {
ReflectionUtils.invoke(PlayerUtils.mc, "clickMouse"); ReflectionUtils.invoke(Lilase.mc, "clickMouse");
} }
} }
@ -46,27 +46,27 @@ public class KeyBindingManager {
} }
public static void updateKeys(boolean forward, boolean back, boolean right, boolean left, boolean attack, boolean crouch, boolean space) { 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(); stopMovement();
return; return;
} }
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindForward.getKeyCode(), forward); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindForward.getKeyCode(), forward);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindBack.getKeyCode(), back); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindBack.getKeyCode(), back);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindRight.getKeyCode(), right); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindRight.getKeyCode(), right);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindLeft.getKeyCode(), left); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindLeft.getKeyCode(), left);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindAttack.getKeyCode(), attack); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindAttack.getKeyCode(), attack);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindSneak.getKeyCode(), crouch); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindSneak.getKeyCode(), crouch);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindJump.getKeyCode(), space); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindJump.getKeyCode(), space);
} }
public static void stopMovement() { public static void stopMovement() {
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindForward.getKeyCode(), false); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindForward.getKeyCode(), false);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindBack.getKeyCode(), false); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindBack.getKeyCode(), false);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindRight.getKeyCode(), false); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindRight.getKeyCode(), false);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindLeft.getKeyCode(), false); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindLeft.getKeyCode(), false);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindAttack.getKeyCode(), false); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindAttack.getKeyCode(), false);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindSneak.getKeyCode(), false); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindSneak.getKeyCode(), false);
KeyBinding.setKeyBindState(PlayerUtils.mc.gameSettings.keyBindJump.getKeyCode(), false); KeyBinding.setKeyBindState(Lilase.mc.gameSettings.keyBindJump.getKeyCode(), false);
} }
} }

View file

@ -1,18 +1,15 @@
package me.night0721.lilase.utils; package me.night0721.lilase.utils;
import net.minecraft.client.Minecraft; import me.night0721.lilase.Lilase;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import java.util.ArrayList; import java.util.ArrayList;
public class PlayerUtils { public class PlayerUtils {
public static final Minecraft mc = Minecraft.getMinecraft();
public static final ArrayList<Packet<?>> packets = new ArrayList<>(); public static final ArrayList<Packet<?>> packets = new ArrayList<>();
public static void sendPacketWithoutEvent(Packet<?> packet) { public static void sendPacketWithoutEvent(Packet<?> packet) {
packets.add(packet); packets.add(packet);
mc.getNetHandler().getNetworkManager().sendPacket(packet); Lilase.mc.getNetHandler().getNetworkManager().sendPacket(packet);
} }
} }

View file

@ -2,6 +2,7 @@ package me.night0721.lilase.utils;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import me.night0721.lilase.Lilase;
import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.ScorePlayerTeam;
@ -37,8 +38,8 @@ public class ScoreboardUtils {
public static List<String> getSidebarLines() { public static List<String> getSidebarLines() {
List<String> lines = new ArrayList<>(); List<String> lines = new ArrayList<>();
if (PlayerUtils.mc.theWorld == null) return lines; if (Lilase.mc.theWorld == null) return lines;
Scoreboard scoreboard = PlayerUtils.mc.theWorld.getScoreboard(); Scoreboard scoreboard = Lilase.mc.theWorld.getScoreboard();
if (scoreboard == null) return lines; if (scoreboard == null) return lines;
ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1);

View file

@ -1,5 +1,6 @@
package me.night0721.lilase.utils; package me.night0721.lilase.utils;
import me.night0721.lilase.Lilase;
import net.minecraft.network.play.server.S45PacketTitle; import net.minecraft.network.play.server.S45PacketTitle;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
@ -7,8 +8,6 @@ import net.minecraft.util.EnumChatFormatting;
import java.util.List; import java.util.List;
public class Utils { public class Utils {
public static boolean inDungeon;
public static boolean inHub = false; public static boolean inHub = false;
public static String translateAlternateColorCodes(String text) { public static String translateAlternateColorCodes(String text) {
@ -25,20 +24,8 @@ public class Utils {
public static void addTitle(String title) { public static void addTitle(String title) {
S45PacketTitle p1 = new S45PacketTitle(0, 20, 0); S45PacketTitle p1 = new S45PacketTitle(0, 20, 0);
S45PacketTitle p2 = new S45PacketTitle(S45PacketTitle.Type.TITLE, new ChatComponentText(Utils.translateAlternateColorCodes(title))); S45PacketTitle p2 = new S45PacketTitle(S45PacketTitle.Type.TITLE, new ChatComponentText(Utils.translateAlternateColorCodes(title)));
PlayerUtils.mc.thePlayer.sendQueue.handleTitle(p1); Lilase.mc.thePlayer.sendQueue.handleTitle(p1);
PlayerUtils.mc.thePlayer.sendQueue.handleTitle(p2); Lilase.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;
} }
public static boolean checkInHub() { public static boolean checkInHub() {
@ -52,14 +39,14 @@ public class Utils {
} }
public static void sendMessage(String message) { 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) { 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) { public static void sendServerMessage(String message) {
PlayerUtils.mc.thePlayer.sendChatMessage(message); Lilase.mc.thePlayer.sendChatMessage(message);
} }
} }