microsoft / microsoft/minecraft-samples

Should the custom state strings need "as keyof BlockStateSuperset" adding

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
434
Forks
246
Avg merge
3d 1h
Merged PRs (30d)
1

Description

I tried buidling a few of these examples (whilst debugging my own script failure to build with custom state strings) as i switched from raw Javascript coding to using typescript.

I found that they failed (same as my own code):

https://github.com/microsoft/minecraft-samples/blob/1ba2c95d8cef20139dd13e8edfcd431fec4f442c/lucky_block/version_1/scripts/LuckyblockActions.ts#L16

I found help online and added "as keyof BlockStateSuperset" to the "getState" calls.

Should the examples be updated like this also?

ie.

if (e.block.permutation.getState("mike_luck:unlucky" as keyof BlockStateSuperset ) === true && Math.random() < 0.5) {

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 with lucky_block/version_1/scripts/LuckyblockActions.ts at line 16 and inspect the getState call using the custom state string. Build the affected examples to confirm whether the TypeScript error is reproducible, then update the relevant example calls if required and verify that those examples build successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.