mixins: simplify dynamic object and sequence definition mixins
This commit is contained in:
@@ -30,7 +30,7 @@ import net.runelite.api.mixins.Shadow;
|
|||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
|
|
||||||
@Mixin(RSClient.class)
|
@Mixin(RSClient.class)
|
||||||
public abstract class KeyHandlerMixin implements RSClient
|
public abstract class KeyPressedMixin implements RSClient
|
||||||
{
|
{
|
||||||
@Shadow("client")
|
@Shadow("client")
|
||||||
private static RSClient client;
|
private static RSClient client;
|
||||||
@@ -43,9 +43,6 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
|
|||||||
@Shadow("client")
|
@Shadow("client")
|
||||||
private static RSClient client;
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
|
||||||
public int animationID;
|
|
||||||
|
|
||||||
@SuppressWarnings("InfiniteRecursion")
|
@SuppressWarnings("InfiniteRecursion")
|
||||||
@Copy("getModel")
|
@Copy("getModel")
|
||||||
@Replace("getModel")
|
@Replace("getModel")
|
||||||
@@ -88,8 +85,6 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
|
|||||||
@Inject
|
@Inject
|
||||||
public void rl$init(int id, int type, int orientation, int plane, int x, int y, int animationID, boolean var8, RSEntity var9)
|
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)
|
if (animationID != -1)
|
||||||
{
|
{
|
||||||
DynamicObjectAnimationChanged dynamicObjectAnimationChanged = new DynamicObjectAnimationChanged();
|
DynamicObjectAnimationChanged dynamicObjectAnimationChanged = new DynamicObjectAnimationChanged();
|
||||||
@@ -103,6 +98,6 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
|
|||||||
@Override
|
@Override
|
||||||
public int getAnimationID()
|
public int getAnimationID()
|
||||||
{
|
{
|
||||||
return animationID;
|
return (int) (getSequenceDefinition() == null ? -1 : getSequenceDefinition().getHash());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
|
|||||||
|
|
||||||
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing());
|
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing());
|
||||||
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
||||||
getFrameLenths()[frame]);
|
getFrameLengths()[frame]);
|
||||||
return animatedModel;
|
return animatedModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
|
|||||||
animatedModel.rotateY90Ccw();
|
animatedModel.rotateY90Ccw();
|
||||||
}
|
}
|
||||||
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
||||||
getFrameLenths()[frame]);
|
getFrameLengths()[frame]);
|
||||||
// reapply rotation after animating
|
// reapply rotation after animating
|
||||||
if (rotation == 1)
|
if (rotation == 1)
|
||||||
{
|
{
|
||||||
@@ -194,7 +194,7 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
|
|||||||
|
|
||||||
RSModel animatedModel = model.toSharedSpotAnimModel(!frames.getFrames()[frameIdx].isShowing());
|
RSModel animatedModel = model.toSharedSpotAnimModel(!frames.getFrames()[frameIdx].isShowing());
|
||||||
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
||||||
getFrameLenths()[frame]);
|
getFrameLengths()[frame]);
|
||||||
return animatedModel;
|
return animatedModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,15 +264,15 @@ public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
|
|||||||
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing()
|
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing()
|
||||||
& !chatFrames.getFrames()[chatFrameIdx].isShowing());
|
& !chatFrames.getFrames()[chatFrameIdx].isShowing());
|
||||||
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
||||||
getFrameLenths()[frame]);
|
getFrameLengths()[frame]);
|
||||||
animatedModel.interpolateFrames(chatFrames, chatFrameIdx, nextChatFrames, nextChatFrameIdx,
|
animatedModel.interpolateFrames(chatFrames, chatFrameIdx, nextChatFrames, nextChatFrameIdx,
|
||||||
interval, getFrameLenths()[frame]);
|
interval, getFrameLengths()[frame]);
|
||||||
return animatedModel;
|
return animatedModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing());
|
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing());
|
||||||
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
|
||||||
getFrameLenths()[frame]);
|
getFrameLengths()[frame]);
|
||||||
return animatedModel;
|
return animatedModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,7 @@ public interface RSDynamicObject extends RSEntity, DynamicObject, Entity
|
|||||||
|
|
||||||
@Import("cycleStart")
|
@Import("cycleStart")
|
||||||
int getAnimCycleCount();
|
int getAnimCycleCount();
|
||||||
|
|
||||||
|
@Import("sequenceDefinition")
|
||||||
|
RSSequenceDefinition getSequenceDefinition();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package net.runelite.rs.api;
|
|||||||
|
|
||||||
import net.runelite.mapping.Import;
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
public interface RSSequenceDefinition
|
public interface RSSequenceDefinition extends RSNode
|
||||||
{
|
{
|
||||||
// @Import("stretches")
|
// @Import("stretches")
|
||||||
// boolean getStretches();
|
// boolean getStretches();
|
||||||
@@ -23,7 +23,7 @@ public interface RSSequenceDefinition
|
|||||||
int[] getFrameIDs();
|
int[] getFrameIDs();
|
||||||
|
|
||||||
@Import("frameLengths")
|
@Import("frameLengths")
|
||||||
int[] getFrameLenths();
|
int[] getFrameLengths();
|
||||||
|
|
||||||
@Import("chatFrameIds")
|
@Import("chatFrameIds")
|
||||||
int[] getChatFrameIds();
|
int[] getChatFrameIds();
|
||||||
|
|||||||
Reference in New Issue
Block a user