r/programminghorror • • Nov 04 '26 • Regret 1

Java Jenny mod deobfuscated funnies

525 Upvotes

56 comments sorted by

247

u/SSUPII Nov 04 '26 edited Nov 04 '26

If this is decompiled it might also be artefacts of that.

But I have no idea how decompilation works in the context of compiler-optimized code.

47

u/KeyIllustrious587 Nov 04 '26

It's not artefacts. Most of artefacts of decomp are try-with-resources reconstruction, Objects, and other bullshittery.

64

u/Powerkaninchen Nov 04 '26

Is it possible the first 2 images are cases of the compiler unrolling loops?

38

u/Mc88Donalds Nov 04 '26

And 3/4 could presumably also be a decompiler difference. I doubt that you can tell the difference between a ternary and an if statement in java bytecode

14

u/magistermaks 29d ago

no, java compiler never unrolls loops, this is how it was written

2

u/Me4502 29d ago

Or manually unrolling without tidying up the code around it. I’ve in the past found fairly significant performance improvements by unrolling loops over cardinal block offset checks in very hot code (similar to what image 2 does). However, that’s usually done as multiple “or” conditions in a single if statement, not duplicating out every branch like this code does.

-5

u/littlenekoterra Nov 04 '26

Thats precisely what those are.

13

u/skilking Nov 04 '26

might be wrong but didn't java do basically no real optimizations in the soure code to byte code compilation?

9

u/littlenekoterra Nov 04 '26

Ima level with you im not super familiar with java, but those look exactly like unrolled loops. Even if javas compiler doesnt have unrolling its not insane to cook it up as a precompilation step tbh If i remember right thats like the oldest known version of code gen

5

u/maikindofthai 29d ago

If you don’t know about Java why are you making absolute statements using words like “precisely” while misinforming people 💀

→ More replies (3)
→ More replies (4)

5

u/Eav___ Nov 04 '26

Incorrect. javac never does that from source to binary.

1

u/ierdna100 29d ago

Not for function calls, even languages which do this don't unroll function calls, because functions can change the state of their object and that may affect the logic of the code.

83

u/Cootshk 29d ago

(Object) and some wacky try()/.close() are common javac artifacts

These aren’t

Java doesn’t do much compiler optimizing (although it does inline final primatives where possible)

19

u/when_it_lags 29d ago

I believe the idea is that much of the "compiler" optimizations are done by the JRE at runtime

6

u/_alba4k 27d ago

javac doesn't do that on purpose as most of these optimisations would depend on the hardware running the program (caching, Isa, pipelining all can affect how a program should be compiled) and should be done by the jvm

→ More replies (1)

39

u/csabinho Nov 04 '26

Context?

8

u/granadesnhorseshoes Nov 04 '26

Apparently, Jenny Mod is a virtual wiafu mod for minecraft. We assume this is it's source code.

I wonder how much it was vibe coded but to lazy to look.

79

u/KeyIllustrious587 Nov 04 '26
  1. This code is deobfuscated (original was heavily obfuscated with Zelix Klassmaster), decompiled, and remapped.
  2. This is not vibecoded.

4

u/Leclowndu9315 Nov 04 '26

Yo i'm actually interested i've tried deobfuscating it before. Can you share a zip please

23

u/KeyIllustrious587 Nov 04 '26

https://github.com/RukoBlood/jenny-mod-re-clean
Here it is. Not advertisement, pure shitcodium.

26

u/dreamscached Nov 04 '26

Jenny Mod was around way before agentic AI capable of vibecoding something entirely came to life.

9

u/LolMaker12345 Nov 04 '26

It’s not videcoded, it was made years before ai as we know it

9

u/Triactum 29d ago

It's OG slop instead of Vibe slop

4

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" 29d ago

That would explain why that variable is named girlPos.

64

u/MMORPGnews 29d ago

It's not ai. Funny story 

Worked long ago in certain company, because of regulations etc one guy created super inefficient script. Since there was no other way.  I worked with his script for a few months, before getting fired. 

Now over 10 years a got a message from company about this script, how it works, why dev (he blacklisted them) used AI to create trash, why it was approved by me and used, how much damage it's done  etc

There were no ai 10 years ago, script was "stupid" because of regulations, and only in high usage mode, in light usage it was very good. 

33

u/snerp Nov 04 '26

The last two seem fine to me. The second one is by far the worst but at least you can tell what’s going on in per func unlike that yandere sim code that just sprawls with random logic.

16

u/Opposite_Mall4685 Nov 04 '26

Yeah shouldAttackTarget is completely fine imo.

1 and 2 are cancer though

12

u/Kolatra 29d ago

I don't think decompiled code belongs here, would fall under rule 5 because you're not gonna get the original intent of the developer with it.

10

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: 29d ago edited 29d ago

I'd say human outputs from reverse engineering are allowed, as the code isn't generated by a computer. Generated code includes minified code - which can use the same variable names every time, random ones every time, seeded randomness, or anything that isn't an AI-generated output (we're talking about more predictable code generation here) - since many big companies use AI-generated code nowadays and it doesn't inherently make the code "bad" or "good."

(This still leaves the question as to whether analyzing heuristics, like what Windows Defender does with file analysis, are considered artificial intelligence or not.)

Furthermore, a lot of people are using AI to write code faster because AI cyberattacks are happening a lot faster nowadays and devs need to keep pace. Banning AI-generated code would reduce the number of posts that are technically allowed to be submitted here, and it would be hard to enforce in practice:

  • Humans may follow trends when designing or writing code that they don't realize look AI, even when it's their own.
  • An AI watermark detector can return a false positive due to a mathematical coincidence.
  • Some code may contain a mix of human and AI.
  • AI-generated code can look human and can be trained or prompted to follow style guides and the intentional business decisions behind them. Although AI doesn't understand intent, it can sometimes produce a much better output, depending on what you tell it.

Either way, a lot of horrors have something bad about the code, and I understand many of these people didn't know how to code well. We're here to laugh at the code.

Going back to your original point, a while ago, before I became a mod, I was going to post the RoLinked decompilation from GitHub, but because it contained real people's emails who were compromised, I decided not to - even if the emails were obfuscated in certain versions of the decompiled code. The previous mod team didn't remove decompiled code (although they were a lot more inactive overall than we are now), so I'm trying my best to follow what they may have intended.

Edit: Sorry for the tangent about AI. I started talking about generated code and circled back to the original topic near the end.

2

u/digitalseraphim 28d ago

The problem I see here is that decompiled code is code that has been optimized by a complier, then "guessed" back into a high level language by a program that is "functionally equivalent" to what was originally written, but has no real relation to the control flow and such that the programmer originally wrote, for better and for worse (some code will end up better, some worse). Just because this code looks "cursed" it was what the compiler felt was the most optimized way of doing it, not what would be "clean looking" to a human. (Forgive the humanizing of an algorithm following complier)

1

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: 27d ago

Personification 😅 yeah I know decompilation often involves generated code, I'm still not sure whether it is purely that or not (or a mix of both) tbh

1

u/digitalseraphim 27d ago

Turns out, I'm mostly wrong here. Didn't realize how little the Java compiler actually does.

7

u/cecialix Nov 04 '26

I'm a programmer myself so I more or less understand what's happening here. I'm not familiar with Minecraft specific code though, can you explain what's funny about these? Genuinely curious, lol

4

u/btrab1 29d ago

The first 2 are basically testing world positions really dumbly, it should be obvious without mc knowledge that these can be done way more minimally via loops.

But as for minecraft specific knowledge these block position objects (basically vec3i's with a lot of util methods) are really wastefully made and used here as they could instead be reusing built in stuff for this like a MutableBlockPos, and existing utilities that iterate over a given block area, without wasting allocations.

For example each relative position call e.g. pos.north().north().north() each returns a new vec3 of that new block position, so chaining them on mass is a huge waste. Especially given you can do one call with pos.relative(x,y,z). And even more optimally just use the previously mentioned MutableBlockPos which is a mutable vec3 in a loop that goes over these offsets.

1

u/digitalseraphim 28d ago

They probably were done by loops but the compiler unrolled them.

4

u/digitalseraphim 27d ago

Turns out I'm wrong. The compiler actually doesn't do any loop unrolling, it's only done by the JIT compiler. Didn't realize how little the Java compiler does.

3

u/Spaciax 29d ago

average level of software design principle adherence in a game mod:

no flame to the developers, making good code when you either can't change the source code of minecraft, or in scenarios where you can use mixins, are encouraged to avoid it as much as possible, leads to ridiculous situations like this one.

2

u/SartenSinAceite 28d ago

Feels more like bruteforced code than anything.

Most likely a "what if?" experiment that was never cleaned up (as we all know, those cleanups do nothing but break up everything!)

1

u/Thelatestart 29d ago

These are fine

-8

u/AnArmoredPony Nov 04 '26

deobfuscated code is same as generated code imo

5

u/BetaTester704 Nov 04 '26

Deobfuscated just reconstructs back to something similar to source code, it's not even similar to AI generation

5

u/AnArmoredPony Nov 04 '26

I never said anything about AI lmfao. I know what obfuscation is and what I say is that deobfuscated code will always look unpleasant

1

u/BetaTester704 Nov 04 '26

So what did you mean when you said "generated code" then?

4

u/AnArmoredPony Nov 04 '26

the same thing that is mentioned in the rules???

→ More replies (1)

0

u/HeartwarmingFox 29d ago

So why exactly are we hating on code?