Mojira Archive
MCPE-46286

Add-on Bug, minecraft:timer component is using times from previously active timer instead of currently active one.

There appears to be a bug for the minecraft:timer component that causes it to not correctly update the running timer to use the timer component from the currently active component group.

Instead it is using the timer values that were previously applied and just switched out for.

I have provided an example json entity with the issue, tested with "format_version": "1.10.0" and "format_version": "1.8.0", afaik my old 1.10 entities did not have this issue.

 

Expected behavior:

mzo:stage1 should be active for 1 second

mzo:stage2 should be active for 2 seconds

mzo:stage3 should be active for 3 seconds

Observing the entities scale as a debug to reflect the active component group.

Actual behavior:

mzo:stage1 is active for 3 seconds, the timer that was active previously

mzo:stage2 is active for 1 second, the timer that was active previously

mzo:stage3 is active for 2 seconds, the timer that was active previously

 

Example entity json with the issue:

 

{
  "format_version": "1.10.0",
  "minecraft:entity": {
    "description": {
      "identifier": "mzo:timer_test",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },

    "component_groups": {

      "mzo:stage1": {
        "minecraft:scale": {
          "value": 1.0
        },

        "minecraft:timer": {
          "time": [ 1, 1 ],
          "looping": false,
          "time_down_event": {
            "event": "mzo:event_stage2",
            "target": "self"
          }
        }
      },

      "mzo:stage2": {
        "minecraft:scale": {
          "value": 2.0
        },

        "minecraft:timer": {
          "time": [ 2, 2 ],
          "looping": false,
          "time_down_event": {
            "event": "mzo:event_stage3",
            "target": "self"
          }
        }
      },

      "mzo:stage3": {
        "minecraft:scale": {
          "value": 3.0
        },

        "minecraft:timer": {
          "time": [ 3, 3 ],
          "looping": false,
          "time_down_event": {
            "event": "mzo:event_stage1",
            "target": "self"
          }
        }
      }

    },

    "components": {

      "minecraft:type_family": {
        "family": [ "zombie", "undead", "monster" ]
      },

      "minecraft:attack": {
        "damage": 3
      },

      "minecraft:breathable": {
        "totalSupply": 15,
        "suffocateTime": 0,
        "breathesAir": true,
        "breathesWater": true
      },

      "minecraft:health": {
        "value": 20,
        "max": 20
      },

      "minecraft:collision_box": {
        "width": 0.72,
        "height": 2.0
      },
      "minecraft:navigation.walk": {
        "can_path_over_water": true
      },
      "minecraft:movement.basic": {
      },
      "minecraft:jump.static": {
      },
      "minecraft:can_climb": {
      },
      "minecraft:fire_immune": true,
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1
      },
      "minecraft:follow_range": {
        "value": 16,
        "max": 16
      },
      "minecraft:behavior.look_at_player": {
        "priority": 6,
        "look_distance": 8
      },
      "minecraft:behavior.nearest_attackable_target": {
        "priority": 2,
        "scan_interval": 10,
        "reselect_targets": true,
        "within_radius": 16,
        "entity_types": [
          {
            "filters": {
              "any_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "player"
                },
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "player_ally"
                }
              ]
            },
            "max_dist": 16
          }
        ],
        "must_see": false
      },

      "minecraft:physics": {
      }
    },

    "events": {
      "minecraft:entity_spawned": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "mzo:stage1"
              ]
            }
          }
        ]
      },
      "mzo:event_stage1": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "mzo:stage1"
              ]
            },
            "remove": {
              "component_groups": [
                "mzo:stage3"
              ]
            }
          }
        ]
      },
      "mzo:event_stage2": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "mzo:stage2"
              ]
            },
            "remove": {
              "component_groups": [
                "mzo:stage1"
              ]
            }
          }
        ]
      },
      "mzo:event_stage3": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "mzo:stage3"
              ]
            },
            "remove": {
              "component_groups": [
                "mzo:stage2"
              ]
            }
          }
        ]
      }
    }
  }
}

Cannot Reproduce

Kevin Gagnon

2019-05-14, 07:34 AM

2020-11-26, 04:27 PM

2020-11-26, 04:27 PM

2

0

Community Consensus

279818

1.11.1, 1.11.2

-