lib_java v2

lib_java v2
264 Downloads

Library for using Java reflection from Python, wrapping
the low-level Java API script functions (java_*).

Requires:

  • minescript v4.0

Example:

from minescript import (echo, version_info)
from lib_java import (
  JavaClass, java_class_map, java_member_map)

# If using a version of Minecraft with obfuscated
# symbols, populate these dictionaries with the
# appropriate mappings, for example:
mc_class_name = version_info().minecraft_class_name
if mc_class_name == "net.minecraft.class_310":
  java_class_map.update({
    "net.minecraft.client.Minecraft": "net.minecraft.class_310",
  })
  java_member_map.update({
    "getInstance": "method_1551",
    "getFps": "method_47599",
  })

Minecraft = JavaClass("net.minecraft.client.Minecraft")
minecraft = Minecraft.getInstance()
echo("fps:", minecraft.getFps())
Version: 2