sablewaves-2.29.0.jar
Curse Maven Snippet
What's new
2.29.0 — Stablewaves
no new features. three reported bugs, found and fixed. the beach foam one has an actual explanation at last.
the beach foam glitch — "large triangles and rectangles"
@user_r42totwbv5in0lwc reported this and it is the reason beach foam has been switched off by default. i said i couldn't work out what it was. i can now, and the reason it was so hard to find is that you were never looking at the bug.
the foam is drawn as quads i hand the graphics card a long list of corner points and it takes them four at a time to make each square. that only works if every square puts in all four of its corners.
the beach code put in one corner at a time, and only if that corner was bright enough to bother with. so a square whose four corners disagreed, which on a beach is nearly all of them, put in one, or two, or three.
and the moment that happens, everything is off by one forever after. the card keeps taking them four at a time, so now it's building squares out of one corner from here and three from somewhere else entirely. corners from opposite ends of the beach get joined into one shape. that's your enormous triangles.
i measured how bad: 92.8% of the foam squares were being built from more than one place. not an edge case. nearly all of them.
three things made it so hard to see:
- the mess appears nowhere near the cause. the foam fleck that broke the alignment looks fine. it's everything drawn afterwards that's wrong.
- that buffer is shared. beach foam, open-water foam, wet sand, current streaks and boat wakes all go in the same list. one bad beach square corrupts perfectly correct geometry drawn after it — which is why the glitch showed up on the water near the beach too, not just on sand.
- there's a line of code that looks like it handles this. before drawing, it rounds the count down to a multiple of four. that throws away a leftover corner at the very end — it does absolutely nothing about an alignment that broke ten thousand corners ago. i'd read that line before and moved on.
the fix is four lines, and the annoying part is that the open-water foam twenty lines further up has always done it correctly: four corners or none, giving a corner that wants no foam a transparent one instead of no corner at all. the beach just never got the same treatment.
there's now a test that tags every corner with the square it came from and checks that every group of four agrees. and it runs the old code too, to confirm it still catches it — a regression test that's never been seen to fail isn't proof of anything.
beach foam is still off by default in this build. turn it on and tell me. i can prove the maths is right but i can't see your beach from here, and that setting has had three separate bugs in its life. if it's clean for you, it goes back on by default next release.
the brick texture
@uwu_paradise — "for the latest versions the waves have a brick texture". yes. sorry.
minecraft packs every block texture into one big sheet, and asks that sheet "where is water?". i asked once, wrote down the answer, and used it forever.
but that sheet gets rebuilt whenever resources reload — pressing F3+T, switching resource packs, changing a graphics setting that touches mipmaps, or joining a server that sends its own pack. everything in it moves. my written-down coordinates then pointed at a rectangle that now held some completely different block, and the sea got painted with whatever had moved in.
for you, bricks. it could have been anything.
now it asks every frame. that's one lookup per frame, not per wave, which is nothing.
that also quietly fixed something else: the old code gave up permanently after five failed attempts. so if the texture sheet wasn't ready during a world's first few frames — exactly when it might not be — you got untextured water for the entire session with no way back but a restart.
waves inside your submarine
@LordOfTheFlies — "inside my Sub, it still tries to create waves visually under water". found it.
to decide where the sea surface is, i look down until i find water with air directly above it. that's a perfectly good rule on an actual ocean.
a flooded compartment in a submerged submarine is: water, then the air pocket above it, then your hull, then the entire ocean. it passes the rule exactly. so i drew you an ocean surface in your engine room.
one extra check sorts it out, and i like this one: nothing above the real sea is sea. so if there's still ocean eight blocks overhead, what i'm looking at is under the sea rather than being it. skip it.
piers and docks are unaffected, which is the bit i cared about getting right — the air above a jetty's deck is air, so jetties still get their waves.
things i checked that turned out to be fine
listing these because i spent real time on them and wrote them down so i don't chase them twice:
- an array index in the beach code that looked dangerously unchecked next to the equivalent water code, which checks everything. it's exactly in bounds — the grid is deliberately one wider than it needs to be, for precisely that reason. past me left that margin on purpose.
- a path that looked like it could put a corner at an impossible coordinate, which would also have made giant triangles. can't happen: a column is either water or land, never both, and the land-only path is already filtered out before it gets there.
- a message that says "wave overlay disabled for this session" which i was sure was lying, because i couldn't see anything disabling it. it isn't lying. it does.
random boring stuff
one class changed. nothing added, nothing removed, 122 of the 125 things in the jar untouched, no public anything altered — checked by comparing against the previous jar rather than by trusting my memory.
213 checks across six test files now, plus the two that scan the finished jar.
one oddity i found while looking: there's a whirlpool maths file sitting in the mod from months ago that nothing uses, with exactly the same numbers as the real maelstroms. i built those additively from the compiled jar back when my source was lost, and reinvented a file i'd already written without ever noticing it was there. harmless, but it's written down now so the next person to go looking for maelstrom code doesn't read the wrong one. that person is going to be me.
still open, and i'd rather name them than pretend:
@Shatterstack — the ragdoll fps thing. wake spray already has a per-tick cap so it isn't that, and i'm not shipping a guess with your name on it. roughly how many entities, and is it worse near shore than out at sea?
@user_72sjfa069ex94zrz — physics mod pro. your diagnosis is better than anything i'd have come up with: forces purely vertical, no real currents, and our wave directions fighting each other. that last part is fixable — it's the same problem as getting waves and boats to agree on which way the sea is going, which i've already solved once. not in this release, but it's a real one.
@LordOfTheFlies — underwater currents already exist, and you can craft a current locator to see them. that was the half of your question i answered badly the first time.
This mod has no additional files

