Class Journeymap
java.lang.Object
com.minecolonies.core.compatibility.journeymap.Journeymap
Journeymap interface singleton
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull journeymap.client.api.IClientAPIgetApi()Gets the Journeymap API instance.getDataPath(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension) Gets the folder where additional map data should be stored.static @NotNull Optional<Journeymap>Gets the current instance.@NotNull Optional<JourneymapOptions>Gets the Journeymap custom options.<T> Optional<T>loadData(@NotNull Path filePath, @NotNull String description, @NotNull com.mojang.serialization.Codec<T> codec) Loads JSON data from disk via a Codec.<T> booleansaveData(@NotNull Path filePath, @NotNull String description, @NotNull com.mojang.serialization.Codec<T> codec, T value) Saves JSON data to disk via a Codec.voidsetOptions(JourneymapOptions options) Sets the Journeymap custom options.voidshow(@NotNull journeymap.client.api.display.Displayable displayable) Helper method to simplify showing displayables.
-
Constructor Details
-
Journeymap
public Journeymap(journeymap.client.api.IClientAPI jmap)
-
-
Method Details
-
getInstance
Gets the current instance. -
getApi
@NotNull public @NotNull journeymap.client.api.IClientAPI getApi()Gets the Journeymap API instance. -
getOptions
Gets the Journeymap custom options. -
setOptions
Sets the Journeymap custom options.- Parameters:
options- The new options instance.
-
show
public void show(@NotNull @NotNull journeymap.client.api.display.Displayable displayable) Helper method to simplify showing displayables.- Parameters:
displayable- The displayable to show.
-
getDataPath
public Path getDataPath(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension) Gets the folder where additional map data should be stored.- Parameters:
dimension- The dimension being mapped.- Returns:
- The path to the data folder (this may not exist yet).
-
loadData
public <T> Optional<T> loadData(@NotNull @NotNull Path filePath, @NotNull @NotNull String description, @NotNull @NotNull com.mojang.serialization.Codec<T> codec) Loads JSON data from disk via a Codec.- Type Parameters:
T- The type of the object being loaded.- Parameters:
filePath- The path to the json file (need not exist)description- What you're trying to load (for error logging).codec- The codec for the object being loaded.- Returns:
- The loaded data, or empty if the file was absent or unloadable.
-
saveData
public <T> boolean saveData(@NotNull @NotNull Path filePath, @NotNull @NotNull String description, @NotNull @NotNull com.mojang.serialization.Codec<T> codec, @NotNull T value) Saves JSON data to disk via a Codec.- Type Parameters:
T- The type of the object being saved.- Parameters:
filePath- The path to the json file (need not exist)description- What you're trying to save (for error logging).codec- The codec for the object being saved.value- The object being saved.- Returns:
- True if the object was saved successfully.
-