Skip to content

Commit

Permalink
Improved various warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTas committed Jan 1, 2024
1 parent fdc4257 commit 0ea4392
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 35 deletions.
40 changes: 20 additions & 20 deletions src/main/java/dev/stardust/modules/AutoDrawDistance.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.mixininterface.IChatHud;


/**
Expand Down Expand Up @@ -105,10 +106,9 @@ private void updateDrawDistance(int distance) {

mc.options.sendClientSettings();
if (verbose.get() && !(mc.player == null)) {
mc.player.sendMessage(
Text.of(
"§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Updated view distance to§8: §2"+distance+"§7."
)
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Updated view distance to§8: §2"+distance+"§7."),
"View distance debug update".hashCode()
);
}
}
Expand Down Expand Up @@ -162,16 +162,16 @@ private void onTick(TickEvent.Post event) {
sweetSpotCounter = 0;
if (verbose.get() && mc.player != null) {
if (reportFPS.get()) {
mc.player.sendMessage(
Text.of(
"§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Average FPS§8: §2"+averageFps
));
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Average FPS§8: §2"+averageFps),
"Average FPS update".hashCode()
);
}

mc.player.sendMessage(
Text.of(
"§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Entered a §2sweet spot§8!"
));
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Entered a §2sweet spot§8!"),
"Sweet spot update".hashCode()
);
}
} else {
justIncreased++;
Expand All @@ -187,10 +187,10 @@ private void onTick(TickEvent.Post event) {
justIncreased++;
fpsData.clear();
if (verbose.get() && reportFPS.get() && mc.player != null) {
mc.player.sendMessage(
Text.of(
"§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Average FPS§8: §2"+averageFps
));
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Average FPS§8: §2"+averageFps),
"Average FPS update".hashCode()
);
}

updateDrawDistance(drawDistance + 1);
Expand All @@ -200,10 +200,10 @@ private void onTick(TickEvent.Post event) {
if (drawDistance <= minDistance.get()) return;

if (verbose.get() && reportFPS.get() && mc.player != null) {
mc.player.sendMessage(
Text.of(
"§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Average FPS§8: §2"+averageFps
));
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Average FPS§8: §2"+averageFps),
"Average FPS update".hashCode()
);
}

fpsData.clear();
Expand Down
13 changes: 8 additions & 5 deletions src/main/java/dev/stardust/modules/BannerData.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;
import java.util.Optional;
import dev.stardust.Stardust;
import meteordevelopment.meteorclient.mixininterface.IChatHud;
import net.minecraft.text.Text;
import net.minecraft.util.DyeColor;
import net.minecraft.block.entity.*;
Expand Down Expand Up @@ -174,11 +175,12 @@ private void onRightClickBlock(InteractBlockEvent event) {
if (copyToClipboard.get()) {
NbtCompound metadata = banner.toInitialChunkDataNbt();
mc.keyboard.setClipboard(metadata.toString());
mc.player.sendMessage(
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of(
"§8<"+StardustUtil.rCC()+"§o✨§r§8> §7"
+ txtFormat + "Copied NBT data to clipboard§7."
)
+ txtFormat + "Copied NBT data to clipboard§7."
),
"Clipboard update".hashCode()
);
}

Expand All @@ -187,11 +189,12 @@ private void onRightClickBlock(InteractBlockEvent event) {
NbtCompound metadata = sign.toInitialChunkDataNbt();
if (copyToClipboard.get()) {
mc.keyboard.setClipboard(metadata.toString());
mc.player.sendMessage(
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of(
"§8<"+StardustUtil.rCC()+"§o✨§r§8> §7§o"
+ "Copied NBT data to clipboard."
)
),
"Clipboard update".hashCode()
);
} else {
mc.player.sendMessage(
Expand Down
28 changes: 18 additions & 10 deletions src/main/java/dev/stardust/modules/RocketMan.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.mixininterface.IChatHud;
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
import meteordevelopment.meteorclient.events.packets.PacketEvent;
import meteordevelopment.meteorclient.systems.modules.render.FreeLook;
Expand Down Expand Up @@ -327,8 +328,9 @@ private void handleDurabilityChecks() {
float vol = warnVolume.get() / 100f;
mc.player.playSound(SoundEvents.ENTITY_ITEM_BREAK, vol, 1f);
}
mc.player.sendMessage(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Elytra durability: §4"+percentDurability+"§7%")
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Elytra durability: §4"+percentDurability+"§7%"),
"Elytra durability warning".hashCode()
);
ticksSinceWarned = 0;
}
Expand All @@ -341,8 +343,9 @@ private void handleDurabilityChecks() {
float vol = warnVolume.get() / 100f;
mc.player.playSound(SoundEvents.ENTITY_ITEM_BREAK, vol, 1f);
}
mc.player.sendMessage(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Elytra durability: §c"+percentDurability+"§7%")
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Elytra durability: §4"+percentDurability+"§7%"),
"Elytra durability warning".hashCode()
);
ticksSinceWarned = 0;
}
Expand All @@ -366,8 +369,9 @@ private void handleFireworkRocketChecks() {
float vol = notifyVolume.get() / 100f;
mc.player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, vol, 1f);
}
mc.player.sendMessage(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Rockets remaining: §c"+totalRockets+"§7.")
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> §7Rockets remaining: §c"+totalRockets+"§7."),
"Rockets remaining warning".hashCode()
);
ticksSinceNotified = 0;
}
Expand Down Expand Up @@ -435,12 +439,16 @@ public void onActivate() {
}
}
if (!foundElytra) {
this.toggle();
mc.player.sendMessage(Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> "+"§4No elytra in inventory!"));
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> "+"§4No elytra in inventory!"),
"No elytra warning".hashCode()
);
}
} else {
this.toggle();
mc.player.sendMessage(Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> "+"§4No elytra equipped!"));
((IChatHud) mc.inGameHud.getChatHud()).meteor$add(
Text.of("§8<"+ StardustUtil.rCC()+"§o✨§r§8> "+"§4No elytra equipped!"),
"No elytra warning".hashCode()
);
}
} else if (takeoff.get() && mc.player.isFallFlying()) {
useFireworkRocket();
Expand Down

0 comments on commit 0ea4392

Please sign in to comment.