PART.2 Formula Creation -Modular Machinery from Introduction to Entry Entry [MMCE] Modular Machinery: Community Edition

This tutorial is set by the author's setting without permission.

Modular machine: community version from entry to the soil -part.2 formula creation

This tutorial is guided by guiding modular machinery and modular mechanics: the starting scholar of the community version is introduced. This tutorial contains the most basic adding formula.

If you transfer from modular machinery to this module, the community version is completely compatible with the original version of the version 1.11.1 version of the original version, but please note: some subsidiaries may not be compatible with the community version. For details, please check the community versionPage introduction.

The main modules used in this tutorial are modular machinery: community version -1.11.1 -R33, Coo tool.

Note: The content of this tutorial may change at any time. Please carefully compare the module version used in this tutorial, so as not to cause module updates to cause inexplicable error problems.

Tutorial directory:

Part.1 Basic Machinery Creation

PART.2 Basic Formula Creation (Current)

PART.3.1 Advanced formula application

Part 3.2 Formula adapter recipeadapter (unfinished)

Part.3.3 Mechanical event system (unfinished)

Part.4.1 parallel formula processing (unfinished)

Part.4.2 Factory system (unfinished)

Part.4.3 Factory event system (unfinished)

Part.4.4 Smart Data Interface (unfinished)

Part.4.5 Unilateral / multi -square mechanical upgrade (unfinished)

Part.4.6 Custom GUI information (unfinished)

Part.5 configuration file analysis (unfinished)

Environmental preparation

This tutorial is highly recommended to use Visual Studio Code (hereinafter referred to as vScode), which can greatly reduce your magic workload.

Using VSCODE, you can use its powerful functions to complete complex operations faster. At the same time, it has code prompts to greatly reduce the difficulty and error rate of code reading. At the same time, you can install plug -in to expand the function to make it stronger.

To create a formula, you need to have a certain understanding of Zenscript (ZS). If you do n’t know, it is recommended to check the Chinese teaching documentation of ZENTUTUTORIAL written by friendship HJ.

Module

If you have installed Crafttweaker and modular mechanical body and the game has been started, you can skip this description.

To create a formula, you need to use Crafttweaker (any version).

To view the created formula, you need to use Jei (any version).

Create your first formula

Reading this tutorial, you have read the PART.1 mechanical creation part, so this tutorial will continue to use the processing machine of PART.1 to create a formula.

Modify the structure

To create a formula, we must first modify some of the contents of the machine. Therefore, this tutorial will add an input and output warehouse to the processor.

A total of three types of inputs are provided by modular machinery, namely: the item input warehouse, the fluid output warehouse, and the energy input warehouse.Output warehouse.

Among them, there are 7 sizes in the item warehouse, while the fluid warehouse and the energy warehouse have a total of 8 sizes.

It is worth noting that the fluid input warehouse also supports the gas input of general machinery.

Except for the item warehouse, the volume of various sizes of the fluid and energy warehouse can be modified (advanced) in the configuration file.

Next, we will add 1 item input warehouse, 1 item output warehouse, 1 stream input warehouse, 1 stream output warehouse, and 1 energy input position to the processor.

A machine with an input and output warehouse

Now, this is a machine with an input and output warehouse.

In the red box is the energy input warehouse, the green box is the item input warehouse and the output warehouse of the item.Board (decoration).

Now use the construction selection tool to choose and create a structure. Since we have explained the tutorial of creating machinery in parts in part.1, the office will no longer describe too much.

Note: If you right -click the GUI when you use the construction selection tool, you can right -click the square when you squat.

After the structure is created and modified, the game is restarted.

Formula script creation

First of all, you need to create a script:

Open the game directory and find the Scripts folder.

(Optional) Create an internal folder called a ModularMachinery folder, or other names, and then open the folder.(Convenient classification)

Create a file called recipes.zs or other names in the folder.

Use VSCode to open the folder and type the following:

 Import Mods.modularMachinery.Rcipeprimer;

