diff --git a/src/main/java/net/wurstclient/hacks/AutoSwordHack.java b/src/main/java/net/wurstclient/hacks/AutoSwordHack.java index 6e76c545..e75a3f4c 100644 --- a/src/main/java/net/wurstclient/hacks/AutoSwordHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoSwordHack.java @@ -13,6 +13,7 @@ import net.minecraft.item.Item; import net.minecraft.item.MiningToolItem; import net.minecraft.item.SwordItem; import net.minecraft.item.ToolItem; +import net.minecraft.item.TridentItem; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.wurstclient.Category; @@ -33,12 +34,13 @@ public final class AutoSwordHack extends Hack implements UpdateListener new EnumSetting<>("Priority", Priority.values(), Priority.SPEED); private final CheckboxSetting switchBack = new CheckboxSetting( - "Switch back", - "Switches back to the previously selected slot after \u00a7lRelease time\u00a7r has passed.", + "Switch back", "Switches back to the previously selected slot after" + + " \u00a7lRelease time\u00a7r has passed.", true); private final SliderSetting releaseTime = new SliderSetting("Release time", - "Time until AutoSword will switch back from the weapon to the previously selected slot.\n\n" + "Time until AutoSword will switch back from the weapon to the" + + " previously selected slot.\n\n" + "Only works when \u00a7lSwitch back\u00a7r is checked.", 10, 1, 200, 1, ValueDisplay.INTEGER.withSuffix(" ticks").withLabel(1, "1 tick")); @@ -114,7 +116,7 @@ public final class AutoSwordHack extends Hack implements UpdateListener Item item = MC.player.getInventory().getStack(i).getItem(); - // get damage + // get weapon value float value = getValue(item); // compare with previous best weapon @@ -145,15 +147,17 @@ public final class AutoSwordHack extends Hack implements UpdateListener switch(priority.getSelected()) { case SPEED: - if(item instanceof ToolItem tool) - return ItemUtils.getAttackSpeed(tool); + if(item instanceof ToolItem || item instanceof TridentItem) + return ItemUtils.getAttackSpeed(item); break; case DAMAGE: if(item instanceof SwordItem sword) return sword.getAttackDamage(); - if(item instanceof MiningToolItem miningTool) - return miningTool.getAttackDamage(); + if(item instanceof MiningToolItem tool) + return tool.getAttackDamage(); + if(item instanceof TridentItem) + return TridentItem.ATTACK_DAMAGE; break; } diff --git a/src/main/java/net/wurstclient/util/ItemUtils.java b/src/main/java/net/wurstclient/util/ItemUtils.java index 470b6847..4a036b2a 100644 --- a/src/main/java/net/wurstclient/util/ItemUtils.java +++ b/src/main/java/net/wurstclient/util/ItemUtils.java @@ -13,7 +13,6 @@ import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolItem; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; import net.minecraft.nbt.NbtList; @@ -56,7 +55,7 @@ public enum ItemUtils } } - public static float getAttackSpeed(ToolItem item) + public static float getAttackSpeed(Item item) { return (float)item.getAttributeModifiers(EquipmentSlot.MAINHAND) .get(EntityAttributes.GENERIC_ATTACK_SPEED).stream().findFirst()