Make flowers and DoublePlants break like vanilla#2247
Merged
PetteriM1 merged 3 commits intoCloudburstMC:masterfrom Nov 20, 2025
Merged
Make flowers and DoublePlants break like vanilla#2247PetteriM1 merged 3 commits intoCloudburstMC:masterfrom
PetteriM1 merged 3 commits intoCloudburstMC:masterfrom
Conversation
In vanilla, shears should consume durability.
- Fix issue where items didn't drop when breaking the top part of tall grass - Fix issue where particle effects were only played for the top/bottom parts when breaking tall grass - Overridden getToolType() and breakWhenPushed()
xRookieFight
suggested changes
Nov 15, 2025
Contributor
xRookieFight
left a comment
There was a problem hiding this comment.
This empty if statement isn't well
Contributor
Author
|
@xRookieFight This is the optimal code I can think of is this: @Override
public boolean useOn(Block block) {
if (this.noDamageOnBreak() || this.isUnbreakable() || this.isDurable()) {
return true;
}
if (block.getToolType() == ItemTool.TYPE_PICKAXE && this.isPickaxe() ||
block.getToolType() == ItemTool.TYPE_SHOVEL && this.isShovel() ||
block.getToolType() == ItemTool.TYPE_AXE && this.isAxe() ||
block.getToolType() == ItemTool.TYPE_HOE && this.isHoe() ||
block.getToolType() == ItemTool.TYPE_SWORD && this.isSword() ||
block.getToolType() == ItemTool.TYPE_SHEARS && this.isShears()
) {
this.meta++;
return true;
}
if (this.isSword() && block.getHardness() > 0) {
this.meta += 2;
return true;
}
if (this.isHoe() && ((block.getId() == GRASS || block.getId() == DIRT))) {
this.meta++;
return true;
}
if (block.getId() == TALL_GRASS || block.getId() == FLOWER || block.getId() == DOUBLE_PLANT) {
return true;
}
this.meta++;
return true;
}Or int damage = 0;
...
this.meta += damage;
return true; |
Contributor
Author
|
ahh, I didn't mean to rush you, sorry :/ |
Contributor
|
No worries 😄, the first one is more optimized for me. You can commit that |
- In vanilla, blocks of grass and flowers do not affect the durability of tools other than shears I have no idea how to add new code while maintaining the existing code style
Contributor
Author
|
I hope I performed the push correctly |
xRookieFight
approved these changes
Nov 15, 2025
| if (block.getId() == GRASS || block.getId() == DIRT) { | ||
| this.meta++; | ||
| } | ||
| } else if (block.getId() == TALL_GRASS || block.getId() == FLOWER || block.getId() == DOUBLE_PLANT) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
PetteriM1
approved these changes
Nov 20, 2025
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.
In vanilla, shears should consume durability when breaking grass and flowers; otherwise, they should not.
So,