rl-api: add RuneLiteObject

This commit is contained in:
Trevor
2021-07-03 17:11:20 -04:00
committed by Adam
parent 21a7bf4906
commit d81ad59e7a
3 changed files with 132 additions and 0 deletions

View File

@@ -1027,6 +1027,35 @@ public interface Client extends GameEngine
*/
List<GraphicsObject> 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

View File

@@ -0,0 +1,71 @@
/*
* Copyright (c) 2021, Trevor <https://github.com/Trevor159>
* 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();
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2021, Trevor <https://github.com/Trevor159>
* 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
{
}