Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for block replacement #193

Merged
merged 1 commit into from
Jun 27, 2024
Merged

Conversation

meyfa
Copy link
Owner

@meyfa meyfa commented Jun 27, 2024

When the player right-clicks with a block in hand, the position where this block should be placed is subject to a condition: If the block currently at the click position is considered "replaceable", the new block should be placed right there. Otherwise, it should be placed next to the clicked position (depending on which side of the block was clicked).

Before this patch, the code didn't take this into account - always placing the new block adjacent to the clicked position. Now, this is handled for the following replaceable block types:

  • air (all three kinds)
  • liquids (water, lava)
  • tall grass

There may be further kinds of replaceable blocks in the game; these can be added in the future via an extendable callback mechanism.

When the player right-clicks with a block in hand, the position where
this block should be placed is subject to a condition: If the block
currently at the click position is considered "replaceable", the new
block should be placed right there. Otherwise, it should be placed next
to the clicked position (depending on which side of the block was
clicked).

Before this patch, the code didn't take this into account - always
placing the new block adjacent to the clicked position. Now, this is
handled for the following replaceable block types:

- air (all three kinds)
- liquids (water, lava)
- tall grass

There may be further kinds of replaceable blocks in the game; these
can be added in the future via an extendable callback mechanism.
@meyfa meyfa merged commit 4d233d4 into main Jun 27, 2024
2 checks passed
@meyfa meyfa deleted the feat/replaceable-blocks branch June 27, 2024 15:12
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.

1 participant