sk7725 / BetaMindy

A java mod of Mindustry, made for testing and doing chaotic fun.
GNU General Public License v3.0
330 stars 70 forks source link

stack overflow error (omg programming reference?!?) #173

Closed TheGamer1002 closed 1 year ago

TheGamer1002 commented 1 year ago

Platform: macOS 13 Ventura (yeah i know)

Build: 141.3

Mod Version: 1.09

Issue: literally just crashes (foregoing the error template because i know code [hopefully])

Mindustry has crashed. How unfortunate.
Version: release build 141.3
OS: Mac OS X x64 (x86_64)
Java Version: 1.8.0_361
Runtime Available Memory: 1820mb
Cores: 4
Mods: adc:15.0, betamindy:1.09, cyber-io:5.1, exogenesis:[blue]1.9.1, fooinstaller:1.2.4, informatis:1.7, me:2.1, new-horizon:0.2.7, ol:0.6f, pictologic:1.6.0, prog-mats:26.6, revision:13.3, rtfm:3.15.1, schematics-pack:9, scheme-size:2.7.34, shar:0.2v, time-control:0.2, uaw:v0.8.3, unity:0.2-youngcha.3.3, ui-lib:4.18.0

java.lang.RuntimeException: Error loading mod betamindy
    at mindustry.mod.Mods.contextRun(Mods.java:773)
    at mindustry.mod.Mods.lambda$eachClass$30(Mods.java:761)
    at arc.struct.Seq.each(Seq.java:182)
    at mindustry.mod.Mods.eachClass(Mods.java:761)
    at mindustry.ClientLauncher.update(ClientLauncher.java:215)
    at arc.backend.sdl.SdlApplication.listen(SdlApplication.java:204)
    at arc.backend.sdl.SdlApplication.loop(SdlApplication.java:192)
    at arc.backend.sdl.SdlApplication.<init>(SdlApplication.java:54)
    at mindustry.desktop.DesktopLauncher.main(DesktopLauncher.java:39)
Caused by: java.lang.StackOverflowError
    at betamindy.util.UnitLib.calcCost(UnitLib.java:66)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
    at betamindy.util.UnitLib.calcCost(UnitLib.java:71)

this goes on for a while uh like hundreds of lines

this is the line in question


Place an X (no spaces) between the brackets to confirm that you have read the line below.


The original template is by Anuke, modified by sk7725.

TheGamer1002 commented 1 year ago

the line references itself what the heck

public static ItemStack[] calcCost(UnitType u){
...
for(Reconstructor b : recons){
...
if(r != null){
ItemStack[] cost = calcCost(r[0]);
...
}
...
}

so like

TheGamer1002 commented 1 year ago

might add this was on startup of the game

TheGamer1002 commented 1 year ago

am i just using the wrong version of java

TheGamer1002 commented 1 year ago

the code is 18 months old what

TheGamer1002 commented 1 year ago

so i think a different mod is doing this but its still probably not good practice to call something inside itself

TheGamer1002 commented 1 year ago

okay this happens in other places #166

Weathercold commented 1 year ago

so i think a different mod is doing this but its still probably not good practice to call something inside itself

recursion is good practice people hated recursion because they hate concepts they don't understand

Slotterleet commented 1 year ago

recursive methods are pretty good as long as you know what you're doing

TheGamer1002 commented 1 year ago

i mean yeah, that sounds about right. i dont know what im doing. but like shouldnt there be a thing to prevent the recursiveness? because i dont know how but a different mod somehow interfaced with this mod

TheGamer1002 commented 1 year ago

im just gonna close this because im stupid and opened this issue on 3 hours of sleep