api(mixins): More object methods exposed

This commit is contained in:
Owain van Brakel
2021-09-25 03:01:43 +02:00
parent 910ff6c082
commit d6579901c6
6 changed files with 145 additions and 6 deletions

View File

@@ -43,6 +43,11 @@ public interface Node
*/ */
Node getPrevious(); Node getPrevious();
/**
* Unlink.
*/
void unlink();
/** /**
* Gets the hash value of the node. * Gets the hash value of the node.
* *

View File

@@ -71,6 +71,56 @@ public interface Scene
*/ */
void removeGameObject(GameObject gameObject); void removeGameObject(GameObject gameObject);
/**
* Remove a game object from the scene
* @param plane
* @param x
* @param y
*/
void removeGameObject(int plane, int x, int y);
/**
* Remove a game object from the scene
* @param wallObject
*/
void removeWallObject(WallObject wallObject);
/**
* Remove a wall object from the scene
* @param plane
* @param x
* @param y
*/
void removeWallObject(int plane, int x, int y);
/**
* Remove a decorative object from the scene
* @param decorativeObject
*/
void removeDecorativeObject(DecorativeObject decorativeObject);
/**
* Remove a decorative object from the scene
* @param plane
* @param x
* @param y
*/
void removeDecorativeObject(int plane, int x, int y);
/**
* Remove a ground object from the scene
* @param groundObject
*/
void removeGroundObject(GroundObject groundObject);
/**
* Remove a ground object from the scene
* @param plane
* @param x
* @param y
*/
void removeGroundObject(int plane, int x, int y);
void generateHouses(); void generateHouses();
void setRoofRemovalMode(int flags); void setRoofRemovalMode(int flags);

View File

@@ -30,10 +30,13 @@ import static net.runelite.api.Constants.ROOF_FLAG_BETWEEN;
import static net.runelite.api.Constants.ROOF_FLAG_DESTINATION; import static net.runelite.api.Constants.ROOF_FLAG_DESTINATION;
import static net.runelite.api.Constants.ROOF_FLAG_HOVERED; import static net.runelite.api.Constants.ROOF_FLAG_HOVERED;
import static net.runelite.api.Constants.ROOF_FLAG_POSITION; 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.Perspective;
import net.runelite.api.SceneTileModel; import net.runelite.api.SceneTileModel;
import net.runelite.api.SceneTilePaint; import net.runelite.api.SceneTilePaint;
import net.runelite.api.Tile; import net.runelite.api.Tile;
import net.runelite.api.WallObject;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.hooks.DrawCallbacks; import net.runelite.api.hooks.DrawCallbacks;
@@ -1240,4 +1243,61 @@ public abstract class RSSceneMixin implements RSScene
{ {
rl$tileShapes = tileShapes; rl$tileShapes = tileShapes;
} }
@Inject
@Override
public void removeWallObject(WallObject wallObject)
{
final Tile[][][] tiles = getTiles();
for (int y = 0; y < 104; ++y)
{
for (int x = 0; x < 104; ++x)
{
Tile tile = tiles[client.getPlane()][x][y];
if (tile != null && tile.getWallObject() == wallObject)
{
tile.setWallObject(null);
}
}
}
}
@Inject
@Override
public void removeDecorativeObject(DecorativeObject decorativeObject)
{
final Tile[][][] tiles = getTiles();
for (int y = 0; y < 104; ++y)
{
for (int x = 0; x < 104; ++x)
{
Tile tile = tiles[client.getPlane()][x][y];
if (tile != null && tile.getDecorativeObject() == decorativeObject)
{
tile.setDecorativeObject(null);
}
}
}
}
@Inject
@Override
public void removeGroundObject(GroundObject groundObject)
{
final Tile[][][] tiles = getTiles();
for (int y = 0; y < 104; ++y)
{
for (int x = 0; x < 104; ++x)
{
Tile tile = tiles[client.getPlane()][x][y];
if (tile != null && tile.getGroundObject() == groundObject)
{
tile.setGroundObject(null);
}
}
}
}
} }

View File

