Repository navigation
Scripting.en
KubeJS is optional. Model files and skeleton configuration still live in resource packs or .instance.json sidecars; scripts only issue commands. Clips, IK, springs, morph and rendering all run in the Java / GPU runtime — there are no per-bone or per-vertex JS callbacks.
Assimp is available only in client_scripts. This version of KubeJS loads top-level scripts on the mod-loading thread, so register callbacks at the top level and operate on models inside client events such as ClientEvents.tick.
ClientEvents.tick(function (event) {
if (!event.player) return
var model = Assimp.instance(event.player.mainHandItem, 'highbone_probe')
if (!model) return
// issue commands on state changes or interaction, not unconditionally every tick
})Assimp.instance(owner, model) accepts a client-side entity, block entity or non-empty ItemStack, and returns the real instance handle shared by that owner and model. It returns null while the model has not been imported by the resource / render path. It does not attach a renderer to an arbitrary entity, and it does not turn an ordinary item into a custom-model item.
Other globals: apiVersion(), models(), statistics(), release(owner). Read Java Maps with map.get('key'), and coerce numbers with Number(...) before comparing.
| Method | Behaviour |
|---|---|
isValid(), sameInstance(other)
|
check whether the handle is stale; compare for the same instance |
model(), animations(), states(), currentState()
|
read playback metadata |
state(name) |
request a state from the sidecar; unknown names return false |
play(clip, blendSeconds) |
blend to a clip; unknown clips return false |
pause(), resume(), stop(), resetDynamics()
|
control the current instance |
layer(id, clip, weight, additive, mask) |
set a layer; mask is a JS object mapping nodes to weights |
layerWeight(id, weight), removeLayer(id)
|
adjust or remove a layer |
meshes() |
mesh list with name, vertex and bone counts, and morph target names |
morph(meshIndex, weights), resetMorphs()
|
override or clear morph targets |
performance(options), performance()
|
merge or read performance settings |
effects(enabled), groundPlacement(enabled)
|
toggle instance effects and ground placement |
target(modifierId, x, y, z) |
move an existing IK or LookAt target |
bounds(), node(name), attachment(name)
|
read the model-space bounding box and positions |
raycast(mode, ox, oy, oz, dx, dy, dz, distance) |
model-space hit information; null when nothing is hit |
Ray modes are BOUNDS, BONE, OBB and MESH. Triangle queries above 100,000 vertices are rejected. Queries use the authoritative simulated pose; model-space coordinates are the caller's responsibility to transform by the render matrix.
updateIntervalTicks, renderInterpolation, ik, springBones, particles, trails, maxParticleEmissions, maxTrailSamples. The client-wide budget is still the ceiling, and global PERFORMANCE mode ignores a per-instance interpolation flag. Changing performance resets dynamics and effect history, so set it when switching presets or acquiring the instance rather than every tick.
Handles hold only weak references. Resource reload, world switch, owner removal or release invalidates them; call Assimp.instance again. Calls from the wrong thread return a readable error instead of crashing.
AssimpServer is available only in server_scripts and contains no client references. The current target is the assimploader:deer_showcase entity:
EntityEvents.spawned('assimploader:deer_showcase', function (event) {
AssimpServer.state(event.entity, 'auto')
AssimpServer.groundPlacement(event.entity, true)
AssimpServer.effects(event.entity, true)
})Changes are delivered through the entity's existing synced data and NBT, and the client receives them through normal Minecraft entity synchronisation. Calls must run on the server thread and the entity must be alive. auto restores motion-driven state selection.
Runnable examples live in the repository's examples/kubejs/; they are not installed into existing packs automatically.
-
client_scripts/assimp_held_morph.js— handles owner changes, resource reload and logout; changes morph only on crouch-state changes -
server_scripts/assimp_deer.js— server-side entity state
把 FBX / glTF / GLB 带进 Minecraft 的资产、动画与 GPU 渲染引擎。 An engine for 3D assets, animation and GPU rendering in Minecraft.
- Home
- Getting Started
- Model Import
- PBR and Shaders
- Animation
- IK and Physics
- Collision
- Rendering and Performance
- In-game Workbench
- Scripting
- Workbench Extensions
- Asset Pipeline