microsoft / microsoft/minecraft-scripting-samples

getBlock always returns undefined

Open
#296 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
241
Forks
48
Avg merge
17m
Merged PRs (30d)
1

Description

Hi, I have the following code:

`
import { world, system } from "@minecraft/server";

system.runTimeout(() => {
world.getDimension("overworld").runCommand("tickingarea add 96 0 80 111 255 95 myarea");
system.runTimeout(() => {
console.log(world.getDimension("overworld").getBlock({ x: 110, y: 100, z: 90 })?.permutation.type);
}, 20);
}, 100);
`

I'm aware that in order to run getBlock, the chunk has to be loaded first. I'm forcing that by adding a tickingarea at the block location, unfortunately getBlock still returns undefined. What could be the reason for that? Thank you.

Minecraft Server 1.21.73.01
"@minecraft/math": "^2.0.1"
"@minecraft/server": "^1.14.0"
"@minecraft/server-ui": "^1.3.0"
"@minecraft/vanilla-data": "^1.21.20"

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the code shown in the issue with @minecraft/server 1.14.0 on Minecraft Server 1.21.73.01, focusing on the nested system.runTimeout calls, tickingarea command, and getBlock lookup. Compare the observed undefined result with the documented behavior of these entry points; done means identifying a reproducible cause and documenting or verifying the required change.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.