Recipe Costs

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

MrCervelo

New Member
Jul 29, 2019
248
0
0
Hi All

I started writing a program today, that I hope to put into a mod. It basically calculates the cost of a recipe. For basic recipes, this is pretty useless, but I initially started thinking about it for the total cost of the Gravitation Chest Plate.

I found a bug when calculating the cost for the Gravitation Chest Plate, but for kicks, here's the output in it's current state. I know that it's broken as it shows some left over Superconductors and there are 10 left over Glass Fibre Cables. What's odd, is if I feed the individual components, it seems to be fine. This is going to be a mongrel to debug.

Couple of other quirks, I put Water Buckets in a stack of 1, hence the large number of stacks, same for some of the other components.

Base Requirements for 1 Gravitation Chestplate
Iron - 6 stacks and 37
Tin - 16 stacks and 61
Coal - 4 stacks and 32
UU Matter - 12 stacks and 44
Silver - 18
Sand - 54
Gold - 17
Water Bucket - 96 stacks
Sticky Resin - 2 stacks and 14
Lapis Lazuli - 1 stacks and 34
Copper - 13 stacks and 52
Glowstone Dust - 2
Redstone Dust - 4 stacks and 6
Diamond - 49

Left Overs
Rubber - 5
Superconductor - 2
HV Cable - 6
Bronze - 4
Mixed Metal Ingot - 1
Gold Cable - 10
Glass Fibre Cable - 10

Intermediate Steps
LapPack - 1
Carbon Fibers - 1 stacks and 8
Ultimate Lappack - 1
Nano-Bodyarmor - 1
BatPack - 1
Electronic Circuit - 59
QuantumSuit Bodyarmor - 1
Bronze - 3 stacks and 60
Superconductor Cover - 30
MV Transformer - 11
60K Cooling Cell - 16 stacks
Lapotron Crystal - 7 stacks
Advanced Alloy - 2 stacks and 39
Refined Iron - 6 stacks and 37
Gold Cable - 20
Iridium Ore - 1 stacks and 52
Coal Dust - 4 stacks and 32
Water Cell - 1 stacks and 32
3xIns HV Cable - 6
Telsa Coil - 8
HV Transformer - 3
Glass Fibre Cable - 42
Reactor Plating - 8 stacks
30K Cooling Cell - 32 stacks
Energy Crystal - 11 stacks
Advanced Circuit - 1
Copper Wire - 5 stacks and 40
Machine Block - 11
Rubber - 6 stacks and 38
Superconductor - 8
Heat-Capacity Reactor Plating - 8 stacks
Empty Cell - 1 stacks and 32
HV Cable - 4
10K Cooling Cell - 96 stacks
Carbon Plate - 36
Lapis Lazuli Block - 6
Heat Exchanger - 16 stacks
Mixed Metal Ingot - 2 stacks and 39
Iridium Alloy - 29
Dense Copper Plate - 64
Raw Carbon Mesh - 36
IC Battery - 6
Advanced Heat Exchanger - 8 stacks
Gravitation Engine - 2
Cooling Core - 4
Glass - 54
2xIns Gold Cable - 22
Gravitation Chestplate - 1

Also for giggles, I fed it the HV Solar Array

Base Requirements for 1 HV Solar Array
Gold - 9
Sticky Resin - 35 stacks and 41
Iron - 81 stacks and 12
Coal - 24 stacks
Tin - 32 stacks
Copper - 56 stacks and 7
Redstone Dust - 48 stacks and 10
Cobblestone - 64 stacks
Diamond - 1
Wood - 64
Sand - 24 stacks

Left Overs
Copper Wire - 6
Rubber - 3
Gold Cable - 6
HV Cable - 10

Intermediate Steps
Copper Wire - 106 stacks and 6
Machine Block - 8 stacks and 9
Furnace - 8 stacks
Rubber - 106 stacks and 56
Generator - 8 stacks
Plank - 4 stacks
HV Cable - 2
MV Solar Array - 8
Electronic Circuit - 16 stacks and 1
MV Transformer - 9
Solar Panel - 8 stacks
IC Battery - 8 stacks
Refined Iron - 81 stacks and 12
Gold Cable - 16
LV Solar Array - 64
LV Transformer - 64
Coal Dust - 24 stacks
3xIns HV Cable - 2
HV Transformer - 1
Energy Crystal - 1
Glass - 24 stacks
2xIns Gold Cable - 18
HV Solar Array - 1
 

Hydra

New Member
Jul 29, 2019
1,869
0
0
Really nice! I would recommend making this a web application though instead of a downloadable tool. It's more convenient for users, less insecure to execute external code, and could also net you some google ad income to boot.
 

