Skip to content

Commit

Permalink
v1.2.1 for mc1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
breelock committed Aug 29, 2024
1 parent 9a56359 commit 00c59d7
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 20 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# AutoClicky (Fabric)
Best in-game minecraft autoclicker
Best in-game minecraft autoclicker (click on this preview photo to see video demonstration)

![AutoClickyPreview](https://i.ibb.co/vcS14hP/eng-preview.png)
[![Click to see preview video](https://i.ibb.co/WfBpgJ9/2024-08-20-19-21-50.png)](https://www.youtube.com/watch?v=C8sh3hMvoHk)

## Features
- In `new combat system` mode, Autoclicky will click exactly on the timing when the weapon's cooldown is over to do a lot of damage
- In new combat system mode, Autoclicky will click exactly on the timing when the weapon's cooldown is over to do a lot of damage
- To switch between 1.8 and 1.9+ PvP systems, simply click the `New combat (1.9+)` or `Old combat (1.8)` button at the top
- Left and right mouse button autoclicker
- A clever auto jump that jumps before hitting and always deals critical damage
Expand All @@ -20,12 +20,14 @@ Best in-game minecraft autoclicker
- Use `H` to switch between the new or old combat system
- You can change all of these keys in the minecraft control settings

## Disclaimer
I (mod author) do not take any responsibility for your banned accounts on public servers. If you want to use AutoClicky on public servers, you take all responsibility on yourself. The mod is recommended to use in single player game

## Download
- [GitHub Releases](https://github.com/breelock/autoclicky/releases) (New versions appear here before anyone else)
- [GitHub Releases](https://github.com/breelock/autoclicky/releases)
- [CurseForge](https://www.curseforge.com/minecraft/mc-mods/autoclicky)
- [Modrinth](https://modrinth.com/mod/autoclicky)
- [Minecraft Inside](https://minecraft-inside.ru/mods/178960-autoclicky.html)

## Dependencies
- [Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api)

##
- [Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.19.2+build.28
loader_version=0.16.2

# Mod Properties
mod_version=1.2.0
mod_version=1.2.1
maven_group=com.breelock.autoclicky
archives_base_name=autoclicky

Expand Down
63 changes: 51 additions & 12 deletions src/main/java/com/breelock/autoclicky/PlayerMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,60 @@
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.AxeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tag.FluidTags;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;

public class PlayerMethods {
public static void attack(MinecraftClient client, boolean isNewPvP) {
if (client.player != null && client.crosshairTarget != null && !client.player.isSpectator() && client.interactionManager != null && client.world != null) {
boolean isInLava = client.world.getBlockState(new BlockPos(client.player.getX(), client.player.getY(), client.player.getZ())).getBlock() == Blocks.LAVA || client.player.isSubmergedIn(FluidTags.LAVA);
boolean isOnGround = client.player.isOnGround() && !client.player.isTouchingWater() && !isInLava;

float jumpCooldown = 400f;
float cooldownTime = getAttackSpeedInTicks(client.player) * 50;
float attackCooldown = getAttackCooldownInTicks(client.player) * 50;

if (isNewPvP) {
if (ModConfig.NewPvP.onlyEntity) {
if (client.crosshairTarget.getType() == HitResult.Type.ENTITY) {
if (client.player.getAttackCooldownProgress(0.0F) >= 0.7F && ModConfig.NewPvP.autoJump && client.player.isOnGround() && !client.player.isTouchingWater() && !isInLava)
client.player.jump();

if (client.player.getAttackCooldownProgress(0.0F) >= 1.0F) {
if (!isOnGround && client.player.getVelocity().y < -0.1 || client.player.isOnGround() || client.player.getAbilities().flying || client.player.isTouchingWater() || isInLava) {
if (interrupt(client, true)) return;
PlayerMethods.attackEntity(client);
if (!targetIsProtectedByShield(client, ((EntityHitResult) client.crosshairTarget).getEntity())) {
if (attackCooldown >= cooldownTime - jumpCooldown && ModConfig.NewPvP.autoJump && client.player.isOnGround() && !client.player.isTouchingWater() && !isInLava)
client.player.jump();

if (attackCooldown >= cooldownTime) {
if (!isOnGround && client.player.getVelocity().y < -0.1 || client.player.isOnGround() || client.player.getAbilities().flying || client.player.isTouchingWater() || isInLava) {
if (interrupt(client, true)) return;
PlayerMethods.attackEntity(client);
}
}
}
}
}
else {
if (client.crosshairTarget.getType() == HitResult.Type.ENTITY && client.player.getAttackCooldownProgress(0.0F) >= 0.7F && ModConfig.NewPvP.autoJump && client.player.isOnGround() && !client.player.isTouchingWater() && !isInLava)
client.player.jump();
if (client.crosshairTarget.getType() == HitResult.Type.ENTITY && attackCooldown >= cooldownTime - jumpCooldown && ModConfig.NewPvP.autoJump && client.player.isOnGround() && !client.player.isTouchingWater() && !isInLava) {
if (!targetIsProtectedByShield(client, ((EntityHitResult) client.crosshairTarget).getEntity()))
client.player.jump();
}

if (client.player.getAttackCooldownProgress(0.0F) >= 1.0F) {
if (attackCooldown >= cooldownTime) {
if (interrupt(client, true)) return;

if (client.crosshairTarget.getType() == HitResult.Type.ENTITY) {
if (!isOnGround && client.player.getVelocity().y < -0.1 || client.player.isOnGround() || client.player.getAbilities().flying || client.player.isTouchingWater() || isInLava)
PlayerMethods.attackEntity(client);
if (!targetIsProtectedByShield(client, ((EntityHitResult) client.crosshairTarget).getEntity())) {
if (!isOnGround && client.player.getVelocity().y < -0.1 || client.player.isOnGround() || client.player.getAbilities().flying || client.player.isTouchingWater() || isInLava)
PlayerMethods.attackEntity(client);
}
}
else if (client.crosshairTarget.getType() == HitResult.Type.BLOCK)
PlayerMethods.breakBlock(client);
Expand Down Expand Up @@ -122,6 +137,30 @@ private static void attackEntity(MinecraftClient client) {
}
}

private static boolean targetIsProtectedByShield(MinecraftClient client, Entity targetEntity) {
if (client.player != null) {
if (targetEntity instanceof PlayerEntity) {
PlayerEntity targetPlayer = (PlayerEntity) targetEntity;
ItemStack heldItem = client.player.getMainHandStack();
if (heldItem.getItem() instanceof AxeItem)
return false;

return targetPlayer.isUsingItem() && targetPlayer.getActiveItem().getItem() == Items.SHIELD;
}
}
return false;
}

private static int getAttackCooldownInTicks(PlayerEntity player) {
float cooldown = player.getAttackCooldownProgress(0.0f);
return MathHelper.ceil(cooldown * getAttackSpeedInTicks(player));
}

private static float getAttackSpeedInTicks(PlayerEntity player) {
float attackSpeed = (float) player.getAttributeValue(EntityAttributes.GENERIC_ATTACK_SPEED);
return (1.0f / attackSpeed) * 20.0f;
}

private static void breakBlock(MinecraftClient client) {
if (client != null && client.interactionManager != null && client.player != null && client.world != null) {
BlockHitResult blockHitResult = (BlockHitResult) client.crosshairTarget;
Expand Down

0 comments on commit 00c59d7

Please sign in to comment.