#how I add a velocity/vector in custom block/stair
1 messages · Page 1 of 1 (latest)
how I add a velocity/vector in custom block/stair
This is my code
import { Block, Player, system, Vector, world } from "@minecraft/server"
world.afterEvents.blockPlace.subscribe((data) => {
system.run(() => {
const block = data.block
const player = data.player
if (block.typeId == "stair:custom_stairs") {
block.isWaterlogged = true
const first_coordinate = player.teleport({
x: player.location.x = -0.22,
y: player.location.y = 1,
z: player.location.z
});
const second_coordinate = player.teleport({
x: player.location.x,
y: player.location.y,
z: player.location.z = 1
});
if (player.location(${ first_coordinate })) {
player.runCommand(`tp ~-0.22 ~0.5 ~`)
}
if (player.location(${ second_coordinate })) {
player.runCommand(`tp ~ ~ ~1`)
}
}
})
})
Debug Result
There are 6 errors in this [code](#1132808859652718613 message):
[36m<repl>.js[0m:[33m19[0m:[33m18[0m - [31merror[0m[30m TS2349: [0mThis expression is not callable.
Type 'Vector3' has no call signatures.
[7m19[0m if (player.location(${ first_coordinate })) {
[7m [0m [31m ~~~~~~~~[0m
``````ansi
[36m<repl>.js[0m:[33m19[0m:[33m27[0m - [31merror[0m[30m TS2581: [0mCannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.
[7m19[0m if (player.location(${ first_coordinate })) {
[7m [0m [31m ~[0m
``````ansi
[36m<repl>.js[0m:[33m19[0m:[33m28[0m - [31merror[0m[30m TS1005: [0m',' expected.
[7m19[0m if (player.location(${ first_coordinate })) {
[7m [0m [31m ~[0m
``````ansi
[36m<repl>.js[0m:[33m22[0m:[33m18[0m - [31merror[0m[30m TS2349: [0mThis expression is not callable.
Type 'Vector3' has no call signatures.
[7m22[0m if (player.location(${ second_coordinate })) {
[7m [0m [31m ~~~~~~~~[0m
``````ansi
[36m<repl>.js[0m:[33m22[0m:[33m27[0m - [31merror[0m[30m TS2581: [0mCannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.
[7m22[0m if (player.location(${ second_coordinate })) {
[7m [0m [31m ~[0m
``````ansi
[36m<repl>.js[0m:[33m22[0m:[33m28[0m - [31merror[0m[30m TS1005: [0m',' expected.
[7m22[0m if (player.location(${ second_coordinate })) {
[7m [0m [31m ~[0m
Debug (Stable)
Help me to fix this script