Omicron

New Member
Jul 29, 2019
2,974
0
0
What I think is happening is that it adds up the leftovers for the intermediary steps. If there are six steps each with 1 copper cable leftover, for example, it will total up to 6 leftover cables even though any actual person doing it would simply craft one batch less for the final step.
 

MrCervelo

New Member
Jul 29, 2019
248
0
0
Thanks for the feedback.

I suppose that version 1 will probably be a web app, the reason I'm thinking of a mod is that it's an easy way to get all of the recipes into it. Right now, it's a lot of typing.

@Omicron, that's the idea behind the leftovers section, I have a recursive function that it loops through to get the base requirements and the intermediate steps, whenever anything is crafted and it doesn't require the full batch, then it puts the remainder into the leftovers. Whenever something needs to be crafted, it first checks the left overs to see if there is sufficient in there to cover the request. I think that something is going wrong in there.

@noskk give me a bit of time to work out the bug, then I'll need to add a whole heap more recipes, or more probably, get a better way of adding them in.
 

tehBlobLord

New Member
Jul 29, 2019
547
0
0
this is reaally awesome :D I'm impressed :p Maybe if you make it as an add-on for NEI or something it could be added to the mod pack itself?
 

MrCervelo

New Member
Jul 29, 2019
248
0
0
@tehBlobLord - That was my thinking, NEI already has the recipes of everything in the game and so making this as an add on would be a good way of doing it. I'm still thinking of getting it "out there" asap if I can, so maybe a web app is a way to go. If I get something working, I'll see if I can speak to the FTB Admin Team and get it on their site, seems a good place to put it.

@noskk - I only just noticed that you're request is around Greg-Tech which isn't something I've played with. Is this -> http://wiki.industrial-craft.net/index.php?title=IndustrialCraft-Addons:GregTech-Addon the best place to get that info?
 

Nakamura2828

New Member
Jul 29, 2019
8
0
0
I actually had thoughts of doing something similar to this. I think it's a great idea. I can see pros and cons both to having it as a web-app and as an add-in, either option I think would be useful.
 

Abdiel

New Member
Jul 29, 2019
1,062
0
0
I wish there was an option to use the alternate crafting recipes of GT. For example, I always make 4 advanced circuits out of 3 copper using electrum. (When I need advanced circuits specifically. For GT stuff I use pulsating chipsets, which are half a redstone + half an enderpearl.)
 

MrCervelo

New Member
Jul 29, 2019
248
0
0
I can see the idea behind this getting out of hand, but for the time being, I'm thinking of probably getting it up on the web, and then also working on a version that will exist as a mod. I would leave the web version up even if I do get it working as a mod.

The advantage of a web version that would be difficult to do via a mod would be to have a shopping list, and to be able to select specific recipes. The idea of the shopping list, is say, what are the resource requirements if I want to build a RedPower2 TBM of a certain size, and here's all of the stuff that I want on the back of it. That would be very difficult or impossible within the MC client.

But the mod version would be able to show a single item (like a HV Solar Array) and give you the base material requirements and all of the intermediate steps, dealing with multiple recipes would be a problem in client, and I would be tempted to just go for the most efficient that are available or something like that. If you're in game, you may not want to view a web page, find the item you're looking for just to see if you have sufficient items to build it.

Considering that right now, it's in about Alpha 0.2, and it's still very manual, a lot of this is pipe dream stuff currently, but I have the guts of the program worked out, I just need to get a lot of window dressing so that it will work online.
 

MrCervelo

New Member
Jul 29, 2019
248
0
0
OK, second attempt at this post.

I think that I've finally got the left over stuff worked out now, so I reran the Gravitation Chestplate and HV Solar Array figures, here they are for those that are interested

Code:
Requirements for 1 Gravitation Chestplate

=== Raw Material Requirements ===
Tin                               -   16 stacks and 61 extra (1085)
Coal                              -    4 stacks and 32 extra (288)
Iron                              -    6 stacks and 37 extra (421)
Glowstone Dust                    -    2
Diamond                           -   49
Copper                            -   13 stacks and 52 extra (884)
Gold                              -   17
Redstone Dust                     -    4 stacks and 6 extra (262)
Water Bucket                      -   96 stacks (96)
Sticky Resin                      -    2 stacks and 14 extra (142)
Sand                              -   54
Silver                            -   18
Lapis Lazuli                      -    1 stack and 34 extra (98)
UU Matter                         -   12 stacks and 44 extra (812)

=== Left Overs ===
Mixed Metal Ingot                 -    1
HV Cable                          -    6
Gold Cable                        -    2
Rubber                            -    3

