Skip to content

Commit

Permalink
More changes!. Changed the webhook messages. Added SENT packet even…
Browse files Browse the repository at this point in the history
…t, made some changes to AnimationUtils and TimerUtils, ColorManager lazy initialisation. HudEditorScreen can now change element snap size with scrolling. Also changed Painter NomadHut, and more stuff.
  • Loading branch information
tanishisherewithhh committed Aug 16, 2024
1 parent 63779f3 commit 8220284
Show file tree
Hide file tree
Showing 23 changed files with 246 additions and 68 deletions.
5 changes: 3 additions & 2 deletions .github/discordWebhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ const runNumber = process.env.GITHUB_RUN_NUMBER;
const repoName = process.env.GITHUB_REPOSITORY;
const pushUser = process.env.PUSH_USER;
const runID = process.env.RUN_ID;
const commitMessage = process.env.COMMIT_MESSAGE;

function sendBuildStatus(status) {
let title, description, color, buildOutput;

description = `*${commitMessage}*`;
if (status === 'success') {
title = 'Build Successful';
description = 'The latest build of the project was successful. Details...';
color = 3066993; // green
buildOutput = `https://github.com/HeliosMinecraft/HeliosClient/actions/runs/${runID}`;
} else if (status === 'failure') {
title = 'Build Failed';
description = 'The latest build of the project failed. Details...';
color = 15158332; // red
buildOutput = `https://github.com/HeliosMinecraft/HeliosClient/actions`;
}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
fail_on_unmatched_files: true
generate_release_notes: true
body:
"Generated pre-release. Maybe unstable to use"
"This pre-release was generated by GitHub Actions. It may contain bugs and be unstable. Please report any issues you encounter."
files: |
./build/libs/*.jar
Expand All @@ -87,4 +87,5 @@ jobs:
GITHUB_RUN_NUMBER: ${{ github.run_number }}
GITHUB_REPOSITORY: ${{ github.repository }}
PUSH_USER: ${{ github.actor }}
RUN_ID: ${{ github.run_id }}
RUN_ID: ${{ github.run_id }}
COMMIT_MESSAGE: ${{ env.COMMIT_MESSAGE }}
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,18 @@ public Packet<?> getPacket() {
return packet;
}
}

@LuaEvent("packetSentEvent")
public static class SENT extends PacketEvent {
public Packet<?> packet;

public SENT(Packet<?> packet) {
this.packet = packet;
}

public Packet<?> getPacket() {
return packet;
}
}
}

13 changes: 12 additions & 1 deletion src/main/java/dev/heliosclient/hud/HudElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.math.MathHelper;

import java.awt.*;
import java.util.ArrayList;
Expand Down Expand Up @@ -59,6 +60,9 @@ public class HudElement implements ISettingChange, ISaveAndLoad, Listener {
public SettingGroup sgUI = new SettingGroup("UI");
public boolean isInHudEditor = false;
public UniqueID id;
int startX, startY;
private static int snapSize = 120;

public BooleanSetting renderBg = sgUI.add(new BooleanSetting.Builder()
.name("Render background")
.description("Render the background for the element")
Expand Down Expand Up @@ -138,7 +142,6 @@ public class HudElement implements ISettingChange, ISaveAndLoad, Listener {
.shouldRender(() -> shadow.value && !syncShadowColorAsBackground.value && renderBg.value)
.onSettingChange(this)
.build());
int startX, startY, snapSize = 120;


public HudElement(HudElementData<?> hudElementInfo) {
Expand Down Expand Up @@ -491,4 +494,12 @@ public void loadFromFile(Map<String, Object> MAP) {
this.distanceX = x;
this.distanceY = y;
}

public static void setSnapSize(int snapSize){
HudElement.snapSize = MathHelper.clamp(snapSize,0,mc.getWindow().getScaledWidth() * mc.getWindow().getScaledHeight());
}

public static int getSnapSize() {
return snapSize;
}
}
4 changes: 2 additions & 2 deletions src/main/java/dev/heliosclient/managers/ColorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public static void createInstance(){
private ColorManager() {
new GradientManager.GradientBuilder()
.setName("Rainbow")
.setStartGradient(ColorUtils::getRainbowColor)
.setEndGradient(ColorUtils::getRainbowColor2)
.setStartGradient(ColorUtils::getRainbowColor2)
.setEndGradient(ColorUtils::getRainbowColor)
.register();

new GradientManager.GradientBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ private static <T extends PacketListener> void onHandlePacket(Packet<T> packet,
} else if (EventManager.postEvent(new PacketEvent.RECEIVE(packet)).isCanceled()) info.cancel();
}

@Inject(method = "send(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/PacketCallbacks;)V", at = @At("HEAD"), cancellable = true)
public void send(Packet<?> packet, PacketCallbacks callbacks, CallbackInfo ci) {
@Inject(method = "send(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/PacketCallbacks;Z)V", at = @At("HEAD"), cancellable = true)
public void send(Packet<?> packet, PacketCallbacks callbacks, boolean flush, CallbackInfo ci) {
if (EventManager.postEvent(new PacketEvent.SEND(packet)).isCanceled()) ci.cancel();

// Call commands if the prefix is sent
Expand All @@ -46,4 +46,8 @@ public void send(Packet<?> packet, PacketCallbacks callbacks, CallbackInfo ci) {
ci.cancel();
}
}
@Inject(method = "send(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/PacketCallbacks;Z)V", at = @At("TAIL"))
public void sent(Packet<?> packet, PacketCallbacks callbacks, boolean flush, CallbackInfo ci) {
EventManager.postEvent(new PacketEvent.SENT(packet));
}
}
17 changes: 17 additions & 0 deletions src/main/java/dev/heliosclient/mixin/GameRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
import dev.heliosclient.module.modules.render.NoRender;
import dev.heliosclient.module.modules.render.Zoom;
import dev.heliosclient.module.modules.world.LiquidInteract;
import dev.heliosclient.module.sysmodules.ClickGUI;
import dev.heliosclient.util.render.GradientBlockRenderer;
import dev.heliosclient.util.render.Renderer2D;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.BufferBuilderStorage;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
Expand All @@ -30,6 +34,8 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import java.awt.*;

@Mixin(GameRenderer.class)
public abstract class GameRendererMixin {

Expand All @@ -49,6 +55,7 @@ public abstract class GameRendererMixin {

@Shadow private float zoomX;
@Shadow private float zoomY;
@Shadow @Final private BufferBuilderStorage buffers;
@Unique private float lastZoom;
@Unique private boolean isZooming;

Expand Down Expand Up @@ -103,6 +110,16 @@ private void render(float tickDelta, long limitTime, MatrixStack matrices, Callb
isZooming = false;
}
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V",shift = At.Shift.AFTER))
private void renderWorld$GlowMouse(float tickDelta, long startTime, boolean tick, CallbackInfo ci) {
if(ClickGUI.shouldGlowMousePointer()) {
DrawContext drawContext = new DrawContext(this.client, this.buffers.getEntityVertexConsumers());

double i = this.client.mouse.getX() * (double) this.client.getWindow().getScaledWidth() / (double) this.client.getWindow().getWidth();
double j = this.client.mouse.getY() * (double) this.client.getWindow().getScaledHeight() / (double) this.client.getWindow().getHeight();
Renderer2D.drawCircularBlurredShadow(drawContext.getMatrices(), (float) i, (float) j,5.0f, ClickGUI.getGlowColor(), ClickGUI.getGlowRadius());
}
}

@Inject(method = "bobView", at = @At(value = "HEAD"), cancellable = true)
private void cancelBobView(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ChestAura extends Module_ {
BooleanSetting trappedChests = sgGeneral.add(new BooleanSetting("Trapped Chests", "Opens trapped chests as well", this, false, () -> true, false));
BooleanSetting rotate = sgGeneral.add(new BooleanSetting("Rotate", "Rotates to look at the chest before opening it", this, true, () -> true, true));
BooleanSetting clearOnDisable = sgGeneral.add(new BooleanSetting("Clear on disable", "Clears opened container cache on module disable", this, true, () -> true, true));
BooleanSetting autoSteal = sgGeneral.add(new BooleanSetting("AutoSteal", "Automatically steals all the items from the chest (buggy and unreliable).", this, false, () -> true, false));
BooleanSetting autoSteal = sgGeneral.add(new BooleanSetting("AutoSteal", "Automatically steals all the items from the chest (maybe unreliable).", this, false, () -> true, false));


public ChestAura() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void onEnable() {
public void onSettingChange(Setting<?> setting) {
super.onSettingChange(setting);
if (cancelBounce.value && mode.value == 2) {
ChatUtils.sendHeliosMsg("SlimeBlocks will cause fall damage with cancelBounce on!");
ChatUtils.sendHeliosMsg("(NoFall Clutch) SlimeBlocks will cause fall damage with cancelBounce on!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class AntiHunger extends Module_ {
.min(0)
.max(20)
.roundingPlace(0)
.shouldRender(()-> suppressJumping.value)
.build()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class PacketMine extends Module_ {
private final Map<BlockPos, Double> progressMap = new HashMap<>();
private final Map<BlockPos, Integer> timerMap = new HashMap<>();
private final Map<BlockPos, Boolean> miningMap = new HashMap<>();

private final DoubleSetting delay = sgGeneral.add(new DoubleSetting.Builder()
.name("Delay")
.description("Delay between mining blocks (in ticks).")
Expand All @@ -45,7 +46,7 @@ public class PacketMine extends Module_ {
private final BooleanSetting rotate = sgGeneral.add(new BooleanSetting.Builder()
.name("Rotate")
.description("Rotates to look at the block before mining it")
.defaultValue(true)
.defaultValue(false)
.onSettingChange(this)
.build()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ public void onTick(TickEvent.PLAYER event) {
ticksPassed = 0;

if (shouldMine()) {
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, direction));
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, direction));
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos,direction == null ? Direction.UP : direction));
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, direction == null ? Direction.UP : direction));

mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public class Painter extends Module_ {
[-1,0,0]{minecraft:obsidian}
[-1,1,0]{minecraft:obsidian}
[-1,2,0]{minecraft:obsidian}
[1,3,0]{minecraft:obsidian}
[0,3,0]{minecraft:obsidian}
[-1,3,0]{minecraft:obsidian}
[2,0,1]{minecraft:obsidian}
[2,1,1]{minecraft:obsidian}
[2,2,1]{minecraft:obsidian}
Expand Down Expand Up @@ -97,12 +100,15 @@ public class Painter extends Module_ {
[1,3,3]{minecraft:obsidian}
[0,3,3]{minecraft:obsidian}
[-1,3,3]{minecraft:obsidian}
[1,3,1]{minecraft:obsidian}
[0,3,1]{minecraft:obsidian}
[-1,3,1]{minecraft:obsidian}
[1,3,2]{minecraft:obsidian}
[0,3,2]{minecraft:obsidian}
[-1,3,2]{minecraft:obsidian}
[1,3,1]{minecraft:obsidian}
[0,3,1]{minecraft:obsidian}
[-1,3,1]{minecraft:obsidian}""";
[1,3,3]{minecraft:obsidian}
[0,3,3]{minecraft:obsidian}
[-1,3,3]{minecraft:obsidian}""";

public Direction lockedDirection = null;
public BlockPos lockedStartPos = null;
Expand Down
64 changes: 62 additions & 2 deletions src/main/java/dev/heliosclient/module/sysmodules/ClickGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import dev.heliosclient.module.Module_;
import dev.heliosclient.module.settings.*;
import dev.heliosclient.module.settings.buttonsetting.ButtonSetting;
import dev.heliosclient.ui.clickgui.ModuleButton;
import dev.heliosclient.ui.clickgui.Tooltip;
import dev.heliosclient.util.ColorUtils;
import dev.heliosclient.util.FileUtils;
Expand Down Expand Up @@ -64,7 +65,7 @@ public class ClickGUI extends Module_ {
);
public DoubleSetting CategoryHeight = sgMisc.add(new DoubleSetting.Builder()
.name("CategoryPane Height")
.description("CategoryPane Height for the ClickGUI")
.description("Max CategoryPane Height for the ClickGUI")
.onSettingChange(this)
.defaultValue(230.0)
.max(500)
Expand All @@ -73,6 +74,16 @@ public class ClickGUI extends Module_ {
.shouldRender(() -> ScrollType.value == 1)
.build()
);
public DoubleSetting moduleButtonHeight = sgMisc.add(new DoubleSetting.Builder()
.name("ModuleButton Height")
.description("ModuleButton Height for the ClickGUI")
.onSettingChange(this)
.defaultValue(16)
.max(50)
.min(1)
.roundingPlace(0)
.build()
);
public DoubleSetting ScrollSpeed = sgMisc.add(new DoubleSetting.Builder()
.name("Scroll Sensitivity")
.description("Change your scroll speed multiplier for the ClickGUI")
Expand Down Expand Up @@ -208,6 +219,31 @@ public class ClickGUI extends Module_ {
.defaultValue(new Color(ColorManager.INSTANCE.defaultTextColor))
.build()
);
public BooleanSetting glowMousePointer = sgGeneral.add(new BooleanSetting.Builder()
.name("Glowing mouse pointer")
.onSettingChange(this)
.value(true)
.build()
);
public DoubleSetting glowRadius = sgGeneral.add(new DoubleSetting.Builder()
.name("Glow Radius")
.description("Radius of the glow")
.onSettingChange(this)
.defaultValue(20d)
.min(0)
.max(100)
.roundingPlace(0)
.shouldRender(()->glowMousePointer.value)
.build()
);
public RGBASetting glowColor = sgGeneral.add(new RGBASetting.Builder()
.name("Glow color")
.description("Color of the glow")
.onSettingChange(this)
.defaultValue(Color.WHITE)
.shouldRender(()-> glowMousePointer.value)
.build()
);
public KeyBind clickGUIKeyBind = sgConfig.add(new KeyBind.Builder()
.name("ClickGUI bind")
.description("The key to open the ClickGUI screen")
Expand Down Expand Up @@ -277,7 +313,6 @@ public ClickGUI() {
addSettingGroup(sgConfig);
//addSettingGroup(sgExpert);


active.value = true;

configPath.setShouldSaveOrLoad(false);
Expand Down Expand Up @@ -357,6 +392,10 @@ public void onSettingChange(Setting<?> setting) {
HeliosClient.CONFIG.writeModuleConfig();
HeliosClient.CONFIG.moduleConfigManager.switchConfig(switchConfigs.getOption().toString(), true);
}

if(setting == moduleButtonHeight){
ModuleButton.height = moduleButtonHeight.getInt();
}
}


Expand All @@ -376,6 +415,27 @@ public void onLoad() {

FontManager.INSTANCE.registerFonts();
}
public static boolean shouldGlowMousePointer(){
if(HeliosClient.CLICKGUI != null){
return HeliosClient.CLICKGUI.glowMousePointer.value;
}

return false;
}
public static int getGlowRadius(){
if(HeliosClient.CLICKGUI != null){
return HeliosClient.CLICKGUI.glowRadius.getInt();
}

return 0;
}
public static Color getGlowColor(){
if(HeliosClient.CLICKGUI != null){
return HeliosClient.CLICKGUI.glowColor.getColor();
}

return Color.WHITE;
}

public int getAccentColor() {
return AccentColor.getColor().getRGB();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public CategoryPane(Category category, int initialX, int initialY, boolean colla
EventManager.register(this);
}


public static int getWidth() {
return width;
}
Expand Down
Loading

0 comments on commit 8220284

Please sign in to comment.