Skip to content

Strokkur424/ExplodingLaserShootingBees

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExplodingLaserShootingBees Java CI

Have you 🫵 ever thought 🤔 that bees 🐝 are boring???? Not with ExplodingLaserShootingBees 🔫!! Witness ✨ unparralleled performance thanks to writing the plugin fully in JVM bytecode 🏎️🏎️🏎️. As we all know, assemblers are faster than compilers 👍💖. Give it a try now 👮‍♀️.

exploding-bees-2.mp4

Features ✨

  • All bees 🐝 now explode if you get closer than 2 blocks ⚔️.
  • Bees 🅱️ fire deadly lasers 🔫 if you come closer than 20 blocks 🐍.

Download it now!!! 🧆















Okay seriously, what the fuck is this?

This is a proof-of-concept plugin written entirely in JASM, a JVM bytecode assembler. Instead of using the nice and simple Java syntax, you instead directly write JVM instructions.

For this in specific, I am using jumanji144's Jasm tool. With it I am compiling all .jasm files into .class files, which are then packaged into a normal plugin .jar. It's like using Gradle, except without all the benefits.

Example?

In Java, you could write the following helper static method to retrieve your plugin instance:

public static ExplodingLaserShootingBees getInstance() {
    return JavaPlugin.getPlugin(ExplodingLaserShootingBees.class);
}

In JASM, you have to operate on the stack and call methods via their signatures directly:

.method public static getInstance ()Lnet/strokkur/explodinglasershootingbees/ExplodingLaserShootingBees; {
    code: {
        ldc Lnet/strokkur/explodinglasershootingbees/ExplodingLaserShootingBees;
        invokestatic org/bukkit/plugin/java/JavaPlugin.getPlugin (Ljava/lang/Class;)Lorg/bukkit/plugin/java/JavaPlugin;
        checkcast Lnet/strokkur/explodinglasershootingbees/ExplodingLaserShootingBees;
        areturn
    }
}

Do you recommend people to actually use JASM for plugins?

No.

Why?

It took me about 12 hours (and maybe a bit more) to finish this project. I did learn a lot about how the JVM operates and how the stack in the JVM operates, which was definitely worth it. But making any kind of plugin slightly more complex than this just takes exponentially longer, because the assembler does not catch issues as well as the Java compiler does. A lot of time went into spinning up a dev server and then getting yelled at by the JVM that I mistyped a method signature.

Seriously it is not worth it.

About

Exploding, laser shooting bees. The name says it all.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages