your current location:首页 > news>MMCE upgrade system use tutorial [mmce] modular mechanical: community version (Modular Machinery: Community Edition) Min

MMCE upgrade system use tutorial [mmce] modular mechanical: community version (Modular Machinery: Community Edition) Min

2024-12-10 17:50:29|Myriagame |source:minecraft skins

Applicable people in this tutorial: people who install modules, configure the environment, and can be proficient in Zenscript.

Applicable version: mmce-1.11.1-R39.


MMCE has added an upgrade system in the R39 version. It has not yet been completed but the basic functions are already available.

Create and upgrade

First of all, we need to import the class:

 Import Mods.modularMachinery.machineupGradebuilder; 

Next, create an upgrade:

 MachineUpgradebuilder.newbuilder (String name, String LocalizedName, Int Level, Int Maxstack);

// Level has no effect yet; name must be unique.

Then, you can do many operations on the created MachineupGradebuilder object:

 MachineUpgradebuilder AddDDDEScriptions (String ... Descriptions); // Add fixed tool prompts to upgrade, and it can be displayed on the upgraded items; it can be multi -line.

MachineupGradebuilder SetbusguideScriptHandler (iFunction Handler); // Add event monitoring to upgrade the upgrade bus prompts to monitor event monitoring

MachineupGradebuilder addcompatibleMachnes (String ... Machinenames);

MachineupGradebuilder addincomPatibleMachnes (String ... Machinenames);

// The above two are adding a whitelist and adding blacklist machines. When not in use, all machines will take effect by default; these two methods conflict with each other.

MachineupGradebuilder AddrecipeCheckhandler (upgradeeventhandlerct handler);

MachineupGradebuilder adDRecipestarthandler (upgradeeventhandlerct handler);

MachineupGradebuilder AddRecipePretickhandler (upgradeeventhandlerct handler);

MachineupGradebuilder AddRecipePosttickhandler (upgradeeventanthandlerct handler);

// ...

// These events can be in the source code warehouse

// SRC/Main/Java/Hellfirepvp/ModularMachinery/Common/Integration/Crafttweaker/Upgrade/MachineupGeBuilder.java

// turn up.

// Specific usage, refer to the example below and src/main/java/hellfirepvp/modularMachinery/Common/Integration/Crafttweaker/Event/Mmevents.java.

// In fact, most of the needs of upgrading can be implemented here.

Example:

 Import Mods.modularMachinery.MachineupGradebuilder as builter;

Builder.newbuilder ("Upgradename", "Upgrade", 1,64) .setBusguideScriptHandler (Function (SimpleMachineupGrade) {

Return ["text",] as string [];

}). AdDRecipeCheckhandler (Function (MachineupGrade) {

// Related code

})

Event -related class

You may notice some questions, such as SimpleMachineupGrade and MachineupGrade.

SimpleMachineupGrade can be obtained in SetbusguideScriptionhandler event, which can be obtained from the custom IDATA -CustomData stored in the upgrade bus.Note that the members are Zengetter and Zensetter at the same time; they can also obtain the number of upgrades, through [Zengetter] Stacksize.

Machineupgrade will be obtained in all formulas, please use the following ways to force:

 Import Mods.modularMachinery.machineupGradehelper;

SimpleDynamicmicmachUPGrade CastToSimpleDynamicalnamachineupGrade (MachineupGrade Upgrade);

Of course, there is a class called SimpleDynamicMachnetupgrade, but because the above is a simple upgrade, this class cannot be used; but when you use DY NamicMachineupGradebuilder to create a dynamic upgrade, the obtained MachineupGrade is all Simpledynami CmachineupGrade, please convert it in a similar way.SimpleDynamicmicMachineupGrade has an additional IDATA stored on items than SimpleMachineupgrade, that is, ItemData, which is the same as CustomData.

Binding item

 Import Mods.modularMachinery.machineupGradehelper;

addfixedupGrade (IITEMSTACK Itemstack, String Upgradename);

There is nothing to say, Upgradeename is the only name at the time of registration and upgrade. After using this method, items can be used as upgraded and upgraded bus and play a role.