project: Mixing stuff and what not

This commit is contained in:
Owain van Brakel
2021-10-27 02:23:44 +02:00
parent c7ae30f788
commit 24d7c9c351
23 changed files with 545 additions and 181 deletions

View File

@@ -137,6 +137,7 @@ import net.runelite.api.widgets.WidgetType;
import net.runelite.rs.api.RSAbstractArchive;
import net.runelite.rs.api.RSArchive;
import net.runelite.rs.api.RSChatChannel;
import net.runelite.rs.api.RSClanChannel;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSEnumComposition;
import net.runelite.rs.api.RSFriendSystem;
@@ -2319,20 +2320,20 @@ public abstract class RSClientMixin implements RSClient
@FieldHook("guestClanChannel")
public static void onGuestClanChannelChanged(int idx)
{
client.getCallbacks().post(new ClanChannelChanged(client.getGuestClanChannel(), true));
client.getCallbacks().post(new ClanChannelChanged(client.getGuestClanChannel(), -1, true));
}
@Inject
@FieldHook("currentClanChannels")
public static void onCurrentClanChannelsChanged(int idx)
{
if (idx == -1)
{
// don't fire on array field itself being set
return;
}
RSClanChannel[] clanChannels = client.getCurrentClanChannels();
client.getCallbacks().post(new ClanChannelChanged(client.getClanChannel(), false));
if (idx >= 0 && idx < clanChannels.length)
{
RSClanChannel clanChannel = clanChannels[idx];
client.getCallbacks().post(new ClanChannelChanged(clanChannel, idx, false));
}
}

View File

@@ -1,38 +1,8 @@
package net.runelite.mixins;
import net.runelite.api.Node;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSNodeHashTable;
@Mixin(RSNodeHashTable.class)
public abstract class RSNodeHashTableMixin implements RSNodeHashTable
{
@Inject
@Override
public Collection<Node> getNodes()
{
// Copied in RSWidgetMixin.getParentId to reduce allocations
List<Node> nodes = new ArrayList<Node>();
Node[] buckets = getBuckets();
for (int i = 0; i < buckets.length; ++i)
{
Node node = buckets[i];
// It looks like the first node in the bucket is always
// a sentinel
Node cur = node.getNext();
while (cur != node)
{
nodes.add(cur);
cur = cur.getNext();
}
}
return nodes;
}
}
{}

View File

@@ -42,24 +42,9 @@ public abstract class RuneLiteObjectMixin implements RSRuneLiteObject
@Shadow("client")
private static RSClient client;
@Inject
private static boolean loop;
@Inject
private static RSModel model;
@Inject
RuneLiteObjectMixin()
{
setFinished(true);
}
@Inject
public void setModel(Model var1)
{
model = (RSModel) var1;
}
@Inject
public void setLocation(LocalPoint localPoint, int plane)
{
@@ -69,6 +54,14 @@ public abstract class RuneLiteObjectMixin implements RSRuneLiteObject
setHeight(Perspective.getTileHeight(client, localPoint, plane));
}
@Inject
public void setAnimation(Sequence var1)
{
setFrame(0);
setFrameCycle(0);
setSequenceDefinition((RSSequenceDefinition) var1);
}
@Inject
public void advanceRL(int var1)
{
@@ -90,7 +83,7 @@ public abstract class RuneLiteObjectMixin implements RSRuneLiteObject
}
}
if (loop && finished())
if (isLooping() && finished())
{
setFinished(false);
setFrame(0);
@@ -100,44 +93,9 @@ public abstract class RuneLiteObjectMixin implements RSRuneLiteObject
}
@Inject
public boolean isActive()
public void setModel(Model var1)
{
return !finished();
}
@Inject
public void setActive(boolean active)
{
if (finished() == active)
{
setFinished(!active);
if (active)
{
setFrame(0);
setFrameCycle(0);
client.getGraphicsObjectDeque().addFirst(this);
}
else
{
unlink();
}
}
}
@Inject
public void setShouldLoop(boolean var1)
{
loop = var1;
}
@Inject
public void setAnimation(Sequence var1)
{
setFrame(0);
setFrameCycle(0);
setSequenceDefinition((RSSequenceDefinition) var1);
model = (RSModel) var1;
}
@Inject