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

Add Keys.MAX_GROWTH_STAGE #4009

Merged
merged 7 commits into from
Jun 2, 2024
Merged

Conversation

MrHell228
Copy link
Contributor

I removed Keys.GROWTH_STAGE from saplings because it used STAGE property instead of AGE properties.
And those 2 has to be differed because there is BambooStalkBlock that use both STAGE and AGE properties.
So I think it would be better to keep only age-related blocks in this key.

@aromaa
Copy link
Member

aromaa commented Jun 2, 2024

Saplings should still implement the Keys.GROWTH_STAGE. While the underlying property is STAGE, its still used for growth unlike where for bamboo its used to to limit growth.

@MrHell228
Copy link
Contributor Author

Makes sense, done

Copy link
Member

@aromaa aromaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't actually working because the supports condition is wrong. Otherwise LGTM. Nice simplification too :)

.constructValue((h, v) -> BoundedUtil.constructImmutableValueInteger(v, Keys.GROWTH_STAGE, propertyFunction.apply(h)))
.get(h -> h.getValue(propertyFunction.apply(h)))
.set((h, v) -> BoundedUtil.setInteger(h, v, propertyFunction.apply(h)))
.supports(cropClass::isInstance)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.supports(cropClass::isInstance)
.supports(h -> cropClass.isInstance(h.getBlock()))

.supports(cropClass::isInstance)
.create(Keys.MAX_GROWTH_STAGE)
.get(h -> DataUtil.maxi(propertyFunction.apply(h)))
.supports(cropClass::isInstance);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.supports(cropClass::isInstance);
.supports(h -> cropClass.isInstance(h.getBlock()));

@MrHell228
Copy link
Contributor Author

Oh I think I did wrong thing by making new commit instead of using "commit suggestion" button and now I can't press it.

Copy link
Member

@aromaa aromaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, doesn't really matter which way you do it. Thank you :)

@aromaa aromaa merged commit 344338a into SpongePowered:api-11 Jun 2, 2024
5 checks passed
@MrHell228 MrHell228 deleted the api-11-cropkey branch June 4, 2024 21:48
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.

2 participants