Skip to content

Commit

Permalink
fix bed not spamming + fixed anti afk 3.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
NK committed May 27, 2023
1 parent 8c20039 commit d2ecce1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_name = Lilase
mod_id = lilase
mod_version = 3.0.2
mod_version = 3.0.3

essential.defaults.loom=0

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/night0721/lilase/Lilase.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class Lilase {
public static final String MOD_NAME = "Lilase";
public static final String MODID = "Lilase";
public static final String VERSION = "3.0.2";
public static final String VERSION = "3.0.3";
public static final Minecraft mc = Minecraft.getMinecraft();
// public static PageFlipper pageFlipper;
public static Claimer claimer;
Expand All @@ -53,7 +53,7 @@ public class Lilase {
private int tickAmount;
private final Clock clock = new Clock();
public static RemoteControl remoteControl;
public static CapeDatabase capeDatabase = new CapeDatabase();
public static final CapeDatabase capeDatabase = new CapeDatabase();

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
Expand Down
35 changes: 16 additions & 19 deletions src/main/java/me/night0721/lilase/events/SniperFlipperEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,7 @@ public void OnKeyPress(InputEvent.KeyInputEvent event) {
}

private int latestWindowId = -1;
private final Thread spam = new Thread(() -> {
int tries = 0;
try {
while (tries < 50) {
if (InventoryUtils.inventoryNameStartsWith("BIN Auction View")) {
clickWindow(latestWindowId, 31);
clickWindow(latestWindowId + 1, 11);
tries++;
Thread.sleep(BED_SPAM_DELAY);
}
}
} catch (Exception ignored) {
}
});
private Thread spam;

@SubscribeEvent
public void onPacketReceive(PacketReceivedEvent event) {
Expand All @@ -102,11 +89,21 @@ public void onPacketReceive(PacketReceivedEvent event) {
ItemStack itemStack = packetSetSlot.func_149174_e();
Utils.debugLog("Slot 31: " + itemStack.getItem().getRegistryName());
if (itemStack.getItem() == Items.bed) {
boolean threadStatus = !spam.isAlive();
if (spam.isAlive()) spam.interrupt();
if (!threadStatus) {
spam.start();
}
spam = new Thread(() -> {
int tries = 0;
try {
while (tries < 50) {
if (InventoryUtils.inventoryNameStartsWith("BIN Auction View")) {
clickWindow(latestWindowId, 31);
clickWindow(latestWindowId + 1, 11);
tries++;
Thread.sleep(BED_SPAM_DELAY);
}
}
} catch (Exception ignored) {
}
});
spam.start();
new Thread(() -> {
try {
Thread.sleep(4000);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/me/night0721/lilase/features/cofl/Cofl.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public void handleMessage(String str) {
try {
if (!isOpen() || !str.startsWith("Received:")) return;
if (pattern.matcher(str).find()) {
// Random random = new Random();
// Lilase.mc.thePlayer.inventory.currentItem = random.nextInt(9);
String[] split = str.split("Received: ");
JsonObject received = new JsonParser().parse(split[1]).getAsJsonObject();
if (!received.get("type").getAsString().equals("flip")) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ public void switchStates() {
return;
}
String price = SHORTEN_NUMBERS ? Utils.convertToShort(this.target) : String.valueOf(this.target);
Utils.debugLog("Long Price: " + this.target);
Utils.debugLog("Shorten Price: " + Utils.convertToShort(this.target));
tileSign.signText[0] = new ChatComponentText(price);
sendPacketWithoutEvent(new C12PacketUpdateSign(tileSign.getPos(), tileSign.signText));
state = FlipperState.TIME;
Expand Down

0 comments on commit d2ecce1

Please sign in to comment.