Package net.risingworld.api
Klasse Internals
java.lang.Object
net.risingworld.api.Internals
Class which provides access to the internal API.
USE WITH CAUTION! FUTURE UPDATES MAY BREAK THE BEHAVIOUR OF THESE METHODS
USE WITH CAUTION! FUTURE UPDATES MAY BREAK THE BEHAVIOUR OF THESE METHODS
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic void
addUIElementToPlayer
(Player player, UIElement element, String target) Same asPlayer.addUIElement(net.risingworld.api.ui.UIElement)
, but allows you to set an arbitrary UI target (defined by the UI element path).static void
forceSyncAsset
(Player player, Asset asset) Forces the game to sync a particular asset with a player.static byte[]
getRawConstructions
(int cx, int cz) static byte[]
getRawObjects
(int cx, int cz) Gets the raw, serialized object data of a chunk (uncompressed).static byte[]
getRawPlants
(int cx, int cz) static void
overwriteInnerUIStyle
(Player player, UIElement element, String innerPath, Style style) Overwrites the style of a nested element of a UI element.static void
overwriteUIStyle
(Player player, String path, Style style) Overwrites the style of any UI element on the screen (this also applies to built-in UI elements of the game)static void
Prints a message to the console, similar toSystem.out.println()
, but with a specific color.static void
reset
(boolean reload) Resets/Reloads or unloads all plugins.static void
setRawConstructions
(int cx, int cz, byte[] data) static void
setRawObjects
(int cx, int cz, byte[] data) Sets new raw, serialized object data for a chunk.static void
setRawPlants
(int cx, int cz, byte[] data) static void
setSceneElementActive
(Player player, String path, boolean active) Sets any element in the scene active/inactive.static void
setSceneElementLocalPosition
(Player player, String path, float x, float y, float z) Changes the local position of an element in the scene.static void
setSceneElementLocalRotation
(Player player, String path, float rx, float ry, float rz, float rw) Changes the local rotation of an element in the scene.static void
setSceneElementLocalScale
(Player player, String path, float x, float y, float z) Changes the local scale of an element in the scene.static void
setSceneElementParent
(Player player, String path, String parent) Changes the parent for an element in the scene.
-
Methodendetails
-
getRawObjects
public static byte[] getRawObjects(int cx, int cz) Gets the raw, serialized object data of a chunk (uncompressed). The byte order is little endian. The first byte is a control byte, the next 4 bytes represent the total amount of objects in this chunk.
Format: 1 - version (byte) 4 - number of elements (int) per element: 2 - type ID (short) 8 - global ID (long) 4 - player DbID (int) 8 - creation date (long) 4 - chunk x (int) 1 - chunk y (byte) 4 - chunk z (int) 4 - position x within chunk (float) 4 - position y within chunk (float) 4 - position z within chunk (float) 4 - rotation x (float) 4 - rotation y (float) 4 - rotation z (float) 4 - rotation w (float) 4 - scale x (float) 4 - scale y (float) 4 - scale z (float) 2 - type ID (short) 1 - variant (byte) 4 - color (int) 1 - status (byte) 8 - info ID (long) 4 - flags bitmask (int)
Please note: The format may change in a future update!- Parameter:
cx
- the chunk x coordinate.cz
- the chunk z coordinate.- Gibt zurück:
- a byte array containing the raw, serialized and uncompressed object data of the chunk, or null if no object data exist in this chunk.
-
setRawObjects
public static void setRawObjects(int cx, int cz, byte[] data) Sets new raw, serialized object data for a chunk.- Parameter:
cx
- the chunk x coordinate.cz
- the chunk z coordinate.data
- the new raw data you want to set for the chunk.- Example: Move objects from chunk 5|-7 to chunk 5|-8 and delete them from the old chunk
-
getRawConstructions
public static byte[] getRawConstructions(int cx, int cz) -
setRawConstructions
public static void setRawConstructions(int cx, int cz, byte[] data) -
getRawPlants
public static byte[] getRawPlants(int cx, int cz) -
setRawPlants
public static void setRawPlants(int cx, int cz, byte[] data) -
overwriteUIStyle
Overwrites the style of any UI element on the screen (this also applies to built-in UI elements of the game)- Parameter:
player
- the player you want to change the UI element for.path
- the name or path to the UI element you want to change.style
- the new style you want to apply to the element.
-
overwriteInnerUIStyle
public static void overwriteInnerUIStyle(Player player, UIElement element, String innerPath, Style style) Overwrites the style of a nested element of a UI element. Some elements (like scroll views or text fields) usually consist of multiple elements. The inner elements aren't accessible by default, but sometimes you may want to modify their style. Use this method to change the style of any nested element- Parameter:
player
- the player you want to change the UI element for.element
- the UI element which contains the nested element you want to change.innerPath
- the name or path of the nested element you want to change.style
- the new style you want to apply to the nested element.- Siehe auch:
-
addUIElementToPlayer
Same asPlayer.addUIElement(net.risingworld.api.ui.UIElement)
, but allows you to set an arbitrary UI target (defined by the UI element path). You can use this to attach your element to a vanilla UI element, for example.
You can use theuidebugger
console command to enable the ingame UI debugger, which reveals the paths to built-in UI elements: If you provide no parameters, you will see the path of the hovered element in the top left corner of the screen. Right-click on the element to copy the UI path to clipboard. Alternatively you can provide the layer name to theuidebugger
command, this will print all existing elements. This can be useful because some elements cannot be hovered.
To disable the UI debugger, you can either enter the console command again, or hit the small x next to the path in the top left corner of the screen.- Parameter:
player
- the player you want to attach the element to.element
- the UI element you want to attach to this player's screen.target
- the target path to the UI element you want to attach this element to.
-
forceSyncAsset
Forces the game to sync a particular asset with a player. By default, assets will only be synced with the player if any object (which uses the asset) is added to the player (e.g a UI element using a texture asset).
Use this method if you want to force-sync any asset- Parameter:
player
- the player you want to force-sync the asset with.asset
- the asset you want to foce-sync with the player.
-
println
Prints a message to the console, similar toSystem.out.println()
, but with a specific color. Note: Due to limitations of the Windows console API, you cannot provide custom hex colors, instead only a few colors are supported (defined by an ID):
Black = 0
DarkBlue = 1
DarkGreen = 2
DarkCyan = 3
DarkRed = 4
DarkMagenta = 5
DarkYellow = 6
Gray = 7
DarkGray = 8
Blue = 9
Green = 10
Cyan = 11
Red = 12
Magenta = 13
Yellow = 14
White = 15- Parameter:
message
- the message you want to print to console.colorID
- the color ID. Default color is gray (7).
-
reset
public static void reset(boolean reload) Resets/Reloads or unloads all plugins. Use with caution!- Parameter:
reload
- true to reload all plugins, false to unload all plugins.
-
setSceneElementActive
Sets any element in the scene active/inactive.- Parameter:
player
- the affected player.path
- the full path to the element in the scene.active
- true to set the element active, false to set it inactive (invisible).
-
setSceneElementParent
Changes the parent for an element in the scene.- Parameter:
player
- the affected player.path
- the full path to the element in the scene.parent
- the full path to the new parent (or null to set no parent).
-
setSceneElementLocalPosition
public static void setSceneElementLocalPosition(Player player, String path, float x, float y, float z) Changes the local position of an element in the scene.- Parameter:
player
- the affected player.path
- the full path to the element in the scene.x
- the local x position.y
- the local y position.z
- the local z position.
-
setSceneElementLocalScale
Changes the local scale of an element in the scene.- Parameter:
player
- the affected player.path
- the full path to the element in the scene.x
- the local x scale.y
- the local y scale.z
- the local z scale.
-
setSceneElementLocalRotation
public static void setSceneElementLocalRotation(Player player, String path, float rx, float ry, float rz, float rw) Changes the local rotation of an element in the scene.- Parameter:
player
- the affected player.path
- the full path to the element in the scene.rx
- the rotation x component.ry
- the rotation y component.rz
- the rotation z component.rw
- the rotation w component.
-