@@ -1,8 +1,11 @@
package net.runelite.rs.api; package net.runelite.rs.api;
import net.runelite.api.DecorativeObject;
import net.runelite.api.GameObject; import net.runelite.api.GameObject;
import net.runelite.api.GroundObject;
import net.runelite.api.Scene; import net.runelite.api.Scene;
import net.runelite.api.Tile; import net.runelite.api.Tile;
import net.runelite.api.WallObject;
import net.runelite.mapping.Import; import net.runelite.mapping.Import;
public interface RSScene extends Scene public interface RSScene extends Scene
@@ -56,6 +59,24 @@ public interface RSScene extends Scene
@Import("removeGameObject") @Import("removeGameObject")
void removeGameObject(GameObject gameObject); void removeGameObject(GameObject gameObject);
@Import("removeGameObject")
void removeGameObject(int plane, int x, int y);
void removeWallObject(WallObject wallObject);
@Import("removeBoundaryObject")
void removeWallObject(int plane, int x, int y);
void removeDecorativeObject(DecorativeObject decorativeObject);
@Import("removeWallDecoration")
void removeDecorativeObject(int plane, int x, int y);
void removeGroundObject(GroundObject groundObject);
@Import("removeFloorDecoration")
void removeGroundObject(int plane, int x, int y);
byte[][][] getUnderlayIds(); byte[][][] getUnderlayIds();
void setUnderlayIds(byte[][][] underlayIds); void setUnderlayIds(byte[][][] underlayIds);

View File

@@ -721,7 +721,8 @@ public class Scene {
@ObfuscatedSignature( @ObfuscatedSignature(
descriptor = "(III)Lhn;" descriptor = "(III)Lhn;"
) )
public BoundaryObject method4155(int var1, int var2, int var3) { @Export("getBoundaryObject")
public BoundaryObject getBoundaryObject(int var1, int var2, int var3) {
Tile var4 = this.tiles[var1][var2][var3]; Tile var4 = this.tiles[var1][var2][var3];
return var4 == null ? null : var4.boundaryObject; return var4 == null ? null : var4.boundaryObject;
} }
@@ -730,7 +731,8 @@ public class Scene {
@ObfuscatedSignature( @ObfuscatedSignature(
descriptor = "(III)Lhh;" descriptor = "(III)Lhh;"
) )
public WallDecoration method4156(int var1, int var2, int var3) { @Export("getWallDecoration")
public WallDecoration getWallDecoration(int var1, int var2, int var3) {
Tile var4 = this.tiles[var1][var2][var3]; Tile var4 = this.tiles[var1][var2][var3];
return var4 == null ? null : var4.wallDecoration; return var4 == null ? null : var4.wallDecoration;
} }
@@ -739,7 +741,8 @@ public class Scene {
@ObfuscatedSignature( @ObfuscatedSignature(
descriptor = "(III)Lhj;" descriptor = "(III)Lhj;"
) )
public GameObject method4180(int var1, int var2, int var3) { @Export("getGameObject")
public GameObject getGameObject(int var1, int var2, int var3) {
Tile var4 = this.tiles[var1][var2][var3]; Tile var4 = this.tiles[var1][var2][var3];
if (var4 == null) { if (var4 == null) {
return null; return null;

View File

@@ -412,7 +412,7 @@ public class ScriptFrame {
var9 = Client.field549[var7]; var9 = Client.field549[var7];
if (var3 >= 0 && var4 >= 0 && var3 < 103 && var4 < 103) { if (var3 >= 0 && var4 >= 0 && var3 < 103 && var4 < 103) {
if (var9 == 0) { if (var9 == 0) {
BoundaryObject var33 = CollisionMap.scene.method4155(class391.Client_plane, var3, var4); BoundaryObject var33 = CollisionMap.scene.getBoundaryObject(class391.Client_plane, var3, var4);
if (var33 != null) { if (var33 != null) {
var11 = HealthBarDefinition.Entity_unpackID(var33.tag); var11 = HealthBarDefinition.Entity_unpackID(var33.tag);
if (var7 == 2) { if (var7 == 2) {
@@ -425,7 +425,7 @@ public class ScriptFrame {
} }
if (var9 == 1) { if (var9 == 1) {
WallDecoration var43 = CollisionMap.scene.method4156(class391.Client_plane, var3, var4); WallDecoration var43 = CollisionMap.scene.getWallDecoration(class391.Client_plane, var3, var4);
if (var43 != null) { if (var43 != null) {
var11 = HealthBarDefinition.Entity_unpackID(var43.tag); var11 = HealthBarDefinition.Entity_unpackID(var43.tag);
if (var7 != 4 && var7 != 5) { if (var7 != 4 && var7 != 5) {
@@ -444,7 +444,7 @@ public class ScriptFrame {
} }
if (var9 == 2) { if (var9 == 2) {
GameObject var44 = CollisionMap.scene.method4180(class391.Client_plane, var3, var4); GameObject var44 = CollisionMap.scene.getGameObject(class391.Client_plane, var3, var4);
if (var7 == 11) { if (var7 == 11) {
var7 = 10; var7 = 10;
} }