-
-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Auto Rod #5419
base: nextgen
Are you sure you want to change the base?
feat: Auto Rod #5419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this. Use Chronometer.
return -1 | ||
} | ||
|
||
private fun getAllNearbyEnemies(): List<Entity?>? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TargetTracker
/** | ||
* Find rod in inventory | ||
*/ | ||
private fun findRod(startSlot: Int, endSlot: Int): Int { | ||
for (i in startSlot until endSlot) { | ||
val stack = mc.player?.inventory?.getStack(i) | ||
if (stack != null && stack.item == Items.FISHING_ROD) { | ||
return i | ||
} | ||
} | ||
return -1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slots.Hotbar.findSlotIndex(Items.FISHING_ROD)
|
||
init { | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is clearly a lot that has to be changed on this code, as it does not pass our code standards. However, I will take it in my own hand and look if I can work with your code instead of writing it from scratch.
|
||
object ModuleAutoRod : ClientModule("AutoRod", Category.COMBAT) { | ||
|
||
object facingEnemy : ToggleableConfigurable(this, "FacingEnemy", true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"FacingEnemy" - Follow Kotlin Naming Convention
|
||
object facingEnemy : ToggleableConfigurable(this, "FacingEnemy", true) { | ||
|
||
object ignoreOnEnemyLowHealth : ToggleableConfigurable(this, "IgnoreOnEnemyLowHealth", true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IgnoreOnEnemyLowHealth
same here with Naming Convention.
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Fixed
Show fixed
Hide fixed
private val pushTimer = Chronometer() | ||
private val rodPullTimer = Chronometer() | ||
private var rodInUse = false | ||
private var switchBack: Int? = -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type of Int? is not required to be defined in this case.
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
val tickHandler = tickHandler { | ||
// Check if player is using rod | ||
val usingRod = | ||
(mc.player?.isUsingItem == true && mc.player?.mainHandStack?.item == Items.FISHING_ROD) || rodInUse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mc.player.isUsingItem
can be replaced with player.isUsingItem
(mc.player?.isUsingItem == true && mc.player?.mainHandStack?.item == Items.FISHING_ROD) || rodInUse | |
(player.isUsingItem && player.mainHandStack.item == Items.FISHING_ROD) || rodInUse |
|
||
} else { | ||
// Stop using rod | ||
mc.player?.stopUsingItem() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mc.player?.stopUsingItem() | |
player.stopUsingItem() |
var facingEntity = mc.targetedEntity | ||
if (facingEntity == null) { | ||
|
||
var finaltarget: Entity? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finaltarget
does not follow Kotlin Naming Convention as well - should be finalTarget
instead.
if(finaltarget == null){ | ||
return@tickHandler | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(finaltarget == null){ | |
return@tickHandler | |
} | |
if(finaltarget == null) { | |
return@tickHandler | |
} |
|
||
if (rod && pushTimer.hasElapsed(pushDelay.toLong())) { | ||
// Check if player has rod in hand | ||
if (mc.player?.mainHandStack != Items.FISHING_ROD) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (mc.player?.mainHandStack != Items.FISHING_ROD) { | |
if (player.mainHandStack != Items.FISHING_ROD) { |
return@tickHandler | ||
} | ||
// Switch to rod | ||
switchBack = mc.player?.inventory?.getSlotWithStack(mc.player?.inventory?.mainHandStack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switchBack = mc.player?.inventory?.getSlotWithStack(mc.player?.inventory?.mainHandStack) | |
switchBack = player.inventory.getSlotWithStack(player.inventory.mainHandStack) |
if (rod == null) { | ||
return | ||
} | ||
mc.player?.inventory?.selectedSlot = rod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not change the selected slot like that in LiquidBounce Nextgen. LiquidBounce Nextgen offers a much util for that instead called SilentHotbar
.
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
@1zun4 modified,but I have no idea about using KeybindIsPressedEvent and make it work.So I keep it as it. |
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
val rod = Slots.Hotbar.findSlot(Items.FISHING_ROD)?.hotbarSlot | ||
if (rod == null) { | ||
// There is no rod in hotbar | ||
return@tickHandler | ||
} | ||
// Switch to rod | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val rod = Slots.Hotbar.findSlot(Items.FISHING_ROD)?.hotbarSlot | |
if (rod == null) { | |
// There is no rod in hotbar | |
return@tickHandler | |
} | |
// Switch to rod | |
val rod = Slots.Hotbar.findSlot(Items.FISHING_ROD)?.hotbarSlot ?: return@tickHandler | |
// Switch to rod |
val usingRod = | ||
(player.isUsingItem == true && player.mainHandStack?.item == Items.FISHING_ROD) || rodInUse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val usingRod = | |
(player.isUsingItem == true && player.mainHandStack?.item == Items.FISHING_ROD) || rodInUse | |
val usingRod = player.isUsingItem && player.mainHandStack?.item == Items.FISHING_ROD || rodInUse |
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
} else { | ||
var rod = false | ||
|
||
if (FacingEnemy.enabled && player.getActualHealth()!! >= IgnoreOnEnemyLowHealth.playerHealthThreshold) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (FacingEnemy.enabled && player.getActualHealth()!! >= IgnoreOnEnemyLowHealth.playerHealthThreshold) { | |
if (FacingEnemy.enabled && player.getActualHealth() >= IgnoreOnEnemyLowHealth.playerHealthThreshold) { |
any reason you're using getActualHealth here?
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
(player.isUsingItem) || | ||
KillAuraAutoBlock.blockVisual |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(player.isUsingItem) || | |
KillAuraAutoBlock.blockVisual | |
player.isUsingItem || KillAuraAutoBlock.blockVisual |
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoRod.kt
Show resolved
Hide resolved
I am currently working on refactoring this. |
The branch carried AutoRod from legacy to nextgen.