use of net.runelite.api.mixins.Replace in project runelite by runelite.
the class RSClientMixin method rl$runWidgetOnLoadListener.
@Replace("runWidgetOnLoadListener")
public static void rl$runWidgetOnLoadListener(int groupId) {
rs$runWidgetOnLoadListener(groupId);
RSWidget[][] widgets = client.getWidgets();
boolean loaded = widgets != null && widgets[groupId] != null;
if (loaded) {
WidgetLoaded event = new WidgetLoaded();
event.setGroupId(groupId);
eventBus.post(event);
}
}
use of net.runelite.api.mixins.Replace in project runelite by runelite.
the class RSRegionMixin method rl$addItemPile.
@Replace("addItemPile")
public void rl$addItemPile(int plane, int x, int y, int hash, Renderable var5, int var6, Renderable var7, Renderable var8) {
rs$addItemPile(plane, x, y, hash, var5, var6, var7, var8);
Tile tile = getTiles()[plane][x][y];
if (tile != null) {
RSItemLayer itemLayer = (RSItemLayer) tile.getItemLayer();
if (itemLayer != null) {
itemLayer.setPlane(plane);
}
}
}
use of net.runelite.api.mixins.Replace in project runelite by runelite.
the class RSRegionMixin method rl$groundObjectSpawned.
@Replace("groundObjectSpawned")
public void rl$groundObjectSpawned(int plane, int x, int y, int hash, Renderable var5, int var6, int var7) {
rs$groundObjectSpawned(plane, x, y, hash, var5, var6, var7);
Tile tile = getTiles()[plane][x][y];
if (tile != null) {
RSGroundObject groundObject = (RSGroundObject) tile.getGroundObject();
if (groundObject != null) {
groundObject.setPlane(plane);
}
}
}
use of net.runelite.api.mixins.Replace in project runelite by runelite.
the class RSIndexDataBaseMixin method rl$getConfigData.
@Replace("getConfigData")
public byte[] rl$getConfigData(int archiveId, int fileId) {
byte[] rsData = rs$getConfigData(archiveId, fileId);
RSIndexData indexData = (RSIndexData) this;
if (!OverlayIndex.hasOverlay(indexData.getIndex(), archiveId)) {
return rsData;
}
InputStream in = getClass().getResourceAsStream("/runelite/" + indexData.getIndex() + "/" + archiveId);
if (in == null) {
log.warn("Missing overlay data for {}/{}", indexData.getIndex(), archiveId);
return rsData;
}
InputStream in2 = getClass().getResourceAsStream("/runelite/" + indexData.getIndex() + "/" + archiveId + ".hash");
if (rsData == null) {
if (in2 != null) {
log.warn("Hash file for non existing archive {}/{}", indexData.getIndex(), archiveId);
return null;
}
log.debug("Adding archive {}/{}", indexData.getIndex(), archiveId);
try {
return ByteStreams.toByteArray(in);
} catch (IOException ex) {
log.warn("error loading archive replacement", ex);
}
return null;
}
if (in2 == null) {
log.warn("Missing hash file for {}/{}", indexData.getIndex(), archiveId);
return rsData;
}
HashCode rsDataHash = Hashing.sha256().hashBytes(rsData);
String rsHash = BaseEncoding.base16().encode(rsDataHash.asBytes());
try {
String replaceHash = CharStreams.toString(new InputStreamReader(in2));
if (replaceHash.equals(rsHash)) {
log.debug("Replacing archive {}/{}", indexData.getIndex(), archiveId);
return ByteStreams.toByteArray(in);
}
log.warn("Mismatch in overlaid cache archive hash for {}/{}: {} != {}", indexData.getIndex(), archiveId, replaceHash, rsHash);
} catch (IOException ex) {
log.warn("error checking hash", ex);
}
return rsData;
}
use of net.runelite.api.mixins.Replace in project runelite by runelite.
the class RSRegionMixin method rl$addBoundaryDecoration.
@Replace("addBoundaryDecoration")
public void rl$addBoundaryDecoration(int plane, int x, int y, int hash, Renderable var5, Renderable var6, int var7, int var8, int var9, int var10, int var11, int var12) {
rs$addBoundaryDecoration(plane, x, y, hash, var5, var6, var7, var8, var9, var10, var11, var12);
Tile tile = getTiles()[plane][x][y];
if (tile != null) {
RSDecorativeObject object = (RSDecorativeObject) tile.getDecorativeObject();
if (object != null) {
object.setPlane(plane);
}
}
}
Aggregations