=== Intermediate Steps ===
Mixed Metal Ingot                 -    2 stacks and 40 extra (168)
Empty Cell                        -    1 stack and 32 extra (96)
Heat Exchanger                    -   16 stacks (16)
Glass Fibre Cable                 -   42
Rubber                            -    6 stacks and 39 extra (423)
Nano-Bodyarmor                    -    1
Reactor Plating                   -    8 stacks (8)
Energy Crystal                    -   11 stacks (11)
Lapotron Crystal                  -    7 stacks (7)
HV Transformer                    -    3
10K Cooling Cell                  -   96 stacks (96)
Heat-Capacity Reactor Plating     -    8 stacks (8)
Raw Carbon Mesh                   -   36
Bronze                            -    3 stacks and 60 extra (252)
BatPack                           -    1
Glass                             -   54
Lapis Lazuli Block                -    6
Machine Block                     -   11
Advanced Alloy                    -    2 stacks and 39 extra (167)
Copper Wire                       -    5 stacks and 40 extra (360)
60K Cooling Cell                  -   16 stacks (16)
Superconductor                    -    9
Cooling Core                      -    4
Electronic Circuit                -   59
Water Cell                        -    1 stack and 32 extra (96)
LapPack                           -    1
Refined Iron                      -    6 stacks and 37 extra (421)
Iridium Ore                       -    1 stack and 52 extra (116)
Advanced Heat Exchanger           -    8 stacks (8)
Ultimate Lappack                  -    1
3xIns HV Cable                    -    6
Coal Dust                         -    4 stacks and 32 extra (288)
Gravitation Engine                -    2
HV Cable                          -   12
Gold Cable                        -   24
IC Battery                        -    6
Iridium Alloy                     -   29
Carbon Fibers                     -    1 stack and 8 extra (72)
QuantumSuit Bodyarmor             -    1
Telsa Coil                        -    8
Carbon Plate                      -   36
Advanced Circuit                  -    1
2xIns Gold Cable                  -   22
Dense Copper Plate                -   64
MV Transformer                    -   11
Superconductor Cover              -   30
30K Cooling Cell                  -   32 stacks (32)

Code:
Requirements for 1 HV Solar Array

=== Raw Material Requirements ===
Coal                   -   24 stacks (1536)
Tin                    -   32 stacks (2048)
Gold                   -    9
Redstone Dust          -   48 stacks and 10 extra (3082)
Sticky Resin           -   35 stacks and 41 extra (2281)
Sand                   -   24 stacks (1536)
Cobblestone            -   64 stacks (4096)
Iron                   -   81 stacks and 12 extra (5196)
Diamond                -    1
Wood                   -    1 stack (64)
Copper                 -   56 stacks and 7 extra (3591)

=== Left Overs ===
Copper Wire            -    2
HV Cable               -   10
Gold Cable             -    6
Rubber                 -    1

=== Intermediate Steps ===
Copper Wire            -  106 stacks and 8 extra (6792)
Electronic Circuit     -   16 stacks and 1 extra (1025)
LV Solar Array         -   64
Refined Iron           -   81 stacks and 12 extra (5196)
Rubber                 -  106 stacks and 56 extra (6840)
LV Transformer         -   64
Furnace                -    8 stacks (512)
3xIns HV Cable         -    2
Coal Dust              -   24 stacks (1536)
Energy Crystal         -    1
Solar Panel            -    8 stacks (512)
Generator              -    8 stacks (512)
MV Solar Array         -    8
HV Cable               -   12
Gold Cable             -   24
IC Battery             -    8 stacks (512)
HV Transformer         -    1
Plank                  -    4 stacks (256)
Glass                  -   24 stacks (1536)
2xIns Gold Cable       -   18
MV Transformer         -    9
Machine Block          -    8 stacks and 9 extra (521)

I was stuffing around with the request to work out the requirements for the GregTech Fusion Reactor and Coils, I can see that I need to change my code due to recipes that can create multiple outputs, this is either through specific machines, or through recipes that reduce an items durability and return it to you, or through recipes that require a full bucket and then return the empty bucket.

In either case, the guts of the program (working out the requirements) is working, so that's a chunk of work done. I'm going to keep at it, because I would like to get this working for my own benefit, but I will try and get an online version that others can use. Then I'll look at the idea of getting it into a mod.
 

Abdiel

New Member
Jul 29, 2019
1,062
0
0
I am confused, where are you getting the UU matter requirement for the gravichestplate from? The only things that should need UU are the MFFS camouflage upgrade and hybrid solars.
 

MrCervelo

