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

Feature: Implement time since last block change to support "Minimum existence time before erosion" #13

Open
13rac1 opened this issue Feb 24, 2020 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@13rac1
Copy link
Owner

13rac1 commented Feb 24, 2020

From #12 (comment)

What if water had exist at a specific block position for a minimum period of time before it would erode? I could create a "Minimum existence time before erosion" check by adding a timestamp of last block change.

randomTick() is called on all water blocks, this can result in erosion occurring moments after water flows in an area. This is unrealistic because the erosion process needs time to start soaking the soil/sand before any erosion occurs. Erosion should not occur turn the first X minutes/hours? of a water block's existence.

Gameplay benefit: This enables water-based automatic farms to not erode the farmland soil. Quick flows will just "wash" over the land and never erode anything.

@13rac1
Copy link
Owner Author

13rac1 commented Mar 27, 2020

I've been thinking about how to best implement this. BlockStates can store the numbers 0 to 15, which isn't enough resolution in this case.

Sadly, abstractions are lies at their core. We still have the responsibility of translating every IBlockState back into a number between 0 and 15 inclusive that will be stored in the world and vice versa for loading.

First idea is an LRU Cache of the last X water blocks updated. Java LRU implementation. Mixin injection into World.setBlockState() to update the timestamps might be enough. Or perhaps the BlockState for a position can be checked to be the same and the timer starts at first randomTick().

@13rac1 13rac1 pinned this issue Apr 5, 2020
@13rac1 13rac1 added this to the 1.3.0 milestone Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant