Tweak mode not working with OpenSimplexNoise.java

Hello,

For me Processing’s Tweak Mode doesn’t seem to work together with Kurt Spencer’s OpenSimplex noise class. Whenever I use the Shift+Command+T key-combination to enter Tweak Mode I get the following error:

java.lang.NumberFormatException: For input string: "6364136223846793005"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.base/java.lang.Integer.parseInt(Integer.java:652)
	at java.base/java.lang.Integer.parseInt(Integer.java:770)
	at processing.mode.java.tweak.Handle.<init>(Handle.java:77)
	at processing.mode.java.tweak.SketchParser.addAllDecimalNumbers(SketchParser.java:198)
	at processing.mode.java.tweak.SketchParser.addAllNumbers(SketchParser.java:100)
	at processing.mode.java.tweak.SketchParser.<init>(SketchParser.java:82)
	at processing.mode.java.JavaMode.handleTweak(JavaMode.java:148)
	at processing.mode.java.JavaEditor.lambda$handleLaunch$27(JavaEditor.java:1021)
	at java.base/java.lang.Thread.run(Thread.java:829)

This refers to the 65th line of code in this noise class, which reads:

      seed = seed * 6364136223846793005L + 1442695040888963407L;

I’m confused why the error I get is a NumberFormatException, or how Tweak Mode and this numerical value in the seed calculation have anything to do with each other in the first place. Is it because the noise class has the .java extension?

Is this a problem which could likely be circumvented someway? Has anybody else run into this?
Any help would be much appreciated!

You’ve discovered a limitation (one could go as far to say a bug) with tweak mode.

Tweak mode is treating all non-decimal numbers as integers, but the value here is a long datatype (it far exceeds the largest possible integer size: 2147483647), hence a NumberFormatException when the code attempts to parse the large long value as an integer.

Modify those values to make them smaller than 2147483647 and that should fix things.

2 Likes

Were you using Processing 3? This seems to be fixed in Processing 4.

Oh! Really? Which version of Processing did you use where it worked? I tested it with version 4.0b1 initially, and in the most recent version (4.0b8) the issue still persists.