Expand description
Other mods — Yog’s and Java ones — from a Yog mod: whether one is
loaded (crate::mod_loaded), and calls into a Java mod’s API by
reflection (call).
ⓘ
use yog_api::java;
use yog_api::yog_data::Value;
if yog_api::mod_loaded("pehkui") {
let entity = Value::Ref(yog_api::yog_data::Ref::new("entity", uuid));
let scale = java::call("virtuoel.pehkui.api.ScaleTypes.BASE.getScaleData($0).getScale()", &[entity])
.and_then(|v| v.as_f64());
}Functions§
- call
- Calls a Java mod’s API:
expris a chain from a class —virtuoel.pehkui.api.ScaleTypes.BASE.getScaleData($0).getScale()— fields and methods,$nthen-th ofargs. Numbers, strings, booleans and null cross as they are; an entity isValue::Ref(Ref::new("entity", uuid))both ways.Nonewhen the call failed (the log says why). For other mods’ APIs only: Minecraft’s own classes are renamed at run time on some loaders. - mod_
loaded - Whether mod
idis loaded: a Yog mod, or a Java mod in Fabric’s, Forge’s or NeoForge’s mod list. Content and code for another mod — an optional integration — go behind it.