Package net.risingworld.api
Class 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
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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)
-
Method Details
-
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!- Parameters:
cx
- the chunk x coordinate.cz
- the chunk z coordinate.- Returns:
- 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.- Parameters:
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)- Parameters:
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.
-
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 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.- Parameters:
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- Parameters:
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- Parameters:
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!- Parameters:
reload
- true to reload all plugins, false to unload all plugins.
-