Import Mods.modularMachinery.RcipeBuilder; Import Mods.modularMachinery.

The upper content is a guide package, which is more convenient to create formula.

Formula creation

Next, we will add an example of a circuit board processing formula to the processor.

There are many ways to create formulas, and only two most commonly used writing methods are demonstrated in this paragraph.Under normal circumstances, the first writing method is recommended.

The first way of writing (chain call):

 recipebuilder.newbuilder ("Circuit_0", "Machine_1", 80)

.Addenergypertickinput (800)

.AdditeMinPuts ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

*8,

*1,

])

.Additemoutput (*8)

.Build ();

The second way of writing (general usage):

 Val Builder as recipeprimer = recipebuilder.newbuilder ("circuit_0", "machine_1", 80);

Builder.addenergypertickinput (800);

Builder.additeMINPUTS ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

*8,

*1,

]);

Builder.adDITEMOUTPUT (*8);

builder.build ();

This code will create an 80 tick, consume 800 Fe energy per TICK, consume 8 mines to create an formula for Ingotosmium (ingot) and a compressed red stone to create 8 basic control circuits.

Maybe I don't know the meaning in the code?Next will analyze the role of each line:

 // This paragraph will create a formula called Circuit_0 for the registered machine Machine_1 mechanical, and the working hours are 80 ticks.

Recipebuilder.newbuilder ("Circuit_0", "Machine_1", 80)

// The content below can only be called through the recipeprimer or chain calls, and cannot be called separately.

// Add energy consumption of 800FE per TICK.

Addenergypertickinput (800)

// This method is a modular mechanical: the community version is unique, and the original version of the modular machine is not supported.// additeMinput () and additeMinPuts () are two methods, don't confuse.

additeMinPuts ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

*8,

*1,

] // Add two items input, which can be a mineral or the item. Here, the items input of 8 ore are input and a compressed redstone item input.

// The above three lines can also be written into one line, which is written into three lines to improve readability

additeMinPuts

#Note: Middle brackets (array) are not necessary, but remember to delete the last comma.

#Modular mechanical original version equivalent method

addIteminput (, 8) // Note that the mineral and quantity are two parameters. You cannot use "*", you can only use "," "," "," "," "," "

additeMinput (*1)

// Add 8 basic control circuit output

additemoutput (*8)

// After the formula is created, the recipe can be registered at the end of this method.Note: After calling this method, you can't add other inputs anymore!

build ();

Note: You need to add a "." Before each method chain calls, and the general usage needs to add ";" to be added behind each method, it must not be missing.

Note: If you want to get the name of an item in the ZS, you can hold the corresponding items in the game, and then enter the instruction /CT Hand.

/ct hand output content

If you need to verify whether your script is written correctly, you can execute instructions in the game /ct syntax to verify the grammar of the script.

If there is no problem with the script, you will output the content of the same above. If other content (red words) appear, you need to check your script.

After the formula is added, save the file and restart the game.

If you don't want or want to restart the game, please continue to read the content below.

Heat load

Starting from MMCE R28, the module also supports most of the content directly in the game (Zenutils need to be installed).

You can enter instructions /CT RELOAD or /MM-RELOAD, /MM-Reload_client to re-load the content.

CT RELOAD can normally load most of the content. Please use this instruction by default.

MM-RELOAD can be used in the server (but there may be problems other than expected).

The MM-RELOAD_CLIENT instruction can re-load the client content in the server.

After executing the instruction, it will output the content similar to the above. If there is no red letter (that is, an error), it means that there is no problem with the script, and the heavy load is successful ~

verify

After restarting the game, if the script does not run the problem, you can see the created formula from Jei.

A formula created by CRT

If you need to add other types of input and output, check the content below.

CRT method Daquan

Below is a modular machine -available mechanical machine that can be called by all ZS: community version and some modular mechanical original version.

Please be a pilot package, then use the method below.

