Giter Club home page Giter Club logo

fabricmetadatawrap's Introduction

FabricMetadataWrap

Just basically easily wrap Fabric's metadata into something much shorter. Is this useless? Yes! Do I care? Nope.

Now is this a good idea? No. I'd say it's more abstracted now. Do I really care much? Nope, this was made out of Spite.

...but if you care about making your code look prettier... eh? I guess use this?

Very Quick Example

Java

public class TestMod implements ModInitializer {
    public static final String MOD_ID = "testmod";

    // -------------------------
    // Instead of doing the full call
    public static final String VERSION = FabricLoader.getInstance().getModContainer(MOD_ID).get().getMetadata().getVersion().getFriendlyString();
    public static final String MOD_NAME = FabricLoader.getInstance().getModContainer(MOD_ID).get().getMetadata().getName();


    // It would just be this
    public static final String VERSION = FMW.getVersionString(MOD_ID);
    public static final String MOD_NAME = FMW.getName(MOD_ID);
    // -------------------------
    
    @Override
    public void onInitialize() {
        LOGGER.info("[" + MOD_NAME + "] Version " + VERSION + " loaded.");
    }
}

Kotlin

class TestMod : ModInitializer {
    companion object {
        val MOD_ID: String = "testmod"

        // -------------------------
        // Instead of doing the full call
        val MOD_VERSION: String = FabricLoader.getInstance().getModContainer(MOD_ID).get().metadata.version.friendlyString
        val MOD_NAME: String = FabricLoader.getInstance().getModContainer(MOD_ID).get().metadata.name
        
        // It would just be this
        val MOD_VERSION: String = FMW.getVersionString(MOD_ID)
        val MOD_NAME: String = FMW.getName(MOD_ID)
        // -------------------------

        override fun onInitialize() {
            LOGGER.info("${MOD_NAME} loaded! Version ${MOD_VERSION} loaded.")
        }
    }
}

Adding to your Fabric project

FabricMetadataWrap is on devOS' Public Maven.

Groovy

repositories {
    maven { url = "https://mvn.devos.one/snapshots/" }
}

dependencies {
    include(modImplementation("gay.asoji:fmw:<version>"))
}
* This could be wrong, as I don't use Groovy anymore really, I'll check later ok byeeeeeeeeeee

Kotlin DSL

repositories {
    maven { url = uri("https://mvn.devos.one/snapshots") }
}

dependencies {
    include(modImplementation("gay.asoji:fmw:<version>")!!)
}

License

This project is licensed under the MIT license.

fabricmetadatawrap's People

Contributors

asoji avatar bluspring avatar

Watchers

 avatar

Forkers

bluspring

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.