mixins: simplify dynamic object and sequence definition mixins

This commit is contained in:
ThatGamerBlue
2020-11-08 13:27:40 +00:00
parent aab9df61ca
commit 38a37abd69
5 changed files with 13 additions and 15 deletions

View File

@@ -30,7 +30,7 @@ import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
@Mixin(RSClient.class)
public abstract class KeyHandlerMixin implements RSClient
public abstract class KeyPressedMixin implements RSClient
{
@Shadow("client")
private static RSClient client;

View File

@@ -43,9 +43,6 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
@Shadow("client")
private static RSClient client;
@Inject
public int animationID;
@SuppressWarnings("InfiniteRecursion")
@Copy("getModel")
@Replace("getModel")
@@ -88,8 +85,6 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
@Inject
public void rl$init(int id, int type, int orientation, int plane, int x, int y, int animationID, boolean var8, RSEntity var9)
{
this.animationID = animationID;
if (animationID != -1)
{
DynamicObjectAnimationChanged dynamicObjectAnimationChanged = new DynamicObjectAnimationChanged();
@@ -103,6 +98,6 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
@Override
public int getAnimationID()
{
return animationID;
return (int) (getSequenceDefinition() == null ? -1 : getSequenceDefinition().getHash());
}
}

View File

@@ -76,7 +76,7 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing());
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
getFrameLenths()[frame]);
getFrameLengths()[frame]);
return animatedModel;
}
@@ -136,7 +136,7 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
animatedModel.rotateY90Ccw();
}
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
getFrameLenths()[frame]);
getFrameLengths()[frame]);
// reapply rotation after animating
if (rotation == 1)
{
@@ -194,7 +194,7 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
RSModel animatedModel = model.toSharedSpotAnimModel(!frames.getFrames()[frameIdx].isShowing());
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
getFrameLenths()[frame]);
getFrameLengths()[frame]);
return animatedModel;
}
@@ -264,15 +264,15 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing()
& !chatFrames.getFrames()[chatFrameIdx].isShowing());
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
getFrameLenths()[frame]);
getFrameLengths()[frame]);
animatedModel.interpolateFrames(chatFrames, chatFrameIdx, nextChatFrames, nextChatFrameIdx,
interval, getFrameLenths()[frame]);
interval, getFrameLengths()[frame]);
return animatedModel;
}
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing());
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
getFrameLenths()[frame]);
getFrameLengths()[frame]);
return animatedModel;
}
}

View File

@@ -17,4 +17,7 @@ public interface RSDynamicObject extends RSEntity, DynamicObject, Entity
@Import("cycleStart")
int getAnimCycleCount();
@Import("sequenceDefinition")
RSSequenceDefinition getSequenceDefinition();
}

View File

@@ -2,7 +2,7 @@ package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface RSSequenceDefinition
public interface RSSequenceDefinition extends RSNode
{
// @Import("stretches")
// boolean getStretches();
@@ -23,7 +23,7 @@ public interface RSSequenceDefinition
int[] getFrameIDs();
@Import("frameLengths")
int[] getFrameLenths();
int[] getFrameLengths();
@Import("chatFrameIds")
int[] getChatFrameIds();