liplum / MultiCrafterLib

A Mindustry mod library provides a multiple-recipe crafter to produce items, fluids, power or even heat for Json and JavaScript mods.
https://liplum.github.io/MultiCrafterLib/
GNU General Public License v3.0
47 stars 10 forks source link

Won't consume power (Java) #43

Closed Curlychump closed 3 months ago

Curlychump commented 3 months ago

The consumePower() function adds a power bar, however the block will not auto-connect to any power sources and will not consume any power. Adding isConsumesPower = true to the block allows it to auto connect to power sources and take power however it still does not consume it I have tried different values and have had no luck.

If i remember I will attach the code when possible.

Curlychump commented 3 months ago

Code in question:

blastFurnace = new MultiCrafter("Blast Furnace") {{
        requirements(Category.crafting, with(Items.copper, 1));
        hasItems = acceptsItems = true;
        isConsumePower = true;
        configurable = true;
        itemCapacity = 100;
        size = 3;
        consumePower(100f);
        envEnabled = Env.any;
        drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawDefault());
        resolvedRecipes = Seq.with(
            new Recipe(
                //IOEntry input: this recipe's input goes here
                new IOEntry(
                    //input items go here (can be empty if you wish to use fluids only)
                    Seq.with(ItemStack.with(clabItems.iron, 1, Items.coal, 1)),
                    //input fluids go here (there are no fluids required so this is empty)
                    Seq.with(/* example: LiquidStack.with(water, 10) */)

                ),
                //IOEntry output: this recipe's output goes here
                new IOEntry(
                    //output items
                    Seq.with(ItemStack.with(clabItems.steel, 1)),
                    //output fluids, again, it can be empty
                    Seq.with()
                ),
                //float craftTime: self-explanatory. measured in ticks
                60f
            ),
            new Recipe(
                new IOEntry(
                    Seq.with(ItemStack.with(clabItems.u235small, 9)),
                    Seq.with()
                ),
                new IOEntry(
                    Seq.with(ItemStack.with(clabItems.u235ingot, 1)),
                    Seq.with()
                ),
                90f
            ));
    }};
JojoFR1 commented 3 months ago

Is your goal to make the block requires 100 power to works? As far as I know the consumes doesn't work, your best option is to make every recipe requires 100 power. I do not know how to make consumers work, sorry. Liplum (the creator of this library) should know better (maybe)

Curlychump commented 3 months ago

oh you can make the recipes consume power? i will have to check that. Thanks!

Curlychump commented 3 months ago

The problem with it not consume power is fixed, although it would be good to have it just use the consumePower() value. Thanks for the help JojoFR1

JojoFR1 commented 3 months ago

oh you can make the recipes consume power? i will have to check that. Thanks!

Yes, in v1.8 here's the input/output order: items, liquids/gases, power, heat Payloads was in the plan for v2.0 but some personal project and lots of bugs and so it's for now delayed