Skip to content

Commit

Permalink
added BSD timer for items (may be inaccurate)
Browse files Browse the repository at this point in the history
added inviteabunch + keybind for it + subcommand for it
changed logging for larger UI scraping window, should now work at least 95% of the time
changed github api request thing to spam less for update checking
fixed logging win state being "Win" always
  • Loading branch information
quasar098 committed Aug 2, 2023
1 parent 6234032 commit a2073f1
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 34 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "0.6.1"
version = "0.6.3"
group= "com.quasar.voxylenhanced" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "voxylenhanced"

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/quasar/voxylenhanced/VoxylEnhanced.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
public class VoxylEnhanced
{
public static final String MODID = "voxylenhanced";
public static final String VERSION = "0.6.1";
public static final String VERSION = "0.6.3";

static boolean hasCheckedUpdates = false;
public static boolean willOpenSettings = false;

public static VoxylSettingsPage settings;
Expand Down Expand Up @@ -78,7 +79,8 @@ public void worldLoad(WorldEvent.Load event) {
for (VoxylFeature listener : listeners) {
listener.reset();
}
if (VoxylUtils.isInVoxylNetwork()) {
if (!hasCheckedUpdates && VoxylUtils.isInVoxylNetwork()) {
hasCheckedUpdates = true;
VoxylUtils.getLatestVersion(new VoxylUtils.CallBack<Boolean, String>() {
@Override
public void call(Boolean outdated, String latestVersionText) {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/quasar/voxylenhanced/VoxylEnhancedCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;

import java.util.List;

Expand Down Expand Up @@ -39,6 +40,15 @@ public void processCommand(ICommandSender sender, String[] args) throws CommandE
if (args.length == 0) {
VoxylEnhanced.willOpenSettings = true;
} else if (args.length == 1) {
if (args[0].equals("inviteabunch") || args[0].equals("i") || args[0].equals("invite")) {
VoxylEnhanced.settings.inviteABunch = !VoxylEnhanced.settings.inviteABunch;
if (VoxylEnhanced.settings.inviteABunch) {
VoxylUtils.informPlayer(EnumChatFormatting.GREEN, "Invite-a-bunch enabled!");
} else {
VoxylUtils.informPlayer(EnumChatFormatting.RED, "Invite-a-bunch disabled!");
}
return;
}
VoxylEnhanced.settings.apiKey = args[0];
messageResponse(String.format("Set api key to %s", VoxylEnhanced.settings.apiKey));
} else commandHelpMessage();
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/quasar/voxylenhanced/VoxylInputHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.quasar.voxylenhanced.misc.VoxylMisc;
import com.quasar.voxylenhanced.obstacles.VoxylObstacles;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
Expand All @@ -29,6 +30,12 @@ public static void register() {
"voxylenhanced.vekeybinds"
)); // 1, obstaclesautorequeue

keyBindings.add(new KeyBinding(
"voxylenhanced.inviteabunch",
Keyboard.KEY_NONE,
"voxylenhanced.vekeybinds"
)); // 2, inviteabunch

for (KeyBinding keyBinding : keyBindings) {
ClientRegistry.registerKeyBinding(keyBinding);
}
Expand All @@ -42,5 +49,13 @@ public void clientTick(TickEvent.ClientTickEvent event) {
if (keyBindings.get(1).isPressed()) {
VoxylObstacles.restartPrivateGame();
}
if (keyBindings.get(2).isPressed()) {
VoxylEnhanced.settings.inviteABunch = !VoxylEnhanced.settings.inviteABunch;
if (VoxylEnhanced.settings.inviteABunch) {
VoxylUtils.informPlayer(EnumChatFormatting.GREEN, "Invite-a-bunch enabled!");
} else {
VoxylUtils.informPlayer(EnumChatFormatting.RED, "Invite-a-bunch disabled!");
}
}
}
}
8 changes: 8 additions & 0 deletions src/main/java/com/quasar/voxylenhanced/VoxylSettingsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ void goToHubButton() {
)
public int autoLactateInterval = 0;

@Property(
type = PropertyType.SWITCH,
name = "Invite a bunch",
description = "Requires expert rank. Don't be a nuisance! Run /invite every 31 seconds. Automatically disables on world change.",
category = "General"
)
public boolean inviteABunch = false;

@Property(
type = PropertyType.SWITCH,
name = "Discord Rich Presence",
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/com/quasar/voxylenhanced/misc/VoxylGameLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,15 @@ public void tickEvent(TickEvent.PlayerTickEvent event) {
break attemptScrapeGUI;
}
if (player.openContainer.getSlot(20).getStack() == null) {
System.out.println("stack null");
System.out.println("stack 1 null");
break attemptScrapeGUI;
}
if (player.openContainer.getSlot(22).getStack() == null) {
System.out.println("stack 2 null");
break attemptScrapeGUI;
}
if (player.openContainer.getSlot(24).getStack() == null) {
System.out.println("stack 3 null");
break attemptScrapeGUI;
}
System.out.println("printing tooltips");
Expand All @@ -153,6 +161,7 @@ public void tickEvent(TickEvent.PlayerTickEvent event) {
VoxylUtils.informPlayer("Game successfully logged!");
Minecraft.getMinecraft().thePlayer.closeScreen();
actionNumber = 0;
gameWon = false;
delayTicks = 0;
return;
}
Expand All @@ -162,8 +171,9 @@ public void tickEvent(TickEvent.PlayerTickEvent event) {
if (actionNumber == 1) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("/lastgame");
actionNumber = 2; // wait for gui to open
} else if (actionNumber == 3) {
} else if (actionNumber == 3) { // gui timeout
Minecraft.getMinecraft().thePlayer.closeScreen();
gameWon = false;
actionNumber = 0;
}
}
Expand All @@ -185,7 +195,7 @@ public void guiOpenEvent(GuiOpenEvent event) {
}
if (actionNumber == 2) {
actionNumber = 3;
delayTicks = 20;
delayTicks = 29;
}
}

Expand Down
48 changes: 21 additions & 27 deletions src/main/java/com/quasar/voxylenhanced/misc/VoxylMisc.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

Expand All @@ -24,28 +25,6 @@ public static void goToHub() {
Minecraft.getMinecraft().thePlayer.sendChatMessage("/hub");
}

public static String convInteger(Integer integer) {
switch (integer) {
case (0): return "A";
case (1): return "B";
case (2): return "C";
case (3): return "D";
case (4): return "E";
case (5): return "F";
case (6): return "G";
case (7): return "H";
case (8): return "I";
case (9): return "J";
case (10): return "K";
case (11): return "L";
case (12): return "M";
case (13): return "N";
case (14): return "O";
case (15): return "P";
default: return "X";
}
}

public static void obstaclesReadSegments() {
if (Minecraft.getMinecraft() == null) {
return;
Expand Down Expand Up @@ -121,21 +100,36 @@ public static void obstaclesReadSegments() {
}

public Long lastLactateTime = 0L; // this is cursed
public Long lastInviteTime = 0L;

@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
if (!VoxylUtils.isInBWPLobby()) {
return;
}
if (VoxylEnhanced.settings.autoLactateInterval == 0) {
return;
if (VoxylEnhanced.settings.inviteABunch) {
if (lastInviteTime < System.currentTimeMillis()-31000L) {
lastInviteTime = System.currentTimeMillis();
Minecraft.getMinecraft().thePlayer.sendChatMessage("/invite");
}
}
if (lastLactateTime == 0 || lastLactateTime < System.currentTimeMillis()-(VoxylEnhanced.settings.autoLactateInterval * 1000L)) {
lastLactateTime = System.currentTimeMillis();
Minecraft.getMinecraft().thePlayer.sendChatMessage("/lactate");
autoLactate: {
if (VoxylEnhanced.settings.autoLactateInterval == 0) {
break autoLactate;
}
if (lastLactateTime == 0 || lastLactateTime < System.currentTimeMillis()-(VoxylEnhanced.settings.autoLactateInterval * 1000L)) {
lastLactateTime = System.currentTimeMillis();
Minecraft.getMinecraft().thePlayer.sendChatMessage("/lactate");
}
}
}

@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
VoxylEnhanced.settings.inviteABunch = false;
lastInviteTime = 69420L; // this is necessary... trust me...
}

public void reset() {

}
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/com/quasar/voxylenhanced/sumo/VoxylBlockSumo.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
public class VoxylBlockSumo extends VoxylFeature {

static Pattern pOpItemSpawning = Pattern.compile("^An OP Item is spawning on the gold block in 5 seconds!.*$");
static Pattern pPowerupSpawning = Pattern.compile("^Powerup spawning in 10 seconds!.?.?.?$");
static Pattern pAllPlayerItems = Pattern.compile("^All players have recieved.*$");
static Long nextPowerItem = null;
static Long nextRegularItem = null;
static boolean isBSD = false;
static DecimalFormat df = new DecimalFormat("0.0");

@SubscribeEvent
Expand All @@ -34,9 +36,15 @@ public void chatMessage(ClientChatReceivedEvent event) {
}
if (pOpItemSpawning.matcher(event.message.getUnformattedText()).find()) {
nextPowerItem = System.currentTimeMillis() + 5000L;
isBSD = false;
}
if (pPowerupSpawning.matcher(event.message.getUnformattedText()).find()) {
nextPowerItem = System.currentTimeMillis() + 10000L;
isBSD = true;
}
if (pAllPlayerItems.matcher(event.message.getUnformattedText()).find()) {
nextRegularItem = System.currentTimeMillis() + 25000L;
isBSD = false;
}
}

Expand All @@ -52,7 +60,12 @@ public void drawText(RenderGameOverlayEvent.Text event) {

if (nextPowerItem != null) {
if (nextPowerItem < System.currentTimeMillis()) {
nextPowerItem = System.currentTimeMillis() + 30000L;
if (!isBSD) {
nextPowerItem = System.currentTimeMillis() + 30000L;
} else {
// may not be fully accurate
nextPowerItem = System.currentTimeMillis() + 25000L;
}
}
VoxylUtils.drawText("OP Item: " + formatTime(nextPowerItem, System.currentTimeMillis()), false, 5);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/voxylenhanced/lang/en_US.lang
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
voxylenhanced.obstaclesautorequeue=Obstacles Auto RQ
voxylenhanced.gotohub=Go to Hub
voxylenhanced.inviteabunch=Invite a bunch
voxylenhanced.vekeybinds=Voxyl Enhanced

0 comments on commit a2073f1

Please sign in to comment.