{
   "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
   "id": "541605",
   "self": "https://bugs.mojang.com/rest/api/2/issue/541605",
   "key": "BDS-18672",
   "fields": {
      "issuetype": "1",
      "project": "11700",
      "fixVersions": [],
      "resolution": "4",
      "customfield_10500": {
         "self": "https://bugs.mojang.com/rest/api/2/customFieldOption/10300",
         "value": "Unconfirmed",
         "id": "10300",
         "disabled": false
      },
      "customfield_12800": null,
      "customfield_12602": [],
      "customfield_12601": null,
      "customfield_12604": null,
      "customfield_12603": null,
      "customfield_12606": null,
      "customfield_12605": null,
      "customfield_12608": null,
      "resolutiondate": "2024-05-14T19:14:08.000+0300",
      "customfield_12607": null,
      "customfield_12609": null,
      "workratio": -1,
      "lastViewed": null,
      "watches": {
         "self": "https://bugs.mojang.com/rest/api/2/issue/BDS-18672/watchers",
         "watchCount": 2,
         "isWatching": false
      },
      "created": "2023-08-25T19:43:55.000+0300",
      "customfield_12000": null,
      "customfield_12201": null,
      "customfield_12600": null,
      "labels": [],
      "customfield_11700": "{}",
      "versions": [
         "21608"
      ],
      "issuelinks": [],
      "assignee": null,
      "updated": "2024-05-14T19:14:08.000+0300",
      "status": "5",
      "description": "*@minecraft/server 1.6.0-beta*\r\n{code:javascript}\r\nimport { EntityEquippableComponent, EquipmentSlot, system, world } from '@minecraft/server';\r\nsystem.runInterval(() => {\r\n    world.getAllPlayers().forEach(player => {\r\n        /**\r\n         * @type {EntityEquippableComponent}\r\n         */\r\n        const equippable = player.getComponent('minecraft:equippable');\r\n        const slot = equippable.getEquipmentSlot(EquipmentSlot.Offhand);\r\n        console.warn(slot?.typeId ?? 'null');\r\n    });\r\n});{code}\r\nExpected Results:\r\nlogs the type of the item in my offhand.\r\n\r\nObserved Results:\r\nthrows\u00a0\r\nTypeError: Unexpected type passed to function argument [0]. \u00a0 \u00a0at <anonymous> (index4.js:32)\r\nat forEach (native)\r\nat <anonymous> (index4.js:34)\r\ndoes the same for getEquipment\u00a0 and setEquipment and for \"Offhand\" or any of the others it throws a native conversion type error.\r\n\r\n{code:javascript}\r\n//line 34\r\nconst slot = equippable.getEquipmentSlot(EquipmentSlot.Offhand);\r\n{code}\r\n\r\nalso entity.getComponent(\"equippable\"); might not work on entities.\r\n{code:javascript}\r\nimport { EntityEquippableComponent, EquipmentSlot, system, world } from '@minecraft/server';\r\nworld.getDimension(MinecraftDimensionTypes.overworld).getEntities().forEach(entity => {\r\n\u00a0 \u00a0 \u00a0 \u00a0 if (entity.typeId !== 'minecraft:skeleton') return;\r\n\u00a0 \u00a0 \u00a0 \u00a0 console.warn(entity.typeId);\r\n\u00a0 \u00a0 \u00a0 \u00a0 /**\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0* @type {EntityEquippableComponent}\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0*/\r\n\u00a0 \u00a0 \u00a0 \u00a0 const equippable = entity.getComponent('minecraft:equippable');\r\n\u00a0 \u00a0 \u00a0 \u00a0 const slot = equippable.getEquipmentSlot(EquipmentSlot.Mainhand);\r\n\u00a0 \u00a0 \u00a0 \u00a0 console.warn(slot?.typeId ?? 'null');\r\n\u00a0 \u00a0 });\r\n});\r\n\r\n{code}\r\nFor a skeleton:\r\nExpected Results:\r\nlogs 'minecraft:bow'.\r\n\r\nObserved Results:\r\nthrows \r\nTypeError: cannot read property 'getEquipmentSlot' of undefined at <anonymous> (index4.js:42)\r\nat forEach (native)\r\nat <anonymous> (index4.js:44)\r\n{code:javascript}\r\n//line 42\r\nconst equippable = entity.getComponent('minecraft:equippable');\r\n{code}",
      "customfield_11100": 0.0,
      "customfield_11300": "Windows 11",
      "customfield_11500": null,
      "customfield_12503": null,
      "customfield_12700": "[Briefly describe the bug here]\r\n\r\n*Steps to Reproduce:*\r\n# [Step 1]\r\n# [Step 2]\r\n# [Step 3]\r\n\r\n*Observed Results:*\r\n[Describe what happens]\r\n\r\n*Expected Results:*\r\n[Describe what should happen]\r\n\r\n*Screenshots/Videos attached:* [please attach an image or short video]\r\n\r\n*Notes:*",
      "customfield_12502": null,
      "customfield_12504": null,
      "attachment": [],
      "summary": "[Scripting] EntityEquippableComponent and its methods: setEquipment, getEquipmentSlot and getEquipment are broken",
      "creator": "JIRAUSER465801",
      "reporter": "JIRAUSER465801",
      "customfield_10002": null,
      "customfield_12501": null,
      "customfield_12500": null,
      "customfield_11601": null,
      "customfield_11600": "0|i2estj:",
      "environment": null,
      "customfield_11801": null,
      "customfield_11800": null,
      "customfield_11602": null,
      "customfield_11802": null,
      "comment": {
         "comments": [
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/541605/comment/1276762",
               "id": "1276762",
               "author": "JIRAUSER465801",
               "body": "Could this get swapped to bedrock edition instead of bds some how didn\u2019t see it. Think something messed up as when I first copied it, it was MCPE-174596 which points towards BDS-18672 which is what it is currently.",
               "updateAuthor": "JIRAUSER465801",
               "created": "2023-08-26T00:24:16.006+0300",
               "updated": "2023-08-26T00:55:04.880+0300"
            },
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/541605/comment/1277487",
               "id": "1277487",
               "author": "JIRAUSER648376",
               "body": "Hi\r\n\r\nThis occur only on Bedrock Dedicated Server or it can be reproduced on local worlds/Realms?\r\n\r\nThis ticket will automatically reopen when you reply. ",
               "updateAuthor": "JIRAUSER648376",
               "created": "2023-08-30T14:01:47.889+0300",
               "updated": "2023-08-30T14:01:47.889+0300"
            },
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/541605/comment/1287246",
               "id": "1287246",
               "author": "JIRAUSER730564",
               "body": "This also happens in 1.20.31, on local worlds. But this time you can get the player's armor, not entities such as zombies",
               "updateAuthor": "JIRAUSER730564",
               "created": "2023-10-25T18:42:41.632+0300",
               "updated": "2023-10-25T18:45:53.765+0300"
            },
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/541605/comment/1322807",
               "id": "1322807",
               "author": "JIRAUSER484247",
               "body": "Cleaning up old tickets: This ticket had been set to 'Awaiting Response', but has not received a response from the reporter (~3 months+) so is being closed as Incomplete. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines which includes steps to reproduce the problem.\r\n\r\nQuick Links:\r\n\ud83d\udcd3 Issue Guidelines \u2013 \ud83d\udcac Mojang Support \u2013 \ud83d\udce7 Suggestions \u2013 \ud83d\udcd6 Minecraft Wiki\r\n\r\n",
               "updateAuthor": "JIRAUSER484247",
               "created": "2024-05-14T19:14:08.252+0300",
               "updated": "2024-05-14T19:14:08.252+0300"
            }
         ],
         "maxResults": 4,
         "total": 4,
         "startAt": 0
      },
      "votes": {
         "self": "https://bugs.mojang.com/rest/api/2/issue/BDS-18672/votes",
         "votes": 0,
         "hasVoted": false
      }
   },
   "changelog": {
      "startAt": 0,
      "maxResults": 7,
      "total": 7,
      "histories": [
         {
            "id": "2857978",
            "author": "JIRAUSER465801",
            "created": "2023-08-25T19:46:10.371+0300",
            "items": [
               {
                  "field": "description",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": "*@minecraft/server 1.6.0-beta*\r\n{code:javascript}\r\nimport { EntityEquippableComponent, EquipmentSlot, system, world } from '@minecraft/server';\r\nsystem.runInterval(() => {\r\n    world.getAllPlayers().forEach(player => {\r\n        /**\r\n         * @type {EntityEquippableComponent}\r\n         */\r\n        const equippable = player.getComponent('minecraft:equippable');\r\n        const slot = equippable.getEquipmentSlot(EquipmentSlot.Offhand);\r\n        console.warn(slot?.typeId ?? 'null');\r\n    });\r\n});{code}\r\nExpected Results:\r\nlogs the type of the item in my offhand.\r\n\r\nObserved Results:\r\nthrows\u00a0\r\nTypeError: Unexpected type passed to function argument [0]. \u00a0 \u00a0at <anonymous> (index4.js:32)\r\nat forEach (native)\r\nat <anonymous> (index4.js:34)\r\ndoes the same for getEquipment\u00a0 and setEquipment\r\n\r\n{code:javascript}\r\n//line 34\r\nconst slot = equippable.getEquipmentSlot(EquipmentSlot.Offhand);\r\n{code}\r\n\r\nalso entity.getComponent(\"equippable\"); might not work on entities.\r\n{code:javascript}\r\nimport { EntityEquippableComponent, EquipmentSlot, system, world } from '@minecraft/server';\r\nworld.getDimension(MinecraftDimensionTypes.overworld).getEntities().forEach(entity => {\r\n\u00a0 \u00a0 \u00a0 \u00a0 if (entity.typeId !== 'minecraft:skeleton') return;\r\n\u00a0 \u00a0 \u00a0 \u00a0 console.warn(entity.typeId);\r\n\u00a0 \u00a0 \u00a0 \u00a0 /**\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0* @type {EntityEquippableComponent}\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0*/\r\n\u00a0 \u00a0 \u00a0 \u00a0 const equippable = entity.getComponent('minecraft:equippable');\r\n\u00a0 \u00a0 \u00a0 \u00a0 const slot = equippable.getEquipmentSlot(EquipmentSlot.Mainhand);\r\n\u00a0 \u00a0 \u00a0 \u00a0 console.warn(slot?.typeId ?? 'null');\r\n\u00a0 \u00a0 });\r\n});\r\n\r\n{code}\r\nFor a skeleton:\r\nExpected Results:\r\nlogs 'minecraft:bow'.\r\n\r\nObserved Results:\r\nthrows \r\nTypeError: cannot read property 'getEquipmentSlot' of undefined at <anonymous> (index4.js:42)\r\nat forEach (native)\r\nat <anonymous> (index4.js:44)\r\n{code:javascript}\r\n//line 42\r\nconst equippable = entity.getComponent('minecraft:equippable');\r\n{code}",
                  "to": null,
                  "toString": "*@minecraft/server 1.6.0-beta*\r\n{code:javascript}\r\nimport { EntityEquippableComponent, EquipmentSlot, system, world } from '@minecraft/server';\r\nsystem.runInterval(() => {\r\n    world.getAllPlayers().forEach(player => {\r\n        /**\r\n         * @type {EntityEquippableComponent}\r\n         */\r\n        const equippable = player.getComponent('minecraft:equippable');\r\n        const slot = equippable.getEquipmentSlot(EquipmentSlot.Offhand);\r\n        console.warn(slot?.typeId ?? 'null');\r\n    });\r\n});{code}\r\nExpected Results:\r\nlogs the type of the item in my offhand.\r\n\r\nObserved Results:\r\nthrows\u00a0\r\nTypeError: Unexpected type passed to function argument [0]. \u00a0 \u00a0at <anonymous> (index4.js:32)\r\nat forEach (native)\r\nat <anonymous> (index4.js:34)\r\ndoes the same for getEquipment\u00a0 and setEquipment and for \"Offhand\" or any of the others it throws a native conversion type error.\r\n\r\n{code:javascript}\r\n//line 34\r\nconst slot = equippable.getEquipmentSlot(EquipmentSlot.Offhand);\r\n{code}\r\n\r\nalso entity.getComponent(\"equippable\"); might not work on entities.\r\n{code:javascript}\r\nimport { EntityEquippableComponent, EquipmentSlot, system, world } from '@minecraft/server';\r\nworld.getDimension(MinecraftDimensionTypes.overworld).getEntities().forEach(entity => {\r\n\u00a0 \u00a0 \u00a0 \u00a0 if (entity.typeId !== 'minecraft:skeleton') return;\r\n\u00a0 \u00a0 \u00a0 \u00a0 console.warn(entity.typeId);\r\n\u00a0 \u00a0 \u00a0 \u00a0 /**\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0* @type {EntityEquippableComponent}\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0*/\r\n\u00a0 \u00a0 \u00a0 \u00a0 const equippable = entity.getComponent('minecraft:equippable');\r\n\u00a0 \u00a0 \u00a0 \u00a0 const slot = equippable.getEquipmentSlot(EquipmentSlot.Mainhand);\r\n\u00a0 \u00a0 \u00a0 \u00a0 console.warn(slot?.typeId ?? 'null');\r\n\u00a0 \u00a0 });\r\n});\r\n\r\n{code}\r\nFor a skeleton:\r\nExpected Results:\r\nlogs 'minecraft:bow'.\r\n\r\nObserved Results:\r\nthrows \r\nTypeError: cannot read property 'getEquipmentSlot' of undefined at <anonymous> (index4.js:42)\r\nat forEach (native)\r\nat <anonymous> (index4.js:44)\r\n{code:javascript}\r\n//line 42\r\nconst equippable = entity.getComponent('minecraft:equippable');\r\n{code}"
               }
            ]
         },
         {
            "id": "2857979",
            "author": "JIRAUSER465801",
            "created": "2023-08-25T19:46:29.528+0300",
            "items": [
               {
                  "field": "summary",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": "EntityEquippableComponent setEquipment, getEquipmentSlot and getEquipment  methods are broken",
                  "to": null,
                  "toString": "[Scripting] EntityEquippableComponent setEquipment, getEquipmentSlot and getEquipment  methods are broken"
               }
            ]
         },
         {
            "id": "2857980",
            "author": "JIRAUSER465801",
            "created": "2023-08-25T19:47:01.123+0300",
            "items": [
               {
                  "field": "summary",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": "[Scripting] EntityEquippableComponent setEquipment, getEquipmentSlot and getEquipment  methods are broken",
                  "to": null,
                  "toString": "[Scripting] EntityEquippableComponent and its methods: setEquipment, getEquipmentSlot and getEquipment are broken"
               }
            ]
         },
         {
            "id": "2858011",
            "author": "umija5895",
            "created": "2023-08-25T21:20:26.792+0300",
            "items": [
               {
                  "field": "Key",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": "MCPE-174596",
                  "to": null,
                  "toString": "BDS-18672"
               },
               {
                  "field": "Platform",
                  "fieldtype": "custom",
                  "from": "10901",
                  "fromString": "Windows",
                  "to": null,
                  "toString": ""
               },
               {
                  "field": "Version",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": null,
                  "to": "21608",
                  "toString": "1.20.15 Hotfix"
               },
               {
                  "field": "Version",
                  "fieldtype": "jira",
                  "from": "21614",
                  "fromString": "1.20.30.24 Preview",
                  "to": null,
                  "toString": null
               },
               {
                  "field": "Workflow",
                  "fieldtype": "jira",
                  "from": "714126",
                  "fromString": "MCPE Workflow",
                  "to": "714134",
                  "toString": "Global Mojang Workflow"
               },
               {
                  "field": "project",
                  "fieldtype": "jira",
                  "from": "10200",
                  "fromString": "Minecraft (Bedrock codebase)",
                  "to": "11700",
                  "toString": "Bedrock Dedicated Server"
               }
            ]
         },
         {
            "id": "2859653",
            "author": "JIRAUSER648376",
            "created": "2023-08-30T14:01:47.894+0300",
            "items": [
               {
                  "field": "resolution",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": null,
                  "to": "10001",
                  "toString": "Awaiting Response"
               },
               {
                  "field": "status",
                  "fieldtype": "jira",
                  "from": "1",
                  "fromString": "Open",
                  "to": "5",
                  "toString": "Resolved"
               }
            ]
         },
         {
            "id": "2994965",
            "author": "JIRAUSER484247",
            "created": "2024-05-14T18:51:46.190+0300",
            "items": [
               {
                  "field": "resolution",
                  "fieldtype": "jira",
                  "from": "10001",
                  "fromString": "Awaiting Response",
                  "to": null,
                  "toString": null
               },
               {
                  "field": "status",
                  "fieldtype": "jira",
                  "from": "5",
                  "fromString": "Resolved",
                  "to": "4",
                  "toString": "Reopened"
               }
            ]
         },
         {
            "id": "2995055",
            "author": "JIRAUSER484247",
            "created": "2024-05-14T19:14:08.255+0300",
            "items": [
               {
                  "field": "resolution",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": null,
                  "to": "4",
                  "toString": "Incomplete"
               },
               {
                  "field": "status",
                  "fieldtype": "jira",
                  "from": "4",
                  "fromString": "Reopened",
                  "to": "5",
                  "toString": "Resolved"
               }
            ]
         }
      ]
   }
}