Skip to content

Commit

Permalink
Big changes:
Browse files Browse the repository at this point in the history
- Improved Speed [StrictStrafe] mode
- Fixed TickShift module
- New EntityRemovedEvent
- New Notifier
- Added RaytraceUtils, MovementUtils and NetworkUtils
- Renamed NoInvisible in NoRender to trueSight
- Added autoSteal delay in ChestAura
- Improved Module search
- Added placing check in AntiGhostBlocks
- Fixed SafeWalk [OnEdge] mode and scaffold onEdge check.
- Added [Shift] mode to ReverseStep
- Optimised StringListSetting
- Optimised BlockESP
- Improved Notifications, and added smooth animations to it. Removed hard-coded values and added more customisation settings for notifications.
- Added BACK_OUT easing
- Changed BiConsumer to Consumer in ChunkChecker
- Monthly bug hunting
  • Loading branch information
tanishisherewithhh committed Nov 23, 2024
1 parent beeaec7 commit 61d920b
Show file tree
Hide file tree
Showing 83 changed files with 1,728 additions and 710 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

<p>Keep in mind that these images might be outdated as Helios is currently updating frequently!</p>
<details>
<summary>Click to show the new GUI</summary>
<p>New clickGui as of commit #235 (a13bf24)</p>
<img src="https://github.com/HeliosMinecraft/HeliosClient/blob/main/.github/images/Updated_ClickGUI.png?raw=true" alt="New Click GUI">
<summary>Click to show the latest client GUI</summary>
<p>WIP</p>
<img src="https://github.com/HeliosMinecraft/HeliosClient/blob/main/.github/images/Latest_ClickGUI.png?raw=true" alt="Latest Click GUI">
</details>
<details>
<summary>Click to show the previous GUI</summary>
<p>Previous click-gui as of commit #199 (0758e8c)</p>
<summary>Click to show old GUI </summary>
<p>New clickGui as of commit #235 (a13bf24)</p>
<img src="https://github.com/HeliosMinecraft/HeliosClient/blob/main/.github/images/Updated_ClickGUI.png?raw=true" alt="New Click GUI">
<p>Previous click-gui as of commit #199 (0758e8c)</p>
<img src="https://github.com/HeliosMinecraft/HeliosClient/blob/main/.github/images/heliosclientgui.png?raw=true" alt="Prev Click GUI">
</details>
<details>
<summary>Click to show the old GUI</summary>
<p>Very old GUI (In starting stages)</p>
<img src="https://github.com/HeliosMinecraft/HeliosClient/blob/main/.github/images/ClickGUI.png?raw=true" alt="Old Click GUI">
</details>

Expand All @@ -47,12 +47,12 @@
To submit a bug open an issue in this repository. Before doing so please assure yourself that the issues isn't already listed under [Known issues](#known-issues).

