your current location:首页 > news>Part.4.1 Parallel formula -modular machine

Part.4.1 Parallel formula -modular machine

2024-12-10 17:49:31|Myriagame |source:minecraft skins

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

Modular machine: community version from entry to the soil -PART.4.1 parallel formula processing

This tutorial is displayed by displaying modular machinery: special features of the community version.

The main modules used in this tutorial are modular machinery: community version -1.11.1 -R55, Crafttweaker.

Tutorial directory:

Part.1 Basic Machinery Creation

Part.2 Basic Formula Create

PART.3.1 Advanced formula application

Part 3.2 Formula adapter recipeadapter

Part.3.3 Mechanical Event System

Part.4.1 parallel formula processing (currently)

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)

Part.extra.1 Geckolib model/animation

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.

In addition, it is recommended to install the VSC plug -in Zenscript Intelisense and supporting module Probezs, which can greatly enhance your ZS script writing experience.

Reading this tutorial means that you are familiar with most of the advanced use of Zenscript, and you have learned about basic mechanical creation and formula creation.

introduce

From the MMCE version R23, the machinery began to support the parallel formula of the class GT, allowing one operation to handle multiple same formulas at once.

Note: It has nothing to do with the factory system, and the two are independent of each other.

This tutorial is providing some related ZS APIs for the authors of the magic reform, and introduces part of the operating principle.

Parallel controller

By default, Mmce comes with 5 parallel controllers. When these controllers are located in the mechanical structure, the machine can automatically perform parallelization of the formula.

This is the most basic way to provide parallelization.

The five parallel controller is called "parallel controller", "reinforcement parallel controller", "elite parallel controller", "super parallel controller", and "ultimate parallel controller".

The default parallel number is 4,16, 64, 256, 512 from left to right.

Tip: You can adjust the maximum parallel parallel number of parallel controllers in the paradlel-Controller category in the Modularmachry asyry.cfg configuration file.

Parallel controller

Right -click the parallel controller to open the GUI, allowing players to adjust the parallel number provided by each parallel controller.

The minimum can be set to 0, the maximum parallel number of parallel controller.

Number of parallel number

The maximum parallel number represents the number of parallels provided by the parallel controller to the controller.

The current parallel number represents the parallel number of parallel controller currently provided by the controller.

6 buttons can click to adjust the related parallel number.

You can input the accurate value in the input box to adjust the parallel number of parallel controller.

Parallel controller GUI

If theONEPROBE is installed, you can also display information in the Top window.

Top information

Parallel conditions / principle explanation

When trying a formula in parallel, the controller will determine the parallel number of formulas in the following order:

Parallelization judgment -> parallel number calculation-> additional parallel number calculation-> formula parallel number calculation-> check formula execution status-> start formula

Different colors represent different major stages in parallel computing. Each stage must be checked to go to the next stage. Next, we will introduce the small stage of each calculation one by one.

Paralization judgment

At this stage, the controller will determine whether its own machinery has enabled parallel, and then determine whether the target formula is enabled. If the two are not met, the parallel calculation is terminated and the general formula is processed.

Calculation of parallel number

After passing the parallelization judgment, the controller will check all the effective parallel controllers (that is, the parallel controller of the parallel number> = 1) in its own structure, and add it to the maximum parallel number.

In addition, the final value will be coupled with the built -in parallel of our own machinery, and finally the maximum number of parallel parallels in our formula will be obtained (it will not exceed the maximum parallel number of mechanical definitions).

Extra number of parallel calculations

If the final running time of the formula is less than 1 tick (also known as 1 tick wall), the controller will be calculated additionally.For the current parallel number is p, the running time is t, and the final parallel number is FP, the calculation method is as follows:

Fp = p x (1 / t)

FP is our new formula maximum parallel number.

Calculation of recipe parallel number

After the calculation of the parallel number is completed, each needs of each formula (can also be called input/output) will be performed at a parallel calculation to obtain the maximum parallel number allowed per required.Essence

Then the parallel number of the formula will take the minimum value of these requirements. At this point, the parallel number of our formula has been settled.

Check the formation of the formula

If the number of parallel lines of the formula is less than 0, it means that some of the demand in the formula is lacking. At this time, the parallel calculation termination is terminated, and the failure part is calculated according to the normal formula, and an error message is output to the controller status.

Start formula

If all the above stages are met, the controller starts running and the controller displays the current parallel number and the maximum parallel number.