Base

 // Create a formula builder.

// RecipeRegistryname = formula name, the formula name corresponding to each machine, must not be repeated in a single machine.

// AssociatedMachineregistryname = Which machine (registered name) is added to which machine is added.// Processingticktime = working time (tick).

// sortingpriority = formula priority, affecting the priority of the machine search formula.

// Cancelif PertickFails = If the formula fails (such as power jump), whether the formula (such as swallowing materials) is forced.

Recipebuilder.NewBuilder (String RecipeRegistryname, String AssociatedMachineRegistry, INT ProcessingTiCKKTIME)

//example

Recipebuilder.newbuilder ("recipe_0", "Machine_0", 80)

Recipebuilder.NewBuilder (String RecipeRegistryname, String AssociatedMachineRegistry, Int ProcessingTiCKTIME, Int SortingPriority)

//example

Recipebuilder.newbuilder ("recipe_0", "Machine_0", 80, 99)

Recipebuilder.newbuilder (String RecipeRegistryname, String AssociatedMachineRegistry, Int ProcessingTiCKTIME, Int SortingPriority, Boolean Ca ncelifpertickFails)

//example

Recipebuilder.netBuilder ("Recipe_0", "Machine_0", 80, 99, TRUE)

GM input output and multiple general input output

Single input output:

 // Add material input.It can be items (support withthtag ()), fluid or mineral, and do not support gas.

addinput (IINGREDIITIITIITIITIINTIIT)

#Example

addinput (*64)

addinput (*64)

addinput (*1000)

// Add material output.It can be items (support withthtag ()), fluid or mineral, and do not support gas.

addoutput (INGREDIENT Input)

#Example

addoutput (*64)

addoutput

addoutput (*1000)

Multiple input output:

 // Add a variety of materials input and support withtag ().The rough usage is the same as above, but you can write a variety of items in a bracket.

addinputs (INGREDIENT ... Input)

#Example

addinputs (*64, *64, *1000) adDInputs olcircuit>*64, *1000,])

addinputs ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

*64,

*64,

*1000,

])

addinputs (

*64,

*64,

*1000

Cure

// Add a variety of materials output and support withtag ().The rough usage is the same as above, but you can write a variety of items in a bracket.

addoutputs (INGREDIENT ... Input)

#Example

addoutPuts (*64, *64, *1000)

addoutputs

addoutputs ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

*64,

*64,

*1000,

])

addoutputs (

*64,

*64,

*1000

)

Specific single input output

thing:

 // Add items input to support withtag (), which can be an item or mineral resignation (although it is the same as the passing type of addinput (), it cannot be passed into the fluid.Will be discarded)

additeMinput (ingredient input)

#Example

additeMINPut (*64)

#*** Only modular machinery: Community version ***

addIteminput (*64)

#*** Modular mechanical original version equivalent writing method, the community version has abandoned ***

addIteminput (, 64)

// Add items output and support withtag (), which can be an item or mineral resignation (although it is the same as the passing type of addoutput (), it cannot be passed into the fluid and will be discarded)

additemoutput (ingredient input)

#Example

additemoutput

#*** Only modular machinery: Community version ***

additemoutput (*64)

#*** Modular mechanical original version equivalent writing method, the community version has abandoned ***

additemoutput (, 64)

fluid:

 // Add fluid input

addfluidinput (IliquidStack Stack)

#Example

addfluidinput (*1000)

addfluidinput ()

// Add fluid output

addfluidoutput (IliquidStack Stack)

#Example

addfluidoutput (*1000)

addfluidoutput ()

gas:

 // *** When installing universal machinery, you can use ***

// Add gas input

addgasinput (String Gasname, int AMount)

#Example

addgasinput ("FusionFuel", 1000)

// Add gas output

addgasoutput (String Gasname, int AMount)

#Example

addgasoutput ("Fusionfuel", 1000)

