Skip to content

Fix - KillAura cannot target projectiles and other non-LivingEntities.#266

Open
TwinkNet wants to merge 4 commits intolambda-client:1.21.11from
TwinkNet:TwinkNet/Fix-KillAura-Projectiles
Open

Fix - KillAura cannot target projectiles and other non-LivingEntities.#266
TwinkNet wants to merge 4 commits intolambda-client:1.21.11from
TwinkNet:TwinkNet/Fix-KillAura-Projectiles

Conversation

@TwinkNet
Copy link
Contributor

Previously lambda's killaura was unable to target and hit projectiles, like shulker bullets, despite having the ability to select them as a target. This is because Targeting.target() would only ever give you a LivingEntity, below is the original code for Targeting.target():

fun target(): LivingEntity? = runSafe {
    return@runSafe fastEntitySearch<LivingEntity>(targetingRange) {
    // 5 lines not shown...

This is changed in my pull to accept a T : Entity generic during the call, so that in KillAura.kt:

val target: LivingEntity?
    get() = targeting.target()

becomes

val target: Entity?
    get() = targeting.target<Entity>()

This allows more flexibility in the use of the targeting system, and allows CrystalAura.kt to remain unaffected by this change, it'll still only target for a LivingEntity:

private fun SafeContext.tick() {
    // Update the target
    currentTarget = targeting.target<LivingEntity>()

some minor modifications to Targeting.validate() and Targeting.Priority were made to accommodate a generic Entity object

@TwinkNet TwinkNet marked this pull request as ready for review March 12, 2026 07:38
@emyfops
Copy link
Collaborator

emyfops commented Mar 12, 2026

There is no need to pass a type to the entity to the target function. Just return Entity since it's not used anywhere else.

@emyfops
Copy link
Collaborator

emyfops commented Mar 12, 2026

There is no need to pass a type to the entity to the target function. Just return Entity since it's not used anywhere else.

I get the idea but I'm not a fan of it just to target non-living entities. Most, if not all modules will have to use the targetting class without the delegate and it'll make a mess.

@emyfops
Copy link
Collaborator

emyfops commented Mar 12, 2026

There is no need to pass a type to the entity to the target function. Just return Entity since it's not used anywhere else.

I get the idea but I'm not a fan of it just to target non-living entities. Most, if not all modules will have to use the targetting class without the delegate and it'll make a mess.

Ok maybe it is a good idea after all, I approve of this.

@beanbag44 beanbag44 self-requested a review March 12, 2026 12:16
@TwinkNet TwinkNet requested a review from beanbag44 March 12, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants