Skip to content

fix block state meta when no id nbt key is present#10032

Closed
Machine-Maker wants to merge 1 commit into
PaperMC:masterfrom
Machine-Maker:fix/block-state-meta
Closed

fix block state meta when no id nbt key is present#10032
Machine-Maker wants to merge 1 commit into
PaperMC:masterfrom
Machine-Maker:fix/block-state-meta

Conversation

@Machine-Maker
Copy link
Copy Markdown
Member

It is valid in vanilla to have a blockentitytag for an itemstack that does not have an id key specifying the type of block entity. This doesn't matter when placing the block because the block type determines the tile entity type, not the ID read from the nbt tag compound. Previously, CraftMetaBlockState expected the id tag except for 2 or 3 exceptions where it was manually added. Not sure why those were singled out, but now this adds a type override based on the specific material.

You can test this bug with an item like
minecraft:chest{BlockEntityTag: {Items: [{Slot: 0b, Count: 1b, id: "minecraft:stone"}]}} which is a chest that contains a stone block. It works when placed, but if you call getBlockState on the meta of the stack, you will get an empty chest.

@Machine-Maker Machine-Maker requested a review from a team as a code owner December 13, 2023 05:02
@Machine-Maker Machine-Maker force-pushed the fix/block-state-meta branch 2 times, most recently from 1eb2cc5 to c9f1a9b Compare May 28, 2024 22:52
@Machine-Maker
Copy link
Copy Markdown
Member Author

No longer makes sense with recent blockstatemeta changes

@Machine-Maker Machine-Maker deleted the fix/block-state-meta branch May 29, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

2 participants