Skip to content

Stopped Nuker overwriting the range setting every tick - #6639

Open
c8dhjp4tyv-bit wants to merge 2 commits into
MeteorDevelopment:masterfrom
c8dhjp4tyv-bit:fix/nuker-range-setting-overwrite
Open

Stopped Nuker overwriting the range setting every tick#6639
c8dhjp4tyv-bit wants to merge 2 commits into
MeteorDevelopment:masterfrom
c8dhjp4tyv-bit:fix/nuker-range-setting-overwrite

Conversation

@c8dhjp4tyv-bit

@c8dhjp4tyv-bit c8dhjp4tyv-bit commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Type of change

  • Bug fix
  • New feature

Description

Nuker.onTickPre() rounds the range setting by writing back to it:

if (shape.get() == Shape.UniformCube) range.set((double) Math.round(range.get()));

Two problems with doing this from the tick handler:

  • It mutates the user's config. A range of 4.4 typed into the slider is silently rewritten to 4.0 and saved that way, so switching the shape back to Sphere or Cube leaves the user with a value they never chose.
  • It runs 20 times a second for as long as Nuker is enabled. Setting#set has no equality check, so onChanged fires 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 for pos1/pos2. This drops the set() call and compares the chebyshev distance against r instead of range.get(), so the break shape is unchanged while the setting is left alone.

The BlockIterator.register() extents also had to move off the raw range. They are the reach of the shared iterator, and the uniform cube filter only accepts blocks within the rounded r, so a fractional range would have made the iterator walk a larger volume purely to throw the extra blocks away - 4.4 would 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 existing maxh/maxv, which keeps the iteration footprint identical to the old rounded behaviour.

Related issues

Closes #6609

How Has This Been Tested?

./gradlew compileJava passes.

With shape set to UniformCube and range 4, r is 4 both before and after the change, the iterator radii are 5/4 as 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:

  • My code follows the style guidelines of this project.
  • I have added comments to my code in more complex areas.
  • I have tested the code in both development and production environments.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nuker's "range" setting is silently overwritten every tick in Uniform Cube mode

1 participant