New Member
Jul 29, 2019
248
0
0
I am confused, where are you getting the UU matter requirement for the gravichestplate from? The only things that should need UU are the MFFS camouflage upgrade and hybrid solars.

I didn't run the recipes with GregTech config, just IC2 and Gravitation Suite Mod. This means that the only way that you can get Iridium Ore is through UU Matter.

I haven't checked my sums for this specific recipe, but given that it works for much of the other stuff, I don't think that it's wrong here.
 

MrCervelo

New Member
Jul 29, 2019
248
0
0
I didn't run the recipes with GregTech config, just IC2 and Gravitation Suite Mod. This means that the only way that you can get Iridium Ore is through UU Matter.

I haven't checked my sums for this specific recipe, but given that it works for much of the other stuff, I don't think that it's wrong here.

And it was wrong. I'm actually testing this properly now (I'm trying to create a gravsuit with the ingredients listed)

This is question to anyone who does code and has written stuff around minecraft, I'm going to modify my code to work with recipes that provide multiple outputs, recipes that affect the durability of an item, and with liquids. So I'm thinking about how I can get my classes to all hang together. This is the idea that I've come up with so far

Abstract Class - Material (would require two lists, one which lists the recipes that it's used in, one that lists recipes that it's an output from).
Classes that Extend Material - RawMaterial, CraftedMaterial, LiquidMaterial, DurableMaterial (i.e. items that you use in recipes that will consume their durability).
Class that extends CraftedMaterial - LiquidContainerMaterial

Class - Recipe (has Input, Output, Batch Size, Machine)

Class Machine - Able to Process Recipes, I would actually put things like the Crafting Table in here, basically because you put stuff in, you get stuff out. This way as well, the app would be able to show what machines (if any) you would require to be able to make the recipe. I'm not sure of the best way to work with the "chance to produce", maybe add it as an another variable in the Recipe class.

As said upthread, this may get out of hand, but I need to get better at OO development, so this looks like a good challenge. If anyone has any tips or good places to read up on this sort of thing, please let me know.
 

VikeStep

New Member
Jul 29, 2019
1,117
0
0
I was actually in the development of a HTML version of this, however I stopped it as I realised how much of a task it would be for me and I just didn't have the time for it. After stumbling across this I am glad someone started making it because I couldn't find one and I would've used it.

Here is the HTML Code if you are interested:
HTML:
<html>
    <head>
        <script>
//            just put the recipes for the items in this format, however it could look better since this layout was for testing
            var diamondSword = {
                diamond: 2,
                stick: 1
            };
            var diamondPickaxe = {
                diamond: 3,
                stick: 2
            };
            var woodenplanks = {
                wood: 1
            };
            var stick = {
                woodenplanks: 1
            };
//            this will go through each argument of the selected items in the array and up their totals
            function add() {
                var result = {};
                for (var i=0; i<arguments[0].length; i++)
                {
                    for (var item in arguments[0][i])
                    {
                        result[item] = (result[item] || 0) + (arguments[0][i][item]);
                    }
                }
                return result;
            }
//            in the Array() section write items you want to be calculated
            var a = new Array(diamondSword, diamondPickaxe, woodenplanks);
//            I used Google Chrome's Inspect Element > Console Log to view this
            console.log(add(a))
        </script>
    </head>
</html>

P.S. out of curiosity, what language are you programming in, I know a bit about C# and Javascript, which with the javascript I made the foundation for my HTML page
 

MrCervelo

New Member
Jul 29, 2019
248
0
0
Does anyone know how to extract recipe and item details from minecraft and mods? My newer version is nearly at a point where it will need to have all of the recipes, machines, items and mods in a way that it can handle the information. I haven't worked out how I'm going to store that information, but in either case, at the moment the only thought that I have is a lot of typing (which for some strange reason, doesn't appeal).

I'm considering a machine to be anything that can be used to turn one or more items into something else (a crafting bench is an example, as well as a furnace). A Recipe is the list of inputs, outputs and chance outputs.
 

jumpfight5

New Member
Jul 29, 2019
1,750
0
1
How many mods have you got working on it? Sorry to just noob up on your thread, but I'd like to know the costs of the Galogorian Drill head.
 

MrCervelo

New Member
Jul 29, 2019
248
0
0
Hi jf5, I don't have access to MC at the moment (at work), and the Steve's Carts Wiki that I found doesn't have all of the required ingredient list, so I can't give you an answer on that anyway.

Right now, the only way that I can get information into my app is to manually type in the ingredient list, so I don't have any mods in it, just the specific items that I was interested in or wanted to use for testing.

I'll see if I can do it tonight when I'm home.