Skip to content

Commit

Permalink
Merge branch '1.20.4' into 1.21.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle.kts
  • Loading branch information
rfresh2 committed Sep 5, 2024
2 parents 3e025b9 + 2782718 commit 80d9340
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencies {
shade("com.github.rfresh2.discord4j:discord4j-core:3.4.3.8") {
exclude(group = "io.netty")
}
shade("com.github.rfresh2:MCProtocolLib:1.21.0.8") {
shade("com.github.rfresh2:MCProtocolLib:1.21.0.9") {
exclude(group = "io.netty.incubator")
exclude(group = "io.netty")
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/zenith/command/impl/KillAuraCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public CommandUsage commandUsage() {
"attackDelay <ticks>",
"targetPlayers on/off",
"targetHostileMobs on/off",
"targetHostileMobs onlyAggressive on/off",
"targetNeutralMobs on/off",
"targetNeutralMobs onlyAggressive on/off",
"targetArmorStands on/off",
Expand Down Expand Up @@ -71,6 +72,12 @@ public LiteralArgumentBuilder<CommandContext> register() {
return OK;
})))
.then(literal("targetHostileMobs")
.then(literal("onlyAggressive").then(argument("toggle", toggle()).executes(c -> {
CONFIG.client.extra.killAura.onlyHostileAggressive = getToggle(c, "toggle");
c.getSource().getEmbed()
.title("Target Hostile Mobs Only Aggressive " + toggleStrCaps(CONFIG.client.extra.killAura.onlyHostileAggressive));
return OK;
})))
.then(argument("toggle", toggle()).executes(c -> {
CONFIG.client.extra.killAura.targetHostileMobs = getToggle(c, "toggle");
c.getSource().getEmbed()
Expand Down Expand Up @@ -162,6 +169,7 @@ public void postPopulate(Embed builder) {
.addField("Target Neutral Mobs", toggleStr(CONFIG.client.extra.killAura.targetNeutralMobs), false)
.addField("Target Custom", toggleStr(CONFIG.client.extra.killAura.targetCustom), false)
.addField("Only Aggressive Neutral Mobs", toggleStr(CONFIG.client.extra.killAura.onlyNeutralAggressive), false)
.addField("Only Aggressive Hostile Mobs", toggleStr(CONFIG.client.extra.killAura.onlyHostileAggressive), false)
.addField("Target Armor Stands", toggleStr(CONFIG.client.extra.killAura.targetArmorStands), false)
.addField("Weapon Switching", toggleStr(CONFIG.client.extra.killAura.switchWeapon), false)
.addField("Attack Delay Ticks", CONFIG.client.extra.killAura.attackDelayTicks, false)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zenith/discord/DiscordEventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public void handleMsaDeviceCodeLoginEvent(final MsaDeviceCodeLoginEvent event) {
final var embed = Embed.builder()
.title("Microsoft Device Code Login")
.primaryColor()
.description("Login Here: " + event.deviceCode().getDirectVerificationUri());
.description("Login Here: " + event.deviceCode().getDirectVerificationUri() + " \nCode: " + event.deviceCode().getUserCode());
if (CONFIG.discord.mentionRoleOnDeviceCodeAuth)
sendEmbedMessage(mentionAccountOwner(), embed);
else
Expand Down
29 changes: 15 additions & 14 deletions src/main/java/com/zenith/module/impl/KillAura.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,15 @@ private boolean validTarget(Entity entity) {

} else if (entity instanceof EntityStandard e) {
if (CONFIG.client.extra.killAura.targetHostileMobs) {
if (hostileEntities.contains(e.getEntityType())) return true;
if (hostileEntities.contains(e.getEntityType()))
return !CONFIG.client.extra.killAura.onlyHostileAggressive || isAggressive(entity);
}
if (CONFIG.client.extra.killAura.targetArmorStands) {
if (e.getEntityType() == EntityType.ARMOR_STAND) return true;
}
if (CONFIG.client.extra.killAura.targetNeutralMobs) {
if (neutralEntities.contains(e.getEntityType())) {
if (CONFIG.client.extra.killAura.onlyNeutralAggressive) {
// https://wiki.vg/Entity_metadata#Mob
var byteMetadata = entity.getMetadata().get(15);
if (byteMetadata == null) return false;
if (byteMetadata instanceof ByteEntityMetadata byteData) {
var data = byteData.getPrimitiveValue() & 0x04;
return data != 0;
}
return false;
}
return true;
}
if (neutralEntities.contains(e.getEntityType()))
return !CONFIG.client.extra.killAura.onlyNeutralAggressive || isAggressive(entity);
}
if (CONFIG.client.extra.killAura.targetCustom) {
return CONFIG.client.extra.killAura.customTargets.contains(e.getEntityType());
Expand All @@ -163,6 +153,17 @@ private boolean validTarget(Entity entity) {
return false;
}

private static boolean isAggressive(final Entity entity) {
// https://wiki.vg/Entity_metadata#Mob
var byteMetadata = entity.getMetadata().get(15);
if (byteMetadata == null) return false;
if (byteMetadata instanceof ByteEntityMetadata byteData) {
var data = byteData.getPrimitiveValue() & 0x04;
return data != 0;
}
return false;
}

private void handleBotTickStopped(final ClientBotTick.Stopped event) {
delay = 0;
attackTarget = nullRef;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/zenith/network/client/Authenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private FullJavaSession fullLogin() {
}

private void onDeviceCode(final StepMsaDeviceCode.MsaDeviceCode code) {
AUTH_LOG.error("Login Here: {}", code.getDirectVerificationUri());
AUTH_LOG.error("Login Here: {} with code: {}", code.getDirectVerificationUri(), code.getUserCode());
EVENT_BUS.postAsync(new MsaDeviceCodeLoginEvent(code));
if (CONFIG.authentication.openBrowserOnLogin) tryOpenBrowser(code.getDirectVerificationUri());
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/zenith/util/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public static final class KillAura {
public boolean targetNeutralMobs = false;
public boolean targetCustom = false;
public boolean onlyNeutralAggressive = true;
public boolean onlyHostileAggressive = true;
public boolean switchWeapon = true;
public boolean targetArmorStands = false;
public int attackDelayTicks = 10;
Expand Down

0 comments on commit 80d9340

Please sign in to comment.