DaFuqs / Spectrum

A full-feature minecraft mod about harnessing the powers of color
Other
102 stars 60 forks source link

[BUG] Midnight+water interaction in lazy-loaded chunks creates infinite fallingblock entities #351

Closed Robotgiggle closed 7 months ago

Robotgiggle commented 7 months ago

Describe the bug When midnight and water interact, they produce black materia. Unlike all the other products of fluid interactions, black materia is a gravity block. As such, if water flows over the top of a pool of midnight (or vice versa), it produces black materia blocks which immediately sink to the bottom of the pool, allowing more black materia to be generated until none of the bottom liquid remains under the top liquid.

If this interaction happens in a lazy-loaded chunk, a big problem occurs. The black materia generates at the top of the pool of liquid, and begins to fall since there is no solid block underneath it. When it falls, it turns into a fallingblock entity - but in lazy-loaded chunks, entities aren't processed. The fallingblock entity does not fall, and simply remains in stasis at the top of the liquid pool. Since there's no longer a solid block in the way, the water and midnight can interact again to produce another block of black materia, and the process repeats.

So long as the chunk remains lazy-loaded, frozen fallingblock entities will be continually generated at the surface of the liquid pool, eventually building up to cause massive lag on both the server and the client. If the chunk ever gets properly loaded while it contains all of the fallingblock entities, the lag gets even worse since the game starts fully processing them.

The only reasonable way to deal with the issue is to have a server admin use /kill to remove all of the fallingblock entities.

To Reproduce Explore the Deeper Down until a chunk containing midnight and flowing water (or vice versa) gets generated and is in your lazy-loading radius. Alternatively, manually create a setup to pour one fluid over the surface of the other, and activate it remotely after moving far enough away to lazy-load it. Once the fluids start interacting, just wait a minute or so and watch the F3 entity count increase endlessly.

Expected behavior Midnight and water interacting should not produce FPS-destroying quantities of fallingblock entities.

Mod version Version 1.7.6, on Fabric.

Screenshots F3 entity count while the issue is occurring image Server log from an admin killing all the entities image

DaFuqs commented 7 months ago

Fixed via https://github.com/DaFuqs/Spectrum/commit/289999a1865daab90de28d1fb39bf01ac0d96cbe