Controller parallel number display

If theONEPROBE is installed, the number of parallel and maximum parallel number of the current controller will be displayed in the TOP window.

TOP parallel number display

Zenscript API

Most of the advanced operations of the parallel system provide Zenscript API, which will be displayed one by one.

Enable/disable machinery parallel

 // Note: Need a modular mechanical version R56.

// Machinename is a mechanical registration name. Parallelizable is enabled/disabled in parallel. TRUE is enabled, False is disabled.

Machinemodifier.setparallyLizable (String Machinename, Boolean Parallelizable);

Machinemodifier.setparalleLizable ("test_machine", false); // The mechanical named "test_machine" is set to disable parallelization.

// Set the machine named "Test_machine" to enable parallelization.

Machinebuilder.getBuilder ("test_machine").

Enable/disable formula parallel

 recipebuilder.newbuilder (...). SetparalleLized (false) // Set this formula as incredible.

Recipebuilder.newbuilder (...). Setparallelized (true) // Set this formula to parallelization.

Machinery is the largest parallel

 // Machinename is a mechanical registration name, and Parallelism is the maximum parallel number.

Machinemodifier.setmaxparalism (String Machinename, Int Parallelism);

Machinemodifier.setmaxparalism ("Test_machine", 128); // The maximum number of parallel number of mechanical settings called "test_machine" is 128.

// Set the machine named "TEST_MACHINE" to the maximum parallel number of parallel.

Machinebuilder.getBuilder ("test_machine").

Machine built -in parallel

The built -in parallel is a way to provide parallel numbers in addition to the parallel controller. The disadvantage is that it is not configured at present.

 // Machinename is a mechanical registration name, and Parallelism is a built -in parallel number.

Machinemodifier.Setinternalparalism (String Machinename, Int Parallelism);

Machinemodifier.Setinternalparalism ("Test_machine", 64); // The mechanical settings of the registered registered called "test_machine" have a built -in parallel number of parallel.

// Set the machine named "test_machine" to set the built -in parallel number of 64.

Machinebuilder.getBuilder ("test_machine").

catalyst?Programming circuit?

Suppose we create an object input that can be used to accelerate, such as catalysts, or a programming circuit -like existence. By default, parallel calculation will calculate the maximum value of all input and output. At this time, we need to do it for it for it.Set to "non -affected" (grid temperature is not affected).

 recipebuilder.newbuilder (...)

.Addinput (*1) .setparalizeunaFFECTED (TRUE) // Set it as not in parallel.

Configuration file analysis

 Parallel-Controller {

#Thether the Machine Parallel RECipe Processing is enabled by default. [DEFAULT: TRUE]

#Is it default to all mechanical opening in parallel?TRUE is enabled and False is disabled.

B: Machine-Parallelize-Enabled-Bydefault = TRUE

#The default max number of parallism for a machine. [Range: 1 ~ 2147483647, default: 2048]

#By default, the maximum parallel number of each mechanical is 2048, and it can also be set up in parallel to each mechanical setting through Zenscript.

I: max-machine-parallelism = 2048

#TheTher Parallel Recipe Processing is Enabled by Default. [Default: TRUE]

#Is it default to all formulas in parallel?TRUE is enabled and False is disabled.B: Recipe-Parallelize-Enabled-Bydefault = TRUE

Normal {

#Defines the max paradlelism for the paralLlel Controller. [Range: 1 ~ 2147483647, default: 4]

#The maximum parallel number of parallel controller is 4.

I: Max-Parallelism = 4

}

Reinforced {

#Defines the max paradlelism for the paralLlel controller. [Range: 1 ~ 2147483647, default: 16]

#The maximum parallel number of reinforced parallel controller is 16.

I: Max-Parallelism = 16

}

Elite {

#Defines the max paradlelism for the paralLlel controller. [Range: 1 ~ 2147483647, default: 64]

#The maximum parallel number of elite parallel controller is 64.

I: Max-Parallelism = 64

}

Super {

#Defines the max paradlelism for the paralLlel controller. [Range: 1 ~ 2147483647, default: 256]

#The maximum parallel number of the super parallel controller is 256.I: Max-Parallelism = 256

}

Ultimate {{

#Defines the max paradlelism for the paralLlel Controller. [Range: 1 ~ 2147483647, default: 512]

#The maximum parallel number of the ultimate parallel controller is 512.

I: Max-Parallelism = 512

}

}