Mojira Archive
MCM-1324

Behavior entity MoLang variables does not work on the resource side

Partner Rank: 3

Partner Team Reporting: Starfish Studios

Verification builds: ver. 1.16.220.02, build 5685695

Summary:
Entity MoLang variables set through behavior animations and animation controllers does not work on the resource side.

Impact:
This makes it impossible to do MoLang tests on the entity's resource pack side using variables set through behavior pack animations.

Repro Steps:

  1. Download and install the attached add-on pack.
  2. Join a world with the behavior and resource pack enabled.
  3. Summon a sheep /summon sheep.
  4. Hit the sheep.

Repro Rate: 3/3

Observed Results:
When hitting the sheep, variable.headless is set to 1. But there is no difference in the sheep.

Expected Results:
The sheep should have its head invisible once this variable set (what is set on the resource side).

Screenshots/Videos attached: No

Regression Builds: None

Notes:
Codes added to the sheep:
// Behavior side animation controllers:

{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.sheep.setup": {
      "initial_state": "default",
      "states": {
        "default": {
          "transitions": [
            {
              "on_hurt": "query.hurt_time > 0"
            }
          ]
        },
        "on_hurt": {
          "on_entry": [ "variable.headless = 1;" ]
        }
      }
    }
  }
}

// Behavior file:

{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:sheep",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false,
      "scripts": {
        "animate": [ "setup" ]
      },
      "animations": {
        "setup": "controller.animation.sheep.setup"
      }
    },
    ...
  }
}

// Resource side render controllers:

{
  "format_version": "1.8.0",
  "render_controllers": {
    "controller.render.sheep": {
      "arrays": {
        "geometries": {
          "Array.geos": [ "Geometry.default", "Geometry.sheared" ]
        }
      },
      "geometry": "Array.geos[query.is_sheared]",
      "materials": [ { "*": "Material.default" } ],
      "textures": [ "Texture.default" ],
      "part_visibility": [
        { "head": "!(variable.headless ?? 0)" } // Visible only when v.headless is not returning 1, it will be visible if this variable has not yet been initialized.
      ]
    }
  }
}

Works As Intended

Jean Lucas

2021-04-01, 06:41 AM

2021-04-30, 09:49 PM

2021-04-30, 09:49 PM

1

1

Future Release

-