Skip to content

fix default blockstate properties - #171

Closed
xu-shawn wants to merge 1 commit into
granny:chore/26.3from
xu-shawn:fix/26.3-default-blockstates
Closed

xu-shawn wants to merge 1 commit into
granny:chore/26.3from
xu-shawn:fix/26.3-default-blockstates

Conversation

@xu-shawn

@xu-shawn xu-shawn commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fix for 26.3, which no longer lists power for redstone_wire when it is at the default state, leading to the crash described in #168 (comment)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DereC4

DereC4 commented Oct 12, 2026

Copy link
Copy Markdown

nice one

@BillyGalbreath

Copy link
Copy Markdown
Contributor

Better fix is to simply clamp the value. The default value of -1 has actual meaning, which is "not supported" - if you just set it to 0 then it implies "this allows power, but doesnt currently have any" which is an improper default state for 99.9% of the blocks. Same goes for the other properties, age and moisture

Suggested fix:

    @Override
    public int getColorForPower(byte power) {
-        return RedStoneWireBlock.getColorForPower(power);
+        return RedStoneWireBlock.getColorForPower(Math.clamp(power, 0, 15));
    }

Repeat for fabric and forge, if they also don't clamp the value anymore.

@granny

granny commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Am definitely inclined to follow Billy's solve. Both solves would technically still be a workaround instead of an actual fix since blocks are no longer stored with their default blockstate if nothing is inherently set. Long-term fix would be to cache the default blockstates and use that

@granny

granny commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Superceded by 06655b5 (#168)

@granny granny closed this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants