Skip to main content
Version: Minecraft 26.2

dev.polymodloader.api.data

Generated

This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.

TypeKindDescription
DataMigrationfunctional interfaceUpgrades saved data written by an older version of a mod.
DataTreeclassTyped key-value data that Poly Mod Loader saves with the world: block entity data and world storage use it.

DataMigration​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface DataMigration

Upgrades saved data written by an older version of a mod. Called once when data saved with an older version is loaded, before anything reads it; afterwards the data counts as current.

migrate(DataTree, int)​

void migrate(DataTree data, int fromVersion)

Since 0.1.0-alpha.4 or earlier

Upgrades data from fromVersion to the current version.

ParameterTypeDescription
dataDataTreethe saved data, changed in place
fromVersionintthe version it was saved with (0 for data saved before versions were used)

DataTree​

class · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public final class DataTree

Typed key-value data that Poly Mod Loader saves with the world: block entity data and world storage use it. Values are int, long, double, boolean, String, byte[], or nested trees. Reading a missing key or a key of another type returns the fallback.

Thread: not thread-safe; use it on the thread that owns the world.

create()​

public static DataTree create()

Since 0.1.0-alpha.4 or earlier

An empty tree.

Returns DataTree

getInt(String, int)​

public int getInt(String key, int fallback)

Since 0.1.0-alpha.4 or earlier

The integer under key, or fallback if there is none.

ParameterTypeDescription
keyString—
fallbackint—

Returns int

putInt(String, int)​

public DataTree putInt(String key, int value)

Since 0.1.0-alpha.4 or earlier

Stores an integer under key; returns this tree.

ParameterTypeDescription
keyString—
valueint—

Returns DataTree

getLong(String, long)​

public long getLong(String key, long fallback)

Since 0.1.0-alpha.4 or earlier

The long under key, or fallback if there is none.

ParameterTypeDescription
keyString—
fallbacklong—

Returns long

putLong(String, long)​

public DataTree putLong(String key, long value)

Since 0.1.0-alpha.4 or earlier

Stores a long under key; returns this tree.

ParameterTypeDescription
keyString—
valuelong—

Returns DataTree

getDouble(String, double)​

public double getDouble(String key, double fallback)

Since 0.1.0-alpha.4 or earlier

The double under key, or fallback if there is none.

ParameterTypeDescription
keyString—
fallbackdouble—

Returns double

putDouble(String, double)​

public DataTree putDouble(String key, double value)

Since 0.1.0-alpha.4 or earlier

Stores a double under key; returns this tree.

ParameterTypeDescription
keyString—
valuedouble—

Returns DataTree

getBoolean(String, boolean)​

public boolean getBoolean(String key, boolean fallback)

Since 0.1.0-alpha.4 or earlier

The boolean under key, or fallback if there is none.

ParameterTypeDescription
keyString—
fallbackboolean—

Returns boolean

putBoolean(String, boolean)​

public DataTree putBoolean(String key, boolean value)

Since 0.1.0-alpha.4 or earlier

Stores a boolean under key; returns this tree.

ParameterTypeDescription
keyString—
valueboolean—

Returns DataTree

getString(String, String)​

public String getString(String key, String fallback)

Since 0.1.0-alpha.4 or earlier

The string under key, or fallback if there is none.

ParameterTypeDescription
keyString—
fallbackString—

Returns String

putString(String, String)​

public DataTree putString(String key, String value)

Since 0.1.0-alpha.4 or earlier

Stores a string under key; returns this tree.

ParameterTypeDescription
keyString—
valueString—

Returns DataTree

getBytes(String)​

public Optional<byte[]> getBytes(String key)

Since 0.1.0-alpha.4 or earlier

A copy of the stored bytes.

ParameterTypeDescription
keyString—

Returns Optional<byte[]>

putBytes(String, byte[])​

public DataTree putBytes(String key, byte[] value)

Since 0.1.0-alpha.4 or earlier

Stores a copy of value under key; returns this tree.

ParameterTypeDescription
keyString—
valuebyte[]—

Returns DataTree

child(String)​

public DataTree child(String key)

Since 0.1.0-alpha.4 or earlier

The child tree under key, creating it (and replacing a non-tree value) if needed.

ParameterTypeDescription
keyString—

Returns DataTree

findChild(String)​

public Optional<DataTree> findChild(String key)

Since 0.1.0-alpha.4 or earlier

The child tree under key, without creating it.

ParameterTypeDescription
keyString—

Returns Optional<DataTree>

has(String)​

public boolean has(String key)

Since 0.1.0-alpha.4 or earlier

Whether any value is stored under key.

ParameterTypeDescription
keyString—

Returns boolean

remove(String)​

public void remove(String key)

Since 0.1.0-alpha.4 or earlier

Removes the value under key, if any.

ParameterTypeDescription
keyString—

keys()​

public Set<String> keys()

Since 0.1.0-alpha.4 or earlier

Keys in insertion order.

Returns Set<String>

raw(String)​

public Optional<Object> raw(String key)

Since 0.1.0-alpha.4 or earlier

The raw value under key: Integer, Long, Double, Boolean, String, byte[] (shared, do not modify), or DataTree; empty when absent.

ParameterTypeDescription
keyString—

Returns Optional<Object>

clear()​

public void clear()

Since 0.1.0-alpha.4 or earlier

Removes every entry.

copy()​

public DataTree copy()

Since 0.1.0-alpha.4 or earlier

A deep copy.

Returns DataTree

Buy me a coffee