5q12's YAML API

A YAML api to read and write to YAML files for Fabric.

Редакция NLZONE · 2 мин чтения · 1 просмотр
5q12's YAML API
Скачать 5q12's YAML API1.19.4 – 1.21 · с официальной страницы: modrinth.com
Перейти к загрузке

Что это

A YAML api to read and write to YAML files for Fabric.

  • Тип: мод
  • Загрузчик: fabric
  • Версии Minecraft: 1.19.4 – 1.21
  • Скачиваний на Modrinth: 1 618

Подробно

Overview 5q12's YAML API is a simple and efficient API for reading and writing YAML files within the Minecraft Fabric modding environment. This API facilitates seamless integration of YAML configuration files, allowing mod developers to easily manage configuration data.

Features - Read YAML Files: Parse YAML files into Java objects with ease. - Write YAML Files: Serialize Java objects into YAML format. - Integration: Designed specifically for use with Fabric, ensuring compatibility and performance.

repositories { maven { url = uri("https://yml.ccls.app/v1.1.3") } mavenCentral() }

dependencies { modImplementation 'app.ccls.yml:yamlapi:1.1.3' }

Imports java import app.ccls.yml.YamlHandler; import app.ccls.yml.YamlHandlerFactory;

Simple Key-Value Storage java import app.ccls.yml.YamlHandler; import app.ccls.yml.YamlHandlerFactory; import java.io.IOException; import java.util.HashMap; import java.util.Map;

public class SimpleKeyValueExample { public static void main(String[] args) { // Initialize YamlHandler with the "nested" format YamlHandler yamlHandler = YamlHandlerFactory.getHandler("nested");

// Define a file path String filePath = "config/simpledata.yml";

// Create a simple key-value map Map data = new HashMap<>(); data.put("username", "exampleUser"); data.put("score", 1500);

try { // Write the data to the YAML file yamlHandler.writeYaml(filePath, data); System.out.println("Data saved to " + filePath);

// Read the data back from the YAML file Map loadedData = yamlHandler.readYaml(filePath); System.out.println("Loaded data: " + loadedData); } catch (IOException e) { e.printStackTrace(); } } }

Nested Structures java import app.ccls.yml.YamlHandler; import app.ccls.yml.YamlHandlerFactory; import java.io.IOException; import java.util.HashMap; import java.util.Map;

public class NestedStructureExample { public static void main(String[] args) { // Initialize YamlHandler with the "nested" format YamlHandler yamlHandler = YamlHandlerFactory.getHandler("nested");

// Define a file path String filePath = "config/nesteddata.yml";

// Create a nested structure map Map data = new HashMap<>(); Map userDetails = new HashMap<>(); userDetails.put("age", 25); userDetails.put("email", "user@example.com")

Как установить

Скачайте файл на официальной странице ниже и положите его в папку mods (для модов) или plugins (для плагинов) вашего сервера или клиента. Для модов нужен совместимый загрузчик. Версия должна совпадать с версией Minecraft.

Текст подготовлен автоматически из описания на Modrinth и ждёт проверки редакцией.

Редакция NLZONE

Пишем о серверах, модах и играх, в которые играем сами. Нашли ошибку — напишите нам, исправим.

Комментарии 0

Комментарии к этому материалу отключены.

Читайте также