-
Bug
-
Resolution: Incomplete
-
None
-
1.19.21 Hotfix
-
None
-
Unconfirmed
-
Windows
Forgive me please for my english![]()
Description:
When the setVelocity method is invoked on a Player instance or a Entity instance with the property id set to "minecraft:player", the client's entity does not receive the velocity change.
Steps to Reproduce:
- In a Gametest Script/Plugin insert the following code. (Javascript)
import { world, Vector } from 'mojang-minecraft' /* This is importing the world object and the Vector class from the mojang-minecraft module. */ function beforeItemUse(e) { /* This function will be used as a callback that will be subscribed on the world.events.beforeItemUse event using the world.events.beforeItemUse.subscribe method passing the callback function (beforeItemUse). The argument `e` present in the callback function (beforeItemUse) is the event data of that item use event.*/ /* Check if the source entity is actually a player. If its not the we will return. */ if (e.source.id !== 'minecraft:player') return /* e.item.id is the identifier for the event's item. */ /* Check if event item's ID is `minecraft:iron_ingot`. If its not then we will return.*/ if (e.item.id !== 'minecraft:iron_ingot') return /* e.item.id is the identifier for the event's item. */ /* Now we know that the ID of the event item is `minecraft:iron_ingot` we will get a Vector with the values (0, 1, 0). Actually, instead of creating the Vector, Minecraft has already added these handy values to make our lives easier! So to get this Vector we can access the static attribute Vector.up which will yield us a Vector with the values? You guessed it! (0, 1, 0) */ let up = Vector.up /* Alright, now lets move on to the code that this bug report is all about! */ e.source.setVelocity(up) /* I probably bet that this line of code that we wrote there will be NEVER visble in your screen but your friends might be able to see you zooming around! */ } world.events.beforeItemUse.subscribe(beforeItemUse) /* This subscribes the beforeItemUse function to the beforeItemUse event handlers. */
- Press Use Item/Place Block while holding a iron ingot in your hand (as a player) to fire the event!
Observed Results:
The client-side Player's velocity is not being updated.
Expected Results:
The client-side Player's velocity should be set to a Vector with x zero, y one and z zero.