Skip to content

Commit

Permalink
release 2.38 github
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvrwed committed May 2, 2024
1 parent e77ec8a commit 68d4feb
Show file tree
Hide file tree
Showing 17 changed files with 348 additions and 254 deletions.
31 changes: 17 additions & 14 deletions src/main/java/cc/unknown/command/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ public class CommandManager {

public CommandManager() {
Haru.instance.getEventBus().register(this);
add(new ConfigCommand());
add(new HelpCommand());
add(new BindCommand());
add(new CategoryCommand());
add(new ToggleCommand());
add(new FriendCommand());
add(new TransactionCommand());
add(new ClearCommand());
add(new GameCommand());
add(new PingCommand());
add(
new ConfigCommand(),
new HelpCommand(),
new BindCommand(),
new CategoryCommand(),
new ToggleCommand(),
new FriendCommand(),
new TransactionCommand(),
new ClearCommand(),
new GameCommand(),
new PingCommand(),
new SpyCommand()
);
}

@EventLink
Expand Down Expand Up @@ -91,10 +94,10 @@ public void onChatSend(ChatSendEvent e) {
public Command getCommand(Class<? extends Command> clazz) {
return commands.stream().filter(command -> command.getClass().equals(clazz)).findFirst().orElse(null);
}

private void add(Command cmd) {
commands.add(cmd);
}
private void add(Command... c) {
commands.addAll(Arrays.asList(c));
}

public List<Command> getCommand() {
return commands;
Expand Down
50 changes: 50 additions & 0 deletions src/main/java/cc/unknown/command/commands/SpyCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package cc.unknown.command.commands;

import cc.unknown.command.Command;
import net.minecraft.entity.player.EntityPlayer;

public class SpyCommand extends Command {

@Override // remote view cmd of lb
public void onExecute(String[] args) {
if (args.length < 2) {
if (mc.getRenderViewEntity() != mc.thePlayer) {
mc.setRenderViewEntity(mc.thePlayer);
return;
}
sendChat(getColor("Red") + " Syntax Error. Use: " + getSyntax());
return;
}

String target = args[1];

for (EntityPlayer entity : mc.theWorld.playerEntities) {
if (target.equals(entity.getName())) {
mc.setRenderViewEntity(entity);
sendChat("Spying to §8${entity.name}§3.");
sendChat("Execute §8.spy §3again to go back to yours.");
break;
}
}
}

@Override
public String getSyntax() {
return ".spy <user>";
}

@Override
public String getDesc() {
return "Spying...";
}

@Override
public String getName() {
return "spy";
}

@Override
public String getAlias() {
return "spy";
}
}
3 changes: 1 addition & 2 deletions src/main/java/cc/unknown/module/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ModuleManager() {
new JumpReset(),
new KeepSprint(),
new Criticals(),
new BlockHit(),
//new BlockHit(),
new Reach(),
new WTap(),
new Velocity(),
Expand Down Expand Up @@ -85,7 +85,6 @@ public ModuleManager() {
new Nametags(),
new ESP()


);
initialized = true;
}
Expand Down
131 changes: 42 additions & 89 deletions src/main/java/cc/unknown/module/impl/combat/AimAssist.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
import cc.unknown.Haru;
import cc.unknown.event.impl.EventLink;
import cc.unknown.event.impl.move.LivingEvent;
import cc.unknown.event.impl.other.ClickGuiEvent;
import cc.unknown.module.impl.Module;
import cc.unknown.module.impl.api.Category;
import cc.unknown.module.impl.api.Register;
import cc.unknown.module.setting.impl.BooleanValue;
import cc.unknown.module.setting.impl.ModeValue;
import cc.unknown.module.setting.impl.SliderValue;
import cc.unknown.utils.misc.ClickUtil;
import cc.unknown.utils.player.CombatUtil;
Expand All @@ -33,7 +31,6 @@
@Register(name = "AimAssist", category = Category.Combat)
public class AimAssist extends Module {

private final ModeValue mode = new ModeValue("Mode", "Single", "Single", "Switch");
private SliderValue horizontalAimSpeed = new SliderValue("Horizontal Aim Speed", 45, 5, 100, 1);
private SliderValue horizontalAimFineTuning = new SliderValue("Horizontal Aim Fine-tuning", 15, 2, 97, 1);
private BooleanValue horizontalRandomization = new BooleanValue("Horizontal Randomization", false);
Expand All @@ -56,17 +53,12 @@ public class AimAssist extends Module {
private Random random = new Random();

public AimAssist() {
this.registerSetting(mode, horizontalAimSpeed, horizontalAimFineTuning, horizontalRandomization,
this.registerSetting(horizontalAimSpeed, horizontalAimFineTuning, horizontalRandomization,
horizontalRandomizationAmount, fieldOfView, enemyDetectionRange, verticalAlignmentCheck,
verticalRandomization, verticalRandomizationAmount, verticalAimSpeed, verticalAimFineTuning, clickAim,
centerAim, ignoreFriendlyEntities, ignoreTeammates, aimAtInvisibleEnemies, lineOfSightCheck,
disableAimWhileBreakingBlock, weaponOnly);
}

@EventLink
public void onGui(ClickGuiEvent e) {
this.setSuffix("- [" + mode.getMode() + "]");
}

@EventLink
public void onLiving(LivingEvent e) {
Expand Down Expand Up @@ -138,106 +130,67 @@ public void onLiving(LivingEvent e) {
}

public Entity getEnemy() {
int fov = (int) fieldOfView.getInput();
List<EntityPlayer> playerList = new ArrayList<>(mc.theWorld.playerEntities);
int fov = (int) fieldOfView.getInput();
List<EntityPlayer> playerList = new ArrayList<>(mc.theWorld.playerEntities);

playerList.sort(new Comparator<EntityPlayer>() {
@Override
public int compare(EntityPlayer player1, EntityPlayer player2) {
boolean canSeePlayer1 = mc.thePlayer.canEntityBeSeen(player1);
boolean canSeePlayer2 = mc.thePlayer.canEntityBeSeen(player2);

if (mode.is("Single")) {
boolean isHittingPlayer1 = isHit(player1);
boolean isHittingPlayer2 = isHit(player2);

// Prioritize players who are being hit
if (isHittingPlayer1 && !isHittingPlayer2) {
return -1;
} else if (!isHittingPlayer1 && isHittingPlayer2) {
return 1;
} else {
// Compare by visibility
if (canSeePlayer1 && !canSeePlayer2) {
return -1;
} else if (!canSeePlayer1 && canSeePlayer2) {
return 1;
} else {
// Compare by distance
double distance1 = mc.thePlayer.getDistanceToEntity(player1);
double distance2 = mc.thePlayer.getDistanceToEntity(player2);

int distanceComparison = Double.compare(distance1, distance2);
if (distanceComparison != 0) {
return distanceComparison;
} else {
// Compare by health (prioritize lower health)
int health1 = (int) player1.getHealth();
int health2 = (int) player2.getHealth();

if (health1 != health2) {
return Integer.compare(health1, health2);
} else {
// If all criteria are equal, prioritize the player being hit
if (isHittingPlayer1 && !isHittingPlayer2) {
return -1;
} else if (!isHittingPlayer1 && isHittingPlayer2) {
return 1;
}
}
}
}
}
if (mc.thePlayer.canEntityBeSeen(player1) && !mc.thePlayer.canEntityBeSeen(player2)) {
return -1;
} else if (!mc.thePlayer.canEntityBeSeen(player1) && mc.thePlayer.canEntityBeSeen(player2)) {
return 1;
} else {
double distance1 = mc.thePlayer.getDistanceToEntity(player1);
double distance2 = mc.thePlayer.getDistanceToEntity(player2);
return Double.compare(distance1, distance2);
}
int distanceComparison = Double.compare(distance1, distance2);

return 0;
}

private boolean isHit(EntityPlayer player) {
return mc.objectMouseOver != null && mc.objectMouseOver.entityHit == player;
if (distanceComparison == 0) {
int health1 = (int) player1.getHealth();
int health2 = (int) player2.getHealth();
return Integer.compare(health1, health2);
}
return distanceComparison;
}
}
});

for (final EntityPlayer entityPlayer : mc.theWorld.playerEntities) {
if (entityPlayer != mc.thePlayer && entityPlayer.deathTime == 0) {
for (final EntityPlayer entityPlayer : mc.theWorld.playerEntities) {
if (entityPlayer != mc.thePlayer && entityPlayer.deathTime == 0) {

if (isFriend(entityPlayer) && ignoreFriendlyEntities.isToggled()) {
continue;
}
if (isFriend(entityPlayer) && ignoreFriendlyEntities.isToggled()) {
continue;
}

if (!mc.thePlayer.canEntityBeSeen(entityPlayer) && lineOfSightCheck.isToggled()) {
continue;
}
if (!mc.thePlayer.canEntityBeSeen(entityPlayer) && lineOfSightCheck.isToggled()) {
continue;
}

if (isTeamMate(entityPlayer) && ignoreTeammates.isToggled()) {
continue;
}
if (isTeamMate(entityPlayer) && ignoreTeammates.isToggled()) {
continue;
}

if (entityPlayer == mc.thePlayer || entityPlayer.isDead || isNPCShop(entityPlayer)) {
continue;
}
if (entityPlayer == mc.thePlayer || entityPlayer.isDead || isNPCShop(entityPlayer)) {
continue;
}

if (!aimAtInvisibleEnemies.isToggled() && entityPlayer.isInvisible()) {
continue;
}
if (!aimAtInvisibleEnemies.isToggled() && entityPlayer.isInvisible()) {
continue;
}

if (mc.thePlayer.getDistanceToEntity(entityPlayer) > enemyDetectionRange.getInput()) {
continue;
}
if (mc.thePlayer.getDistanceToEntity(entityPlayer) > enemyDetectionRange.getInput()) {
continue;
}

if (!centerAim.isToggled() && fov != 360 && !isWithinFOV(entityPlayer, fov)) {
continue;
}
if (!centerAim.isToggled() && fov != 360 && !isWithinFOV(entityPlayer, fov)) {
continue;
}

return entityPlayer;
}
}
return entityPlayer;
}
}

return null;
return null;
}

private boolean isFriend(EntityPlayer player) {
Expand Down
Loading

0 comments on commit 68d4feb

Please sign in to comment.