Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

java.lang.IllegalArgumentException: bound must be positive


dagobertdu94
 Share

Recommended Posts

Quote

CountRangeConfig(5, 5, 20, 20)));

Those values are in order: count, bottomOffset, topOffset, and maximum

 

This call to nextInt must pass a value > 0:

int j = p_212852_1_.nextInt(p_212852_2_.maximum - p_212852_2_.topOffset) + p_212852_2_.bottomOffset;

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1 hour ago, dagobertdu94 said:

I have changed the values very often and now I don't know where the error could came from.

As a general debugging tip for situations like this in the future: you can comment out something like half of the calls to addFeature() at a time to try and isolate the issue. You've identified that the bug is in this file, and that you've been playing around with the parameters, so it logically follows that the issue is probably to do with one set of those parameters. My approach to isolating the bug would be to comment out like the first four ore types (ditium, minium, etc.) and see if the bug persists with the second half. If it does, I'd try to switch out the commented parts so that you'd keep the first four but not the later ones. The idea being that you significantly cut down the number of lines to check for errors that you need to look at manually. This won't always work (e.g. what if a line in the first set AND a line in the second set are both wrong), but the idea is that you try and make it easier on yourself to find out which one is the bad one.

 

Some general advice to newer coders who might stumble on this thread (not just directed at you, OP): compile often and try not to make too many changes in one go. Sometimes it's tough to deal with longer compile times so there is a balance to strike, but hopefully you're able to identify issues as soon as they come up.

 

Draco has pointed out line 24, which is a line that stands out to me even without knowing what the parameters are for: this line in particular when compared to the others has some repeated values. If you're just using a function call for something you didn't write yourself, it is often good to try and figure out what restrictions on the arguments exist, if any (particularly min, max, whether the second argument must be bigger than the first, etc.). Sometimes the code you're trying to use isn't commented well or documented, so you run into situations like this that can't be avoided. Repeated values, zeros as input, and other potentially noteworthy cases are something to keep in mind just in case of something like a subtraction forcing a zero or a divide by zero that may lead to a crash. Just being aware of things like this is a useful skill to have in your debugging toolkit.

Link to comment
Share on other sites

1 hour ago, Draco18s said:

Those values are in order: count, bottomOffset, topOffset, and maximum

 

This call to nextInt must pass a value > 0:

int j = p_212852_1_.nextInt(p_212852_2_.maximum - p_212852_2_.topOffset) + p_212852_2_.bottomOffset;

I changed that problematic line of code and know it works very well. Maybe the chunk loading is a little bit slow, but my mod has finally updated to 1.14.4. ?

I don't know what I have to change if I would want to update to 1.15.1... ?

Now I still have the problem that I cannot upload my mod to CurseForge, but that's another story, I think.

 

Thank you for your help!

2020-01-03_21.55.47.png

Edited by dagobertdu94
Writing mistake
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.