#Native Type Conversion Failed

1 messages · Page 1 of 1 (latest)

honest elbow
#

Whenever I try to use a player / entity / block's coordinate, it throws this error.

#

code:

import * as server from "@minecraft/server"
export function skywars() {
    server.world.events.blockBreak.subscribe((data) => {
        let blockLoc = data.block.location
        data.block.dimension.fillBlocks(blockLoc, blockLoc, { canBeWaterlogged: false, id: "minecraft:diamond_block" })
    })
}
// ignore the func name
#

error:

pine snow
#

Use new BlockLocation()

#
import * as server from "@minecraft/server"
export function skywars() {
    server.world.events.blockBreak.subscribe((data) => {
        let blockLoc = data.block.location
        data.block.dimension.fillBlocks(new server.BlockLocation(blockLoc.x, blockLoc.y, blockLoc.z), new server.BlockLocation(blockLoc.x, blockLoc.y, blockLoc.z), { canBeWaterlogged: false, id: "minecraft:diamond_block" })
    })
}
// ignore the func name
honest elbow
#

alright, tysmm

#

still the same error however

#

oh wait

pine snow
#

You missing one argument

honest elbow
#

yeajh still the same :((

#

what arg is it?

pine snow
#

What block you want to fill?

#

You didn't specify that

honest elbow
#

like, block to put or block to rpelace?

pine snow
#

Block to put

honest elbow
#

wait can you give me an example of that

pine snow
#
import * as server from "@minecraft/server"
export function skywars() {
    server.world.events.blockBreak.subscribe((data) => {
    let blockLoc = data.block.location
    data.block.dimension.fillBlocks(
      new server.BlockLocation(
        blockLoc.x,
        blockLoc.y,
        blockLoc.z
      ),
      new server.BlockLocation(
        blockLoc.x,
        blockLoc.y,
        blockLoc.z
      ),
      server.MinecraftBlockTypes.get("stone"),
      {
        canBeWaterlogged: false,
        id: "minecraft:diamond_block"
      }
    )
  })
}
// ignore the func name
honest elbow
#

ohhhh

#

thank you smmm

pine snow
#

Your welcome

honest elbow
#

weird

#

it still has the same issue

#
import * as server from "@minecraft/server"
export function skywars() {
    server.world.events.blockBreak.subscribe((data) => {
        let blockLoc = new server.BlockLocation(data.block.location.x, data.block.location.y, data.block.location.z)
        data.block.dimension.fillBlocks(blockLoc, blockLoc, server.MinecraftBlockTypes.get("stone"), { canBeWaterlogged: false, id: "minecraft:bedrock" })
    })
}
#

@pine snow

pine snow
#

Do you reload the pack?

honest elbow
#

yep of course

quiet jettyBOT
#
Debug Result

There are errors in this [code](#1084494089875099690 message):

<repl>.js:5:104 - error TS2345: Argument of type '{ canBeWaterlogged: boolean; id: string; }' is not assignable to parameter of type 'BlockFillOptions'.
  Object literal may only specify known properties, and 'canBeWaterlogged' does not exist in type 'BlockFillOptions'.

5         data.block.dimension.fillBlocks(blockLoc, blockLoc, server.MinecraftBlockTypes.get("stone"), { canBeWaterlogged: false, id: "minecraft:bedrock" })
                                                                                                         ~~~~~~~~~~~~~~~~~~~~~~~

pine snow
#

Oh

#
import * as server from "@minecraft/server"
export function skywars() {
    server.world.events.blockBreak.subscribe((data) => {
    let blockLoc = new server.BlockLocation(
      blockLoc.x,
      blockLoc.y,
      blockLoc.z
    ),

    data.block.dimension.fillBlocks(
      blockLoc,
      blockLoc,
      server.MinecraftBlockTypes.get("stone")
    )
  })
}
// ignore the func name
honest elbow
#

I don't want it to replace the diamond block though

pine snow
#

Then, you can delete it

honest elbow
#

I did, yet it's still throwing the Native Type Conversion Failed error

quiet jettyBOT
#
Debug Result

There are errors in this [code](#1084494089875099690 message):

<repl>.js:3:47 - error TS2300: Duplicate identifier 'data'.

3     server.world.events.blockBreak.subscribe((data) => {
                                                ~~~~
<repl>.js:5:7 - error TS2448: Block-scoped variable 'blockLoc' used before its declaration.

5       blockLoc.x,
        ~~~~~~~~

  <repl>.js:4:9
    4     let blockLoc = new server.BlockLocation(
              ~~~~~~~~
    'blockLoc' is declared here.
<repl>.js:6:7 - error TS2448: Block-scoped variable 'blockLoc' used before its declaration.

6       blockLoc.y,
        ~~~~~~~~

  <repl>.js:4:9
    4     let blockLoc = new server.BlockLocation(
              ~~~~~~~~
    'blockLoc' is declared here.
<repl>.js:7:7 - error TS2448: Block-scoped variable 'blockLoc' used before its declaration.

7       blockLoc.z
        ~~~~~~~~

  <repl>.js:4:9
    4     let blockLoc = new server.BlockLocation(
              ~~~~~~~~
    'blockLoc' is declared here.
<repl>.js:10:5 - error TS2300: Duplicate identifier 'data'.

10     data.block.dimension.fillBlocks(
       ~~~~
<repl>.js:10:9 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
           ~
<repl>.js:10:15 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                 ~
<repl>.js:10:25 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                           ~
<repl>.js:10:36 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                                      ~
<repl>.js:11:7 - error TS2695: Left side of comma operator is unused and has no side effects.

11       blockLoc,
         ~~~~~~~~
<repl>.js:11:7 - error TS2695: Left side of comma operator is unused and has no side effects.

11       blockLoc,
         ~~~~~~~~~
12       blockLoc,
   ~~~~~~~~~~~~~~

honest elbow
#
import * as server from "@minecraft/server"
export function skywars() {
    server.world.events.blockBreak.subscribe((data) => {
        let blockLoc = new server.BlockLocation(data.block.location.x, data.block.location.y, data.block.location.z)
        data.block.dimension.fillBlocks(new server.BlockLocation(data.block.location.x, data.block.location.y, data.block.location.z), new server.BlockLocation(data.block.location.x, data.block.location.y, data.block.location.z), server.MinecraftBlockTypes.get("stone"))
    })
}
quiet jettyBOT
#
No errors

No errors in [code](#1084494089875099690 message)

honest elbow
#

weird

#

oh it's new

pine snow
#

Oops, my code use blockLoc.x inside blockLoc

honest elbow
#

Native variant type conversion failed

pine snow
#

Try use your code

honest elbow
#

I did

#

it's not working either

pine snow
#
import * as server from "@minecraft/server"
export function skywars() {
    server.world.events.blockBreak.subscribe((data) => {
    let blockLoc = new server.BlockLocation(
      data.block.location.x,
      data.block.location.y,
      data.block.location.z
    )

    data.block.dimension.fillBlocks(
      blockLoc,
      blockLoc,
      server.MinecraftBlockTypes.get("stone")
    )
  })
}
// ignore the func name
honest elbow
#

yeah that's the same as my code

pine snow
#

Do I missing something?

honest elbow
#

nope

#

idk what's wrong

quiet jettyBOT
#
Debug Result

There are errors in this [code](#1084494089875099690 message):

<repl>.js:3:47 - error TS2300: Duplicate identifier 'data'.

3     server.world.events.blockBreak.subscribe((data) => {
                                                ~~~~
<repl>.js:10:5 - error TS2300: Duplicate identifier 'data'.

10     data.block.dimension.fillBlocks(
       ~~~~
<repl>.js:10:9 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
           ~
<repl>.js:10:15 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                 ~
<repl>.js:10:25 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                           ~
<repl>.js:10:36 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                                      ~
<repl>.js:11:7 - error TS2695: Left side of comma operator is unused and has no side effects.

11       blockLoc,
         ~~~~~~~~
<repl>.js:11:7 - error TS2695: Left side of comma operator is unused and has no side effects.

11       blockLoc,
         ~~~~~~~~~
12       blockLoc,
   ~~~~~~~~~~~~~~

#
Debug Result

There are errors in this [code](#1084494089875099690 message):

<repl>.js:3:47 - error TS2300: Duplicate identifier 'data'.

3     server.world.events.blockBreak.subscribe((data) => {
                                                ~~~~
<repl>.js:10:5 - error TS2300: Duplicate identifier 'data'.

10     data.block.dimension.fillBlocks(
       ~~~~
<repl>.js:10:9 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
           ~
<repl>.js:10:15 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                 ~
<repl>.js:10:25 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                           ~
<repl>.js:10:36 - error TS1005: ',' expected.

10     data.block.dimension.fillBlocks(
                                      ~
<repl>.js:11:7 - error TS2695: Left side of comma operator is unused and has no side effects.

11       blockLoc,
         ~~~~~~~~
<repl>.js:11:7 - error TS2695: Left side of comma operator is unused and has no side effects.

11       blockLoc,
         ~~~~~~~~~
12       blockLoc,
   ~~~~~~~~~~~~~~

pine snow
#

Oh lol

honest elbow
#

alrihgt wait

#

still nope

#

I think I'll just use a diff solution

#

ty for your help

quiet jettyBOT
#
No errors

No errors in [code](#1084494089875099690 message)

pine snow
#

Weird

daring rock
#
import * as server from "@minecraft/server"
export function skywars() {
    server.world.events.blockBreak.subscribe((data) => {
        const { block:{ location: blockLoc } , dimension } = data
        dimension.setBlock(blockLoc, server.MinecraftBlockTypes.get("stone"))
    })
}
``` @honest elbow
honest elbow
#

ohh

#

thank youu