Cleanup in transforms and add projectile.getInteracting() transform (#165)
* Cleanup in transforms and add projectile.getInteracting transform Move whitespace out of string blocks Remove unused method from transform.java Use throws for transform methods, and catch the exceptions in modify() More whitespace between instructions to improve readability * Api changes for projectile.getInteracting, mixin for ref
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.events.ProjectileMoved;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
@@ -31,6 +32,8 @@ import net.runelite.api.mixins.MethodHook;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSNPC;
|
||||
import net.runelite.rs.api.RSPlayer;
|
||||
import net.runelite.rs.api.RSProjectile;
|
||||
|
||||
@Mixin(RSProjectile.class)
|
||||
@@ -48,6 +51,36 @@ public abstract class RSProjectileMixin implements RSProjectile
|
||||
return getEndCycle() - currentGameCycle;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Actor getInteracting()
|
||||
{
|
||||
int interactingIndex = getRsInteracting();
|
||||
if (interactingIndex == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (interactingIndex > 0)
|
||||
{
|
||||
int idx = interactingIndex - 1;
|
||||
RSNPC[] npcs = client.getCachedNPCs();
|
||||
return npcs[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = -interactingIndex - 1;
|
||||
|
||||
if (idx == client.getLocalInteractingIndex())
|
||||
{
|
||||
return client.getLocalPlayer();
|
||||
}
|
||||
|
||||
RSPlayer[] players = client.getCachedPlayers();
|
||||
return players[idx];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a projectile is set to move towards a point. For
|
||||
* projectiles that target the ground, like AoE projectiles from
|
||||
|
||||
Reference in New Issue
Block a user