Download CraftTweaker Java Library — Minecraft Mods — MetaMods

CraftTweaker Java Library

Active

Downloads

0

Last update

1 year ago
Client
Utils
Addons

CraftTweaker Java Library

This mod was developed to expand the functional capabilities of CraftTweaker, providing experienced users with advanced tools for creating complex scenarios and mechanics.

Main Features

The mod offers a set of Java libraries that allow implementing complex logical constructs and extended functionality. Among the key features are support for input-output operations, network interactions, asynchronous task execution, and multithreading. These functions open new horizons for creating advanced modifications and customizing gameplay.

Usage Examples

Multithreading

val tread = thread.createTread(() => {
    var i = 0;
    while (i < 5000){
        println("Thread 1: " + i);
        i++;
    }
});

thread.createRunThread(() => {
    var i = 0;
    while (i < 5000){
        println("Thread 2: " + i);
        i++;
    }
});

tread.start();

Asynchronous Operations

import stdlib.Exception;
import mods.ctjl.java.lang.ExecutionException;
import mods.ctjl.java.lang.InterruptedException;

var async_1 = async.supplyAsync(() => {
  var i = 0;
  println("Async task 1 started");
  while(i < 2000){
    println(i);
    i++;
  }
  return 1;
});

var async_2 = async.runAsync(() => {
  var i = 0;
  println("Async task 2 started");
  while(i < 2000){
    println(i);
    i++;
  }
});

try {
  async_1.getValue();
  println("Async task 1 completed");
} catch ex as ExecutionException {
  println(ex.toString());
} catch ex as InterruptedException {
  println(ex.toString());
}

try {
  async_2.getValue();
  println("Async task 2 completed");
} catch ex as Exception {
  println("An error occurred");
  println(ex.toString());
}
Project members
Sixik

Sixik

Created: 10 May 2024

ID: 27954