your current location:首页 > news>[1.12.2] [sharing of COT and CRT script file] Let your integration package have a coarse mine![COT] ContentTweaker Minec

[1.12.2] [sharing of COT and CRT script file] Let your integration package have a coarse mine![COT] ContentTweaker Minec

2024-12-09 18:31:31|Myriagame |source:minecraft skins

This tutorial is set by the author to use the CC by-NC protocol.

Foreword

This tutorial uses 1.12.2 COT and CRT. The code used in other versions is not necessarily the same, but the idea can be referred to

In fact, there is nothing to read in this paragraph, just say what this thing is because it is written by what it is written

On a certain day, I turned the MOD's config modified mineral production. I was exhausted. I was enough to turn Config to unify the mineral method, but I didn't want to introduce the new MOD to solve it.The high version mechanism can also be disguised unified minerals

Six types of copper ore are dug very scary

How to generate the required crude ore

As we all know, COT can customize items, but if a rough mine required for registration and adding materials, it is a bit too troublesome

So here you can use the material system function of COT

#loader contenttweaker

Import Mods.ContentTTWEAKER.MATERIALSTEM;

Import Mods.ContentTTweaker.part;

Function raneReregister (name as string, color as string) {{

Val raworematericalpart as part [] = [materialSystem.getPartbuilder (). Sename ("raw_ore"). lay (false) .setOreDictName ("rawore"). Build ();

MaterLialSystem.getmaticBuilder (). Setname (name) .setcolor (color) .build (). Registerparts (raworemater later);

}

// This is an example

Raworkregister ("Gold", 0xffff00); // Gold

Like this, we have obtained a custom function that generates the materials we need. Through this function, we have obtained a rough gold mine with a mineral word for raworegold.Corresponding color

How to add this base material?Go left to the left to turn to the COT customized item tutorial next door, named RAW_ore.png

How to localize the name of this rough mine?Look at the tutorial of friendship Mom Chinese, I find it good

How to use custom rough ore to modify

Related minerals and coarse ore

We have a rough mine, we need to associate him with the ore

The event of CRT should be used here

 Import Crafttweaker.event.blockharveStdropSevent;

For Ench in Oredict.entries {// Circle in all OD

Var oreName = ENCH.NAME; // Get OD name

Var Enchgear = ENCH.FIRSTITEM; // Get the first item of OD

If (orename.startswith ("rawore") {// If rawore in the OD name, start processing

Var rawore = orename.substring ("rawore" .Length); // Get the corresponding metal name var ore = ionict.get ("ore"+rawore); // Obtain the mineral dictionary of the ore corresponding to the metal

If (! Ore.empty) {

Events.onBlockharveStdrops (Function (Event As Blockharvesteddropsevent) {{

If (! Event.World.remote) {

If in event.drops [0] .stack) {

If (event.drops.length == 0 || event.silktouch) {// Detect whether there are accurate collection

Event.drops = [ore.firstitem*1%100]; // If so, dig out the first ore corresponding to this ore word

Return;

} Val Fortune = EVENT.FORTUNELEVEL; // Demoning the enchantment level during detection

Value = event.World.random.nextint (0, (Fortune+1)); // Get a random number, the range is 0 to time of time +1 +1

Var SL = 0;

If (Random> 1) {// If the random number is greater than 1, the drop quantity is random number

SL+= Random;

} Else {// Otherwise, drop 1

SL+= SL*0+1;

} Event.drops = [Enchgear*SL%100];

}

}

});

}

}

In this way, we automatically associate ore and coarse ore, so as to generate a rough ore to allow all corresponding ore to dig out the crude ore, and support the effect of time transportation and precise collection

Of course, this mineral that cannot stop the minerals without minerals can manually add the corresponding mineral words, or write a for yourself to add the corresponding mineral words to these minerals

How to deal with these rough ore

When I got the mineral, I naturally need to deal with it. Originally, I wanted to open a formula separately to add formulas to these minerals, but two days ago, I saw this tutorial, and the clever movement. Why not write together?

So there is

 for ench in oredict.entries {

Var oreName = ENCH.NAME;

Var enchgear = ENCH.FIRSTITEM;

If (orename.startswith ("rawore") {{) {

Var rawore = orename.substring ("rawore" .length);

Var ol = ouredict.get ("ol"+rawore); // ore

Var Shard = ORDICT.GET ("Shard"+Rawore); // Fragment

Var clump = ouredict.get.get ("clump"+rawore); // crushed block var dust = oredict.get ("dust"+rawore); // Powder

Var nugget = ougict.get.get ("nugget"+rawore); //

Var Crushed = ORDICT.GET ("Crushed"+rawore); // crushed ore

If (! Dust.empty &&! Nugget.empty &&! Ore.empty) {// Make sure the items have corresponding powder, grains, ore

If (! Shard.empty &&! Clump.empty) {// Make sure that the corresponding items containing MEK four times and three times ore

Mods.mekanism.Chemical.inject.Addrecipe (ENCHGEAR*3, , Shard.firstitem*8);

Mods.mekanism.purification.addrecipe (Enchgear*1, Clump.firstitem*2); // Pure

}

If (! Crushed.empty) {// Make sure to contain IC2 crushing ore

MODS.IC2.MACERATOR.ADDRCIPE (Crushed.firstitem*4, Enchgear*3);

} Mods.mekanism.enrichment.addrecipe (Enchgear*3, Dust.firstitem*4); //

FuRNACE.ADDRECIPE (nugget.firstitem*6, Enchgear); // The furnace is directly burned

// Digging the crude mine

Events.onBlockharveStdrops (Function (Event As Blockharvesteddropsevent) {{

If (! Event.World.remote) {

If in event.drops [0] .stack) {

If (event.drops.length == 0 || event.silktouch) {

Event.drops = [ore.firtstitem*1%100];

Return;

}

VAL FORTUNE = EVENT.FORTUNELEVEL; VAL RANDOM = EONT.WORLD.RANDOM.NEXTINT (0, Fortune+1));

Var SL = 0;

If (Random> 1) {

SL+= Random;

} Else {

SL+= SL*0+1;

}

Event.drops = [ENCHGEAR*SL%100];

}}

});

}

}

}

In the example, MEK's 4,3,2 times ore was generated, and the powder formula of IC2 was generated.

Here I use Jaopca for items to generate laziness. In fact, it can be combined with the tutorials that just link to the linked direction.This set of logic is regardless of the by -product

In this way, we have completed a set of scripts that only need to register the mineral word name and corresponding color in the COT file.