Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstraction over Crafting System #8

Open
Kilobyte22 opened this issue Oct 16, 2016 · 0 comments
Open

Abstraction over Crafting System #8

Kilobyte22 opened this issue Oct 16, 2016 · 0 comments
Assignees
Labels

Comments

@Kilobyte22
Copy link
Member

Kilobyte22 commented Oct 16, 2016

Allows to abstract crafting

Stage 1: Config

There is a config file for each mod that uses ManiacCore in config/maniac/core/crafting/<modid>/master.cfg. This config is created with the following content when it does not exist:

include default.cfg;

The path of the include is relative, unless it starts with a '/'. This file can contain arbitrary crafting statements. The default.cfg and optionally other configs are directly copied from the mods assets. They are not intended for hand editing. The user can also create own config files. Those will not ever be overwritten by the mod.

Example config file representing some vanilla recipies:

recipe shaped_crafting pickaxe/diamond {
    output minecraft:diamond_pickaxe 1;
    input {
        minecraft:diamond minecraft:diamond minecraft:diamond
        minecraft:diamond minecraft:diamond minecraft:diamond
        minecraft:diamond minecraft:diamond minecraft:diamond
    };
}

recipe smelting charcoal {
    output minecraft:charcoal;
    input forge:wood;
}

recipe has 2 parameters: the type of crafting and the id.
The ID can be used to delete a recipe (recipe delete <id>). This only works within a certain config file and only after the inclusion. You can also override a recipe by defining a second recipe with the same ID. This is very useful to include default.cfg and then delete the recipes you don't like, instead of duplicating the config.

Internal API

The interal API alles you to register custom recipe handlers. The recipe handler then gets asked to register it whenever a recipe of the respective type is encountered in the config. Please note that registering happens after the entire config has been processed.

@Kilobyte22 Kilobyte22 added this to the Initial Usability milestone Oct 16, 2016
@Kilobyte22 Kilobyte22 self-assigned this Oct 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant