Repository navigation
Fix leaf persistent/check-decay flags being swapped - #2289
Open
zisunny104 wants to merge 2 commits into
Open
zisunny104 wants to merge 2 commits into
zisunny104 wants to merge 2 commits into
Conversation
BlockLeaves read and wrote persistent on 0x04 and check-decay on 0x08, the opposite of the block palette (persistent_bit = 0x08, update_bit = 0x04 for oak/spruce/birch/jungle/acacia/dark oak). Azalea, cherry and mangrove leaves cleared the update bit instead of the persistent bit in setPersistent(). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Member
|
The problem is what happens to already placed leaves after this change |
Author
|
我是因為發現地圖內由玩家放置的樹葉方塊建築開始消失,才發現一些方塊的狀態可能錯誤設置。 經過這樣的修正,手動放置的樹葉方塊就不會自然消失(錯誤狀態)了。 I discovered that some block states might have been set incorrectly after noticing that leaf block structures placed by players in the world were starting to disappear. With this fix, manually placed leaf blocks will no longer decay naturally due to incorrect block states. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BlockLeavesreads and writes the two decay-related flags on the wrong bits, so leaves that should be persistent decay, and player-placed leaves are not persistent.The bundled palette (
runtime_block_states.dat) maps the block states like this:So for the base leaves
persistentis0x08and the update/check-decay flag is0x04.BlockLeaveshad them the other way round:isPersistent()checked0x04,isCheckDecay()checked0x08, and both setters wrote the opposite bit. A leaf loaded aspersistent_bit=1(meta 8) therefore reportspersistent=false, checkDecay=trueand is removed by the next random tick when no log is nearby.place()callssetPersistent(true), which set0x04, i.e. the update bit, not the persistent bit.BlockAzaleaLeaves,BlockCherryLeavesandBlockLeavesMangrove,setPersistent()cleared bit 1 (~1, the update bit) instead of bit 2 (~2). It wiped the update flag and could not clear persistence.Changes
BlockLeaves:isPersistent/setPersistentuse0x08;isCheckDecay/setCheckDecayuse0x04.setPersistentclears~2so only the persistent bit changes. Flowering azalea inherits the fix.Testing
runtime_block_states.datand checked the getters/setters against them by reading the code. The other leaf types were not individually checked.🤖 Generated with Claude Code