diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 5be3523f3a..d5a2393a5e 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1027,6 +1027,35 @@ public interface Client extends GameEngine */ List getGraphicsObjects(); + /** + * Creates a RuneLiteObject, which is a modified {@link GraphicsObject} + */ + RuneLiteObject createRuneLiteObject(); + + /** + * Loads a model from the cache + * + * @param id the ID of the model + */ + Model loadModel(int id); + + /** + * Loads a model from the cache and also recolors it + * + * @param id the ID of the model + * @param colorToFind array of hsl color values to find in the model to replace + * @param colorToReplace array of hsl color values to replace in the model + */ + Model loadModel(int id, short[] colorToFind, short[] colorToReplace); + + /** + * Loads an animation from the cache + * + * @param id the ID of the animation. Any int is allowed, but implementations in the client + * should be defined in {@link AnimationID} + */ + Sequence loadAnimation(int id); + /** * Gets the music volume * @return volume 0-255 inclusive diff --git a/runelite-api/src/main/java/net/runelite/api/RuneLiteObject.java b/runelite-api/src/main/java/net/runelite/api/RuneLiteObject.java new file mode 100644 index 0000000000..20f2fb001e --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/RuneLiteObject.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2021, Trevor + * Copyright (c) 2021 Abex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api; + +import net.runelite.api.coords.LocalPoint; + +/** + * Represents a modified {@link GraphicsObject} + */ +public interface RuneLiteObject extends GraphicsObject +{ + /** + * Sets the model of the RuneLiteObject + */ + void setModel(Model model); + + /** + * Sets the animation of the RuneLiteObject + * If animation is null model will be static + */ + void setAnimation(Sequence animation); + + /** + * Sets whether the animation of the RuneLiteObject should loop when the animation ends. + * If this is false the object will despawn when the animation ends. + * Does nothing if the animation is null. + */ + void setShouldLoop(boolean shouldLoop); + + /** + * Sets the location in the scene for the RuneLiteObject + */ + void setLocation(LocalPoint point, int plane); + + /** + * Sets the state of the RuneLiteObject + * Set to true to spawn the object + * Set to false to despawn the object + */ + void setActive(boolean active); + + /** + * Gets the state of the RuneLiteObject + * + * @return true if the RuneLiteObject is added to the scene + */ + boolean isActive(); +} diff --git a/runelite-api/src/main/java/net/runelite/api/Sequence.java b/runelite-api/src/main/java/net/runelite/api/Sequence.java new file mode 100644 index 0000000000..e7e1c8fcb9 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/Sequence.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021, Trevor + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.api; + +/** + * Represents an animation of a renderable + */ +public interface Sequence +{ +}