## Known issues
- Buggy modules like Tick-Shift.
- ~~Buggy modules like Tick-Shift.~~
- Incomplete modules like Phase, Fucker, InventoryTweaks.
- ~~HudElements don't resize to their proper locations sometimes.~~
- Scripting System (WIP).
- Lack of combat and some important utility modules.
- No Baritone Integration
- ~~No Baritone Integration~~
- ~~No AltManager~~ No AltManager GUI
- Lack of commands
- Lack of shaders (Neither of the current contributors know much good about GLSL)
Expand Down
1 change: 0 additions & 1 deletion src/main/java/dev/heliosclient/HeliosClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public class HeliosClient implements ModInitializer, Listener {
public static ConsoleScreen CONSOLE = new ConsoleScreen();
public static File SAVE_FOLDER = new File(MC.runDirectory.getPath() + "/heliosclient");


//Methods for saving and loading
public static void loadConfig() {
load(config -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package dev.heliosclient.event.events.entity;

import dev.heliosclient.event.Event;
import net.minecraft.entity.Entity;

public class EntityRemovedEvent extends Event {
private final Entity entity;
private final int entityId;
private final Entity.RemovalReason removalReason;

public EntityRemovedEvent(Entity entity, Entity.RemovalReason removalReason, int entityId) {
this.entity = entity;
this.removalReason = removalReason;
this.entityId = entityId;
}

public Entity.RemovalReason getRemovalReason() {
return removalReason;
}

public int getEntityId() {
return entityId;
}

public Entity getEntity() {
return entity;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class KeyboardInputEvent extends Event {
public boolean pressingRight;
public boolean jumping;
public boolean sneaking;
public float movementForward = 0.0f, movementSideways = 0.0f;

public KeyboardInputEvent(boolean pressingForward, boolean pressingBack, boolean pressingLeft, boolean pressingRight, boolean jumping, boolean sneaking) {
this.pressingForward = pressingForward;
Expand All @@ -37,4 +38,10 @@ public void setNone() {
this.set(false,false,false,false,false,false);
}

public boolean shouldApplyMovementForward(){
return this.movementForward != 0.0f;
}
public boolean shouldApplyMovementSideways(){
return this.movementSideways != 0.0f;
}
}
6 changes: 3 additions & 3 deletions src/main/java/dev/heliosclient/hud/HudElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public class HudElement implements ISettingChange, ISaveAndLoad, Listener {
public DoubleSetting outlineThickness = sgUI.add(new DoubleSetting.Builder()
.name("Outline Thickness")
.description("Thickness of the outline around the element")
.value(1.2d)
.value(1)
.min(0)
.max(15)
.defaultValue(1.2d)
.roundingPlace(1)
.defaultValue(1)
.roundingPlace(0)
.shouldRender(() -> renderOutline.value)
.onSettingChange(this)
.build()
Expand Down
103 changes: 55 additions & 48 deletions src/main/java/dev/heliosclient/managers/CapeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static String[] loadCapes() {
}
}

loadDefaultCapeTexture();
copyDefaultCapeTexture();

// Get the cape files from `heliosclient/capes` directory in an array
File[] capeFiles = CAPE_DIRECTORY.listFiles((dir, name) -> name.toLowerCase().endsWith(".png") || name.toLowerCase().endsWith(".gif"));
Expand All @@ -82,7 +82,7 @@ public static String[] loadCapes() {
String fileName = file.getName();
capeNames.add(fileName);

capeTextureManager.registerCapeTextures(inputStream, file, fileName);
capeTextureManager.registerCapeTextures(inputStream, file, fileName.toLowerCase().trim());
HeliosClient.LOGGER.info("Loaded cape: {}", file.getAbsolutePath());
} catch (IOException e) {
HeliosClient.LOGGER.error("An error has occurred while reading cape file: {}{}", ColorUtils.darkGreen, file.getName(), e);
Expand All @@ -103,7 +103,7 @@ public static String[] loadCapes() {
}
}

public static void loadDefaultCapeTexture(){
public static void copyDefaultCapeTexture(){
File defaultCapeFile = new File(CAPE_DIRECTORY, DEFAULT_CAPE);

// Do not copy if the default cape file already exists
Expand All @@ -123,7 +123,7 @@ public static void loadDefaultCapeTexture(){
}

/**
* <a href="https://github.com/dragonostic/of-capes/blob/main/src/main/java/net/drago/ofcapes/util/PlayerHandler.java">Credit</a>
* <a href="https://github.com/dragonostic/of-capes/blob/main/src/main/java/net/drago/ofcapes/util/PlayerHandler.java">Logic Credit</a>
*
* @param image Native image to be parsed
* @return parsed image
Expand Down Expand Up @@ -184,6 +184,52 @@ public static void getCapes(CapeOrigin type, String profileName, String UUID) th
future.get();
}

private void getOptifineCape(String profileName) throws Exception {
String url = "http://s.optifine.net/capes/" + profileName + ".png";
saveCapeFromUrl(profileName, null, url);
}

private void getCrafatarCape(String UUID) throws Exception {
String url = "https://crafatar.com/capes/" + UUID;
saveCapeFromUrl(null, UUID, url);
}

private void getMinecraftCapesCape(String UUID) throws Exception {
String url = "https://api.minecraftcapes.net/profile/" + UUID.replace("-", "");
saveCapeFromBase64(UUID, url);
}

public HttpURLConnection getConnection(String url) throws Exception {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(MinecraftClient.getInstance().getNetworkProxy());
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36");
connection.setDoInput(true);
connection.setDoOutput(false);
return connection;
}

private void saveCapeFromUrl(String profileName, String UUID, String url) throws Exception {
HttpURLConnection connection = INSTANCE.getConnection(url);
connection.connect();

if (connection.getResponseCode() / 100 == 2) {
BufferedImage image = ImageIO.read(connection.getInputStream());
if (profileName == null) {
profileName = ProfileUtils.getProfileName(UUID);
}
File outputfile = new File(CAPE_DIRECTORY, profileName + ".png");
ImageIO.write(image, "png", outputfile);
connection.disconnect();
} else {
String responseMessage = connection.getResponseMessage();
HeliosClient.LOGGER.error("Connection Message: {}, Response Code: {}", responseMessage, connection.getResponseCode());
if(connection.getResponseCode() == 404) {
responseMessage += " [Helios] Given player UUID may not contain a cape";
}

throw new HttpResponseException(connection.getResponseCode(), responseMessage);
}
}

private static void saveCapeFromBase64(String UUID, String url) throws Exception {
HttpURLConnection connection = INSTANCE.getConnection(url);
connection.connect();
Expand All @@ -196,7 +242,7 @@ private static void saveCapeFromBase64(String UUID, String url) throws Exception
throw new JsonParseException("Json result returned is null");
}
JsonElement jsonElement = result.getAsJsonObject("textures").get("cape");
boolean animated = result.getAsJsonObject("animatedCape").getAsBoolean();
boolean animated = result.getAsJsonPrimitive("animatedCape").getAsBoolean();

if (animated) {
HeliosClient.LOGGER.error("Animated capes are not supported");
Expand Down Expand Up @@ -226,46 +272,6 @@ private static void saveCapeFromBase64(String UUID, String url) throws Exception
}
}

private void getOptifineCape(String profileName) throws Exception {
String url = "http://s.optifine.net/capes/" + profileName + ".png";
saveCapeFromUrl(profileName, null, url);
}

private void getCrafatarCape(String UUID) throws Exception {
String url = "https://crafatar.com/capes/" + UUID;
saveCapeFromUrl(null, UUID, url);
}

private void getMinecraftCapesCape(String UUID) throws Exception {
String url = "https://api.minecraftcapes.net/profile/" + UUID.replace("-", "");
saveCapeFromBase64(UUID, url);
}

public HttpURLConnection getConnection(String url) throws Exception {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(MinecraftClient.getInstance().getNetworkProxy());
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36");
connection.setDoInput(true);
connection.setDoOutput(false);
return connection;
}

private void saveCapeFromUrl(String profileName, String UUID, String url) throws Exception {
HttpURLConnection connection = INSTANCE.getConnection(url);
connection.connect();

if (connection.getResponseCode() / 100 == 2) {
BufferedImage image = ImageIO.read(connection.getInputStream());
if (profileName == null) {
profileName = ProfileUtils.getProfileName(UUID);
}
File outputfile = new File(CAPE_DIRECTORY, profileName + ".png");
ImageIO.write(image, "png", outputfile);
connection.disconnect();
} else {
HeliosClient.LOGGER.error("Connection Message: {}, Response Code: {}", connection.getResponseMessage(), connection.getResponseCode());
throw new HttpResponseException(connection.getResponseCode(), connection.getResponseMessage());
}
}
public static Identifier getCurrentCapeTexture() {
if(HeliosClient.MC.player == null){
return capeTextureManager.getCurrentTexture(HeliosClient.MC.getGameProfile().getId(),false);
Expand All @@ -280,13 +286,14 @@ public static Identifier getCurrentElytraTexture() {
return capeTextureManager.getCurrentTexture(HeliosClient.MC.player.getUuid(),true);
}

public static CapeTextureManager getTextureManager(){
return capeTextureManager;
}

public enum CapeOrigin {
LOCAL,
OPTIFINE,
CRAFATAR,
MINECRAFTCAPES
}
public static CapeTextureManager getTextureManager(){
return capeTextureManager;
}
}
7 changes: 2 additions & 5 deletions src/main/java/dev/heliosclient/managers/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,12 @@ public static Event postEvent(Event event) {
List<EventListener> eventListeners = listeners.get(event.getClass());

if (eventListeners == null || eventListeners.isEmpty()) return event;

eventListeners.remove(null);
for (EventListener listener : eventListeners) {
if(listener == null){
eventListeners.remove(listener);
continue;
}
listener.accept(event);
}

//Run script events on a separate thread to avoid block our main thread.
if (event.getClass().isAnnotationPresent(LuaEvent.class) && LuaEventManager.INSTANCE.hasListeners()) {
executor.execute(() -> LuaEventManager.INSTANCE.post(event.getClass().getAnnotation(LuaEvent.class).value(), CoerceJavaToLua.coerce(event)));
}
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/dev/heliosclient/managers/FriendManager.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package dev.heliosclient.managers;

import dev.heliosclient.HeliosClient;
import dev.heliosclient.system.Friend;
import dev.heliosclient.util.ChatUtils;
import net.minecraft.client.MinecraftClient;

import java.util.HashSet;
import java.util.Objects;

public class FriendManager {
private static final HashSet<String> friendsName = new HashSet<>();
protected static MinecraftClient mc = MinecraftClient.getInstance();
// Declare a list of friends
private static HashSet<Friend> friends = new HashSet<>();

public FriendManager() {
Expand All @@ -28,7 +26,7 @@ public static boolean isFriend(String userName) {
}

public static void addFriend(Friend friend) {
if (Objects.equals(friend.playerName(), mc.getSession().getUsername())) {
if (Objects.equals(friend.playerName(), HeliosClient.MC.getSession().getUsername())) {
ChatUtils.sendHeliosMsg("You can't befriend yourself.");
} else {
friends.add(friend);
Expand Down
21 changes: 7 additions & 14 deletions src/main/java/dev/heliosclient/managers/KeybindManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
import dev.heliosclient.scripting.LuaFile;
import dev.heliosclient.scripting.LuaScriptManager;
import dev.heliosclient.ui.clickgui.ClickGUIScreen;
import dev.heliosclient.ui.clickgui.settings.AbstractSettingScreen;
import dev.heliosclient.ui.clickgui.hudeditor.HudEditorScreen;
import dev.heliosclient.ui.clickgui.settings.AbstractSettingScreen;
import dev.heliosclient.util.timer.TimerUtils;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.gui.screen.GameMenuScreen;
import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen;
Expand All @@ -31,16 +32,15 @@ public class KeybindManager implements Listener {
private static final int[] CPS = new int[2];
public static KeybindManager INSTANCE = new KeybindManager();
static boolean isWPressed = false, isAPressed = false, isSPressed = false, isDPressed = false, isSpacePressed = false;
// For KeyStrokes.

//Todo: Make KeyStrokes element
private static long lastLeftClick = 0;
private static long lastRightClick = 0;
TimerUtils leftClickTimer = new TimerUtils(true);
TimerUtils rightClickTimer = new TimerUtils(true);

private KeybindManager() {
EventManager.register(this);
}


@SubscribeEvent(priority = SubscribeEvent.Priority.HIGHEST)
public void keyPressedEvent(KeyPressedEvent event) {
int key = event.getKey();
Expand Down Expand Up @@ -149,15 +149,8 @@ public void onTick(TickEvent.WORLD event) {
// So that only clicks and key presses within the game screen is recorded to prevent any problems.
if (HeliosClient.MC.currentScreen != null) return;

long currentTime = System.currentTimeMillis();
if (currentTime - lastLeftClick > 1000) {
CPS[0] = 0;
lastLeftClick = currentTime;
}
if (currentTime - lastRightClick > 1000) {
CPS[1] = 0;
lastRightClick = currentTime;
}
leftClickTimer.every(1000,()-> CPS[0] = 0);
rightClickTimer.every(1000,()-> CPS[1] = 0);
}

public boolean shouldOpen() {
Expand Down
Loading

0 comments on commit 61d920b

Please sign in to comment.