project(internal): Move a couple methods to mixins

This commit is contained in:
Owain van Brakel
2022-06-12 05:30:09 +02:00
parent a6763bad2d
commit 3a9bec65f5
8 changed files with 55 additions and 71 deletions

View File

@@ -94,6 +94,7 @@ import net.runelite.api.clan.ClanRank;
import net.runelite.api.clan.ClanSettings;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.BeforeMenuRender;
import net.runelite.api.events.CanvasSizeChanged;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ClanChannelChanged;
@@ -3099,5 +3100,13 @@ public abstract class RSClientMixin implements RSClient
RSNPC[] var2 = this.getCachedNPCs();
return var1 >= 0 && var1 < var2.length ? var2[var1] : null;
}
@Inject
public static boolean drawMenu()
{
BeforeMenuRender event = new BeforeMenuRender();
client.getCallbacks().post(event);
return event.isConsumed();
}
}

View File

@@ -1,5 +1,6 @@
package net.runelite.mixins;
import net.runelite.api.BufferProvider;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
@@ -207,4 +208,24 @@ public abstract class RSRasterizer2DMixin implements RSClient
}
}
}
@Inject
public static void clearColorBuffer(int x, int y, int width, int height, int color)
{
BufferProvider bp = client.getBufferProvider();
int canvasWidth = bp.getWidth();
int[] pixels = bp.getPixels();
int pixelPos = y * canvasWidth + x;
int pixelJump = canvasWidth - width;
for (int cy = y; cy < y + height; cy++)
{
for (int cx = x; cx < x + width; cx++)
{
pixels[pixelPos++] = 0;
}
pixelPos += pixelJump;
}
}
}

View File

@@ -33,6 +33,7 @@ import static net.runelite.api.Constants.ROOF_FLAG_POSITION;
import net.runelite.api.DecorativeObject;
import net.runelite.api.GroundObject;
import net.runelite.api.Perspective;
import net.runelite.api.Renderable;
import net.runelite.api.SceneTileModel;
import net.runelite.api.SceneTilePaint;
import net.runelite.api.Tile;
@@ -1288,4 +1289,18 @@ public abstract class RSSceneMixin implements RSScene
}
}
}
@Inject
public static void renderDraw(Renderable renderable, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash)
{
DrawCallbacks drawCallbacks = client.getDrawCallbacks();
if (drawCallbacks != null)
{
drawCallbacks.draw(renderable, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash);
}
else
{
renderable.draw(orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash);
}
}
}