WorldSeed Entity Engine

repository·master·Indexed 42 days ago

https://github.com/atlasengineca/worldseedentityengine

A library for Minestom that enables the import and use of Blockbench bedrock models in Vanilla Minecraft. WSEE allows for the creation of multipart entities with complex animations, AI, and specialized classes like EmotePlayer for transparent player entities. Version 13.0.1 requires the VM argument `--add-opens java.base/java.lang=ALL-UNNAMED` for the Molang compiler to function.

Tokens
1.1K
Snippets
4
Records
6
Agent score
3%

What's inside WSEE

  1. Install WorldSeed Entity Engine (WSEE)

    master

    To use WSEE in your project, add the AtlasEngine repository to your build.gradle.kts and include the library as a dependency.

    Note: WSEE currently only supports Minestom.

    repositories {
        maven("https://reposilite.atlasengine.ca/public")
    }
    
    dependencies {
        implementation("net.worldseed.multipart:WorldSeedEntityEngine:13.0.1")
    }
  2. Configure VM Arguments for Molang Compiler

    master

    WSEE requires specific VM arguments to allow the Molang compiler library to function correctly. Add the following flag to your run configuration to avoid InaccessibleObjectException:

    --add-opens java.base/java.lang=ALL-UNNAMED

    --add-opens java.base/java.lang=ALL-UNNAMED
  3. Troubleshoot WSEE model issues

    master

    Common issues and solutions:

    • Incorrect bone positioning: Entities are placed at the bone's pivot point in Blockbench. Solution: Move the pivot point closer to the bone.
    • Model not working: Solution: Ensure the model type is set to Bedrock Model in Blockbench.
    • InaccessibleObjectException: Solution: Ensure the required VM arguments (--add-opens java.base/java.lang=ALL-UNNAMED) are added to your run configuration.
    • ModelDamageEvent or ModelInteractEvent not triggering: Solution: You must create hitboxes for the model (refer to the Hitboxes documentation).
  4. Use EmotePlayer for transparent player entities

    master

    The EmotePlayer class provides a WSEE model that uses an invisible Minestom entity as its carrier. It renders as a player skin and automatically applies vanilla idle, walking, looking, and hand-swing animations.

    Key features:

    • Movement/Rotation: Controlled via standard Minestom entity APIs.
    • Held Items: Use setItemInMainHand and setItemInOffHand to control visible items. Items remain attached to arms during animations. Use ItemStack.AIR to clear a hand.
    • Animation Control: Use setVanillaAnimationsEnabled(false) to give custom Blockbench animations complete control over player bones, then re-enable it to return to the automatic vanilla system.
    • Cleanup: Removing the EmotePlayer automatically removes its model bones and held-item displays.
    PlayerSkin skin = new PlayerSkin(textureValue, textureSignature);
    EmotePlayer actor = new EmotePlayer(instance, new Pos(0, 42, 0), skin);
    
    actor.addViewer(player);
    actor.setVelocity(new Vec(0.1, 0, 0));
    actor.setItemInMainHand(ItemStack.of(Material.DIAMOND_SWORD));
    actor.setItemInOffHand(ItemStack.of(Material.SHIELD));
    actor.swingMainHand();
    
    // Playing Blockbench animations
    actor.loadEmotes(emotes);
    actor.getAnimationHandler().playOnce("wave", () -> {});
    actor.getAnimationHandler().playRepeat("dance");
  5. Rotate a point using ModelMath.rotate()

    master

    The ModelMath.rotate(Point vector, Point rotation) method applies a 3D rotation to a given Point using Euler angles. The rotation parameter is expected to be in degrees. The method internally converts the rotation to radians and applies a rotation matrix sequence of X, then Y, then Z (Z * Y * X order).

    import net.worldseed.multipart.ModelMath;
    import net.minestom.server.coordinate.Point;
    
    Point originalPoint = new Point(1.0, 0.0, 0.0);
    Point rotationDegrees = new Point(0.0, 90.0, 0.0); // Rotate 90 degrees around Y axis
    
    Point rotatedPoint = ModelMath.rotate(originalPoint, rotationDegrees);