Move onActorHitsplat to mixins
Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -39,11 +39,9 @@ import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.VolatileImage;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GraphicsObject;
|
||||
import net.runelite.api.Hitsplat;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.KeyFocusListener;
|
||||
import net.runelite.api.MainBufferProvider;
|
||||
@@ -60,7 +58,6 @@ import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.GraphicsObjectCreated;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
import net.runelite.api.events.MenuOpened;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.events.PostItemComposition;
|
||||
@@ -467,31 +464,6 @@ public class Hooks
|
||||
eventBus.post(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after a hitsplat has been processed on an actor.
|
||||
* Note that this event runs even if the hitsplat didn't show up,
|
||||
* i.e. the actor already had 4 visible hitsplats.
|
||||
*
|
||||
* @param actor The actor the hitsplat was applied to
|
||||
* @param type The hitsplat type (i.e. color)
|
||||
* @param value The value of the hitsplat (i.e. how high the hit was)
|
||||
* @param var3
|
||||
* @param var4
|
||||
* @param gameCycle The gamecycle the hitsplat was applied on
|
||||
* @param duration The amount of gamecycles the hitsplat will last for
|
||||
*/
|
||||
public static void onActorHitsplat(Actor actor, int type, int value, int var3, int var4,
|
||||
int gameCycle, int duration)
|
||||
{
|
||||
Hitsplat hitsplat = new Hitsplat(Hitsplat.HitsplatType.fromInteger(type), value,
|
||||
gameCycle + duration);
|
||||
|
||||
HitsplatApplied event = new HitsplatApplied();
|
||||
event.setActor(actor);
|
||||
event.setHitsplat(hitsplat);
|
||||
eventBus.post(event);
|
||||
}
|
||||
|
||||
public static void onGraphicsObjectCreated(GraphicsObject go, int var1, int var2, int var3, int var4, int var5, int var6, int var7)
|
||||
{
|
||||
GraphicsObjectCreated event = new GraphicsObjectCreated(go);
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Hitsplat;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.Perspective;
|
||||
@@ -39,6 +40,7 @@ import net.runelite.api.coords.WorldArea;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.GraphicChanged;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
import net.runelite.api.events.LocalPlayerDeath;
|
||||
import net.runelite.api.mixins.FieldHook;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
@@ -251,4 +253,27 @@ public abstract class RSActorMixin implements RSActor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after a hitsplat has been processed on an actor.
|
||||
* Note that this event runs even if the hitsplat didn't show up,
|
||||
* i.e. the actor already had 4 visible hitsplats.
|
||||
*
|
||||
* @param type The hitsplat type (i.e. color)
|
||||
* @param value The value of the hitsplat (i.e. how high the hit was)
|
||||
* @param var3 unknown
|
||||
* @param var4 unknown
|
||||
* @param gameCycle The gamecycle the hitsplat was applied on
|
||||
* @param duration The amount of gamecycles the hitsplat will last for
|
||||
*/
|
||||
@Inject
|
||||
@MethodHook(value = "applyActorHitsplat", end = true)
|
||||
public void applyActorHitsplat(int type, int value, int var3, int var4, int gameCycle, int duration)
|
||||
{
|
||||
final Hitsplat hitsplat = new Hitsplat(Hitsplat.HitsplatType.fromInteger(type), value, gameCycle + duration);
|
||||
final HitsplatApplied event = new HitsplatApplied();
|
||||
event.setActor(this);
|
||||
event.setHitsplat(hitsplat);
|
||||
eventBus.post(event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user