Giter Site home page Giter Site logo

tips's Introduction

Tips

Tips is a Minecraft mod that adds tips to some of the loading screens.

Nodecraft This project is sponsored by Nodecraft. Use code Darkhax for 30% off your first month of service!

Adding Tip

If you are making a modpack, you can can add new tips by editing the config/tips.cfg file. Each line in the customTips section will be read as a new tip that can be displayed.

    # A list of custom tips added by the user or modpack. [default: ]
    S:customTips <
        This line of text will show up as a new tipe.
        This line of text is another seperate tip.
		This tip will have a custom title in game.#SPLIT#Custom TIP
     >

If you are a mod author and would like to add tips to your mod, you can simply add mods.tips.modid.1=Your tip here. to your lang file. This mod can automatically detect when mods have defined custom tooltips and will load them without you having to add any code! Your mod can add as many tooltips as you want, just make a new entry to the lang file with an increased number at the end. Please note that the detection code will stop detecting new tips if the next number in the sequence can not be found. For example if you have tips for the numbers 1, 2, 4, and 5, only tips 1 and 2 will be loaded because tip 3 can not be found. Modpack authors can disable all tips detected this way by setting allowDefaultTips to false in the config file.

Mod API

If you want to do something a bit more complex, you can interact with the system directly using the mod API. This mod provides the net.darkhax.tips.TipsAPI class, which allows you to do things like add/remove tips, or even render tips on other GUIs.

The list of tips available is built using a series of string list consumers. First all of the adders are invoked to generate the list of tips, and then all the removers are ran which allows for the list to be cleaned up. This system uses functional interfaces, lambdas, and method references. The system was designed this way to allow the tips list to be rebuilt/reloaded. If you don't know how to use those, this mod is actually very simple and can help you learn. Here are a few examples of how you can do things.

Basic Lambda

// Single line entry.
TipsAPI.addTips(tips -> tips.add("Hello World"));

// Multiple line entry.
TipsAPI.addTips(tips -> {           
    for (int i = 0; i < 10; i++) {               
        tips.add("Random Tip #" + i);
    }
});

Method Reference

TipsAPI.addTips(YourClass::addTips);

public static void addTips(List<String> tips) {
    tips.add("Hello World");
    tips.add("Another Tip");
}

New class

TipsAPI.addTips(new TipsPlugin());

public class TipsPlugin implements Consumer<List<String>> {

    @Override
    public void accept (List<String> tips) {
        tips.add("Hello World");
    }
}

Maven Info

Coming soon!

tips's People

Contributors

darkhax avatar regnander avatar championash5357 avatar bignelli avatar jtk222 avatar jaredlll08 avatar dong031001 avatar

Watchers

James Cloos avatar

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.