Stopped Nuker overwriting the range setting every tick - #6639
Open
c8dhjp4tyv-bit wants to merge 2 commits into
Open
Stopped Nuker overwriting the range setting every tick#6639c8dhjp4tyv-bit wants to merge 2 commits into
c8dhjp4tyv-bit wants to merge 2 commits into
Conversation
Uniform cube rounded the range by calling range.set() from the tick handler, so a fractional range the user typed was silently rewritten in their config and the setting was mutated 20 times a second for as long as the module was on. Round into the local r that the shape already uses and compare the chebyshev distance against it instead.
Leaving the register() extents on the raw range made a fractional range iterate a larger volume than the chebyshev filter accepts, so the extra blocks were only fetched to be discarded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Nuker.onTickPre()rounds therangesetting by writing back to it:Two problems with doing this from the tick handler:
4.4typed into the slider is silently rewritten to4.0and saved that way, so switching the shape back to Sphere or Cube leaves the user with a value they never chose.Setting#sethas no equality check, soonChangedfires on every tick even when the value is already rounded, and the value fights the slider while it is being dragged.The rounded value is already computed three lines later as
int r, which the uniform cube branch uses forpos1/pos2. This drops theset()call and compares the chebyshev distance againstrinstead ofrange.get(), so the break shape is unchanged while the setting is left alone.The
BlockIterator.register()extents also had to move off the rawrange. They are the reach of the shared iterator, and the uniform cube filter only accepts blocks within the roundedr, so a fractional range would have made the iterator walk a larger volume purely to throw the extra blocks away -4.4would grow it from 11x11x9 to 13x13x11, and because the radii are shared, any other module registered that tick would have been dragged along. The extents are now computed per shape alongside the existingmaxh/maxv, which keeps the iteration footprint identical to the old rounded behaviour.Related issues
Closes #6609
How Has This Been Tested?
./gradlew compileJavapasses.With shape set to
UniformCubeand range4,ris4both before and after the change, the iterator radii are5/4as before, and the same blocks are selected. The visible difference is that a fractional range now stays in the settings screen instead of snapping on the next tick.Checklist: