Skip to content

Add check for max growth age special case#1652

Merged
granny merged 1 commit into
PurpurMC:ver/1.21.4from
Dreeam-qwq:fix/max-growth-age
Apr 12, 2025
Merged

Add check for max growth age special case#1652
granny merged 1 commit into
PurpurMC:ver/1.21.4from
Dreeam-qwq:fix/max-growth-age

Conversation

@Dreeam-qwq

@Dreeam-qwq Dreeam-qwq commented Apr 12, 2025

Copy link
Copy Markdown
Contributor

If set settings.blocks.xxx.max-growth-age to 0, the server will crash when loaded the world (ticking fluid), since there is a random.nextInt(bound) in GrowingPlantHeadBlock#getStateForPlacement, the bound should be a int > 0, and the random range is 0 (inclusive) to bound (exclusive).

So just add a check for this special case, directly use 0, instead of calling nextInt
2025-04-12 15 24 02

Based on the minecraft wiki, the vanilla growth age range for Twisting Vines, Kelp, etc, are 0~25, so I think no need to check cases of <0, just assume the user will set a value between 0 and 25 in purpur config


Crash stacktrace
image

@granny granny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks :)

@granny granny merged commit 96f0ee1 into PurpurMC:ver/1.21.4 Apr 12, 2025
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