Note: The gas name of General Machinery can be obtained by holding a gas storage tank containing a specific gas, and then executing the instruction /CT Hand to obtain it through the TAG. As shown in the figure below, the dual quotation number is removed in the red box, which is the gas name (keyword: the rear content of the Gasname).

gas

energy:

 // Add each tick energy consumption

// Note: The maximum value is the upper limit of Long, which is close to infinite.

Addenergypertickinput (Long PERTICK)

#Example

addnergypertickinput (2147483648)

// Add each Tick energy output

// Note: The maximum value is the upper limit of Long, which is close to infinite.

AddenerGypertickoutPut (Long PERTICK)

#Example

Addenergypertickoutput (2147483648)

A specific type of multiple input output

thing:

 // Add a variety of items input to support withtag (), which can be an item or mineral resignation (although it is the same as the passing type of addinputs ()Fluid, you will be discarded) additeMINPUTS (IINGREDIENT ... Input)

#Example

additeminputs

additeMINPUTS (*64, *64, *64)

additeMinPuts ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

*64,

*64,

*64,

])

additeminputs (

*64,

*64,

*64

Cure

// Add a variety of items output and support withtag (), which can be an item or mineral resignation (although it is the same as the passing type of addoutputs (), but it cannot be passed into the fluid, and it will be discarded)

additemoutputs (ingredient ... input)

#Example

additemoutputs ([*64, *64, *64,])

additeMoutPuts (*64, *64, *64)

additemoutputs ([[[[[[[[[[[[[[[[[[[[[[[[[[

*64,

*64,

*64,

])

additemoutputs (

*64,

*64,

*64)

fluid:

 // Add a variety of fluid input

addfluidinputs (IliquidStack ... Stacks)

#Example

addfluidinputs

addfluidinputs (*1000, *1000)

addfluidinputs ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

*1000,

*1000,

])

addfluidinputs (

*1000,

*1000

Cure

// Add multiple fluid output

addfluidoutPuts (IliquidStack ... Stacks)

#Example

addfluidoutPuts

addfluidoutPuts (*1000, *1000)

addfluidoutPuts ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

*1000,

*1000,

])

addfluidoutPuts (

*1000,

*1000

)

special

Probability:

 // Set output probability, support set types (including mineral resignation) and fluids, and material groups (only community versions). Others do not support

// SetChance can only be added after adding items, otherwise it is illegal call. For detailed usage, please refer to the following example

// A variety of input and output (such as: addinputs (), addoutputs ()) does not support setting probability

//1.0 is 100%, 0.0 is 0%

SetChance (Float Chance)

#Example

addIteminput (<<<). SetChance (0) // Never consume it

addfluidinput (). SetChance (0.22) // 22%probability consumption

additemoutput (). SetChance (0.3) // 30%probability output

addfluidoutput (). SetChance (1) //?IntersectionIntersection

Component tag matching:

 // Set component tag matching (advanced)

// Note: This is not NBT!Please use the Withtag () that comes with CRT to set NBT!

settag (String Selectortag)

Component TAG is a high -level feature that allows the author to specify the input and output warehouse of the item (not only limited) (need to be defined in mechanical files)

The following figure is an example:

 // Once a TAG is set, then there is more than one item output warehouse in the mechanical structure, the redstone will always be exported to "selector-tag" to "Receiver_ARRAY_STRUCTURE"The output warehouse, input or other fluids are the same.

additemoutput (). settag ("Receiver_array_Struction");

Material group

The material group is a specific set of items, which only consumes one of the items of this group of items.

The content of the material group can be mineral or objects, and each item supports setting its own consumption probability and quantity.

Note: Currently only support items input, and do not support items output

Material group

ZS usage:

 // Add the input of the item group, the effect is equivalent to the picture above

addingredientarrayinput (

IngredientarrayBuilder.newbuilder ()

.AddingRedients ([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

,

,

*2,

*2,

])

.Build () // Build () is optional, but the cause of obsessive -compulsive disorder (fog)

)