Skip to content

Configurable Turtle egg hatch time #815

Closed Locked Answered by BillyGalbreath
EuanM199 asked this question in __Completed__
Discussion options

You must be logged in to vote

This isn't really as straight forward as you'd might think. It's completely random when the eggs receive a random block tick, and when they do there are quite a few checks done to see if anything will even happen during this tick.

See the wiki for human-readable explanation: https://minecraft.fandom.com/wiki/Turtle_Egg#Hatching

In code, this looks like this:

    private boolean shouldUpdateHatchLevel(Level world) {
        float f = world.getTimeOfDay(1.0F);
        return (double) f < 0.69D && (double) f > 0.65D ? true : world.random.nextInt(500) == 0;
    }

Now, exposing that time of day would be pretty weird for non technical people, so I'm not going to do that. However, that 1/500 cha…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@BillyGalbreath
Comment options

Answer selected by granny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants