ore-veins icon indicating copy to clipboard operation
ore-veins copied to clipboard

Memory Corruption Bug

Open Speiger opened this issue 3 years ago • 4 comments

https://github.com/alcatrazEscapee/ore-veins/blob/1.15.x/src/main/java/com/alcatrazescapee/oreveins/world/VeinsFeature.java#L35

This random needs not to stay inside of the class have a unique random per function call. Because the code is actually executed in a "Multithreaded" manner. Multiple Chunks could call this function at the exact same time, meaning if they do that you corrupt your random and get really really really really bad results.

Speiger avatar Mar 23 '21 01:03 Speiger

Heya,

Do you think replacing it with ThreadLocalRandom is a good enough solution?

cosmicdan avatar Jun 05 '21 11:06 cosmicdan

Hey,

Just use the random provided by the worldgenerator. You can even reset it yourself if you want to. But its already initialized with the seed. https://github.com/alcatrazEscapee/ore-veins/blob/1.15.x/src/main/java/com/alcatrazescapee/oreveins/world/VeinsFeature.java#L77 (Random Argument)

Speiger avatar Jun 05 '21 12:06 Speiger

Yeah I noticed that just now, haha (porting to 1.16.5). No need for the field at all.

⁣Get BlueMail for Android ​

On 5 Jun 2021, 22:54, at 22:54, Speiger @.***> wrote:

Hey,

Just use the random provided by the worldgenerator. You can even reset it yourself if you want to. But its already initialized with the seed. https://github.com/alcatrazEscapee/ore-veins/blob/1.15.x/src/main/java/com/alcatrazescapee/oreveins/world/VeinsFeature.java#L77 (Random Argument)

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/alcatrazEscapee/ore-veins/issues/68#issuecomment-855236458

cosmicdan avatar Jun 05 '21 13:06 cosmicdan

Especially since i found a way to multithread worldgeneration truely and this mod would BREAK instantly (You should fix this for 1.14.4 too)

Speiger avatar Jun 06 '21 11:06 Speiger