I frequently use the GameTest API for my addons, before the 1.20 update everything worked well but now the "projectileHit" after-event is giving me some issues. I am able to use all the properties of the event except the "projectile" one, in order to get the respective entity. If I try to access any property of the entity, such as "typeId", it will throw the error: "[Scripting][error]-Error: Failed to get property 'typeId' at <anonymous> (main.js:4)"
.
My addon uses this event and I can't launch it if this doesn't work.
Steps to Reproduce:
Step 1: create a simple addon that uses the "minecraft/server" module.
Step 2: create a script that contains the following code:
import { world } from "@minecraft/server"; world.afterEvents.projectileHit.subscribe(event => { const a = event.projectile.typeId; });
Step 3: add the addon to a world, enable the experiment "Beta APIs" and throw any projectile to a mob.
Observed Results:
The script throws the error "[Scripting][error]-Error: Failed to get property 'typeId' at <anonymous> (main.js:4)"
, therefore you can't get the projectile that triggered the event.
Expected Results:
The provided code should set the "a" variable to the typeId of the projectile, for example, "minecraft:arrow".
Screenshots/Videos:
https://i.imgur.com/GgCKdBy.mp4
Notes:
This issue also seems to affect other events where you can access a projectile. I tried debugging the code with VS Code but when I expand the projectile property in the "Variables" section it just keeps loading and doesn't show anything.
Comments 2
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.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki
Thank you for your report!
However, this issue has been temporarily closed as Awaiting Response.
Could you please attach an example addon showcasing the issue?
This ticket will automatically reopen when you reply.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki