2024-12-09 18:31:47|Myriagame |source:minecraft skins
This tutorial is set by the author to use the CC by-NC protocol.
Foreword
Recently, it was tinkering with the GTL integrated package, and found that it lacked a formula for pouring all kinds of crushed, flawless, flawless crystals.
The gem that is hard to sieve hard can't be fascinated, I can't bear it!Bleak
It took some time to study the JS grammar and the Kubujs script solved this problem. Based on the integrated package version 1.4.1.3
After sorting the next idea, you can divide the script into three steps
List of read items by label
Generate input and output and recipeid list
Execute recipe registration
List of items
Kubejs has a related interface in its Turial, as follows
EventServerevents.tags ('item', event => {{// add all ites from the forge: stone tag to the c: stone tag, unless the idrs diorite
Const stones = event.get ('Forge: Stone'). GetObjectids () // author Note: Here you read all the lists containing input tags, returned an OBJ type array array
Const BlackList = Ingredient.of (/.* Diorite.*/)
Stones.Foreach (Stone => {{
If (! Blacklist.test (stone)) Event.add ('C: Stone', Stone)
})
})
Through Event.get ('Forge: Stone'). GetObjectids () can successfully obtain an array of items containing items
So you can make the following sentences
Let ChippedgemsObjlist = Event.get ('Forge: Chipped_gems'). GetObjectids ()There is a point that needs to be noted.The Typeof keyword is determined that it is an array of Java.util.arraylist, which is composed of the current unknown OBJ type.Let FlawedgetGemsObjlist = Event.get ('Forge: Flawed_gems'). GetObjectids ()
Let FlawlessgetGemSObjlist = Event.get ('Forge: Flawless_gems'). GetObjectids ()
Let ExquisiteGemSObjlist = Event.get ('Forge: Exquisite_gems'). GetObjectids ()
But the problem is not big, you can obtain the attributes and values of the OBJ type through the following code
// Do non -empty judgment to avoid errorsIf (chippedGemsobjlist.isempty () == false)
{{
// Access specific elements through get (int index)
Let obj = chippedgemsObjlist.get (0) .namespace
// Print parameters of each attribute
Object.keys (obj). Foreach (key => {{
Console.log (`$ {key}: $ {obj [key]}`);
});
}
Reload, get the following output:
[17:41:19] [info] debug.js#52: Withpath: function[17:41:19] [Info] Debug.js#52: Getclass: Function
[17:41:19] [Info] Debug.js#52: WAIT: Function
[17:41:19] [Info] Debug.js#52: Toshortlanguagekey: Function
[17:41:19] [Info] Debug.js#52: Withprefix: Function
[17:41:19] [Info] Debug.js#52: NotifyAll: Function
[17:41:19] [Info] Debug.js#52: setpath: function
[17:41:19] [info] debug.js#52: compareto: function
[17:41:19] [Info] Debug.js#52: notify: function
[17:41:19] [Info] DEBUG.JS#52: Path: Chipped_Rock_SALT_GEM
[17:41:19] [Info] Debug.js#52: TolanguageKey: Function
[17:41:19] [Info] Debug.js#52: Getnamespace: Function
[17:41:19] [Info] Debug.js#52: HashCode: Function [17:41:19]
[17:41:19] [info] debug.js#52: comparenamespaced: function
[17:41:19] [Info] Debug.js#52: Getpath: Function
[17:41:19] [info] debug.js#52: namespace: gtceu
[17:41:19] [Info] Debug.js#52: Tostring: Function
[17:41:19] [Info] Debug.js#52: Setnamespace: Function
[17:41:19] [Info] DEBUG.JS#52: Class: Class Network
[17:41:19] [Info] Debug.js#52: Specialequals: Function
[17:41:19] [Info] Debug.js#52: Withsuffix: Function
[17:41:19] [Info] Debug.js#52: TODEBUGFILENAME: FUNCTION
Notice that namespace in the parameter represents the module of the item, Path represents the ID of the item
OBJ type array cannot be processed by string, and it needs to be converted to the String type array
// Use the Foreach method to directly traverse the namespace and PATH properties of each element to store it into the new arrayFunction getGeminput (GemSObjlist) {{
Let ReturnStringlist = []
Gemsobjlist.Foreach (AAA => {{
ReturnStringlist.push ("1x"+AAA.NameSpace+":"+Aaa.path)
})
Return ReturnStringList
}
Don’t forget the list of four labels before reading, here the four lists are merged
I used the Concat method to set the baby
Let GemSObjlist = ChippedGemSObjlist.Concat (FlawedGemsobjlist.Concat (FlawlessGemsobjlist.CONCAT. jlist)))
I have read the list here
It looks very simple and refined. In fact, it has been stuck for a long time.
Generate recipeid and output products
I read the inputs of four types of labels before, and the four labels need to distinguish different products
Therefore, four kinds of constant numbers are defined
Two input parameters are added to the function of the production product array, which are prefix (the control product is small powder, ordinary powder or small pile of powder, and quantity), type (identifying which kind of shattered gem), to distinguish it to distinguish
const prefix_chipped = "1x gtceu: tiny_"Const prefix_flawed = "2x gtceu: small_"
Const prefix_flawless = "2x gtceu:" "
Const prefix_exquisite = "4x gtceu:"
Const type_chipped = "chipped"
Const type_flawed = "Flawed"
Const type_flawless = "Flawless"
Const type_exquisite = "exquisite"
Function getGemoutput (GEMS, Prefix, Gemtype) {
Let ReturnList = []
Gems.Foreach (GEM => {
Let segments = gem.path.split ("_");
Let filedsegments = segments.filter (segment => segment! == Gemtype &&SEGMENT! == "Gem");
Let newsnt = prefix+filedsegments.join ("_")+"_dust";
ReturnList.push (Newslement);
}) Return ReturnList
}
Actually call, call the input product array separately, store it in the output product array, and finally the Concat package to a array
Let ChippedoutPut = getGemoutput (ChippedgemsObjlist, Prefix_Chipped, Type_Chipped)Let FlawedoutPut = getGeMoutPut (FlawedgemsObjlist, Prefix_flawed, Type_flawed)
Let FlawlessoutPut = getGemoutPut (Flawlessgemsobjlist, Prefix_flawless, Type_flawless)
Let ExquisiteoutPut = getGemoutput (exquisitegemsObjlist, Prefix_exquisite, Type_exquisite)
Gemoutput = Chippedoutput.concat (FlawedoutPut.Concat (FlawlessoutPut.concat (ExquisiteoutPut))
At this point, the output product array is completed
In the same way, you can get the recipeid array to distinguish each recipe and define a processing function
Function GetGemRecipeid (Gemsobjlist) {Let RetrunStringListRcipeid = []
Gemsobjlist.Foreach (AAA => {{
RetrunstringListRecipeid.push (AAA.Path+"2DSUT")
})
Return RetrunStringListRcipeid
}
Direct the total input product array to call this function to generate the recipeid array
GemRecipe = GetgetmRcipeid (Gemsobjlist)
The arrays used in batches to generate all array is generated. The next step is to generate in batches
Batch generation
Travel directly with arrays, because the type returned from the query function did not use the query function in the previous definition, but the String array type, so you can use the form of XXX [y] to index
For (let i = 0; I {{ Event.recipes.gtceu.macerator (GemRecipe [i]) .Iteminputs (Geminput [i]) .ItemoutPuts (Gemoutput [i]) .Eut (gtvalues.va [gtvalues.ulv]) .Duration (20) } }) Code The text above is to explain each part separately. Here Let Gemrecipe = [] Let Geminput = [] let gemoutput = [] // Generate the recipeid list Function GetgetGeMRECIDEID (Gemsobjlist) {{ Let RetrunStringListRcipeid = [] Gemsobjlist.Foreach (AAA => {{ RetrunstringListRecipeid.push (AAA.Path+"2DSUT") }) Return RetrunStringListRcipeid } // Generate the list of input items Function getGeminput (GemSObjlist) {{ Let ReturnStringlist = [] Gemsobjlist.Foreach (AAA => {{ ReturnStringlist.push ("1x"+AAA.NameSpace+":"+Aaa.path) }) Return ReturnStringList } // Generate the list of output items Function getGemoutput (GEMS, Prefix, Gemtype) { Let ReturnList = [] GEMS.Foreach (GEM => {let segments = gem.path.split ("_"); Let filedsegments = segments.filter (segment => segment! == Gemtype &&SEGMENT! == "Gem"); Let newsnt = prefix+filedsegments.join ("_")+"_dust"; ReturnList.push (Newslement); }) Return ReturnList } // Monitor the label event, read the list by label and generate input output and recipceid ServerEvents.tags ('item', event => {{ Const prefix_chipped = "1x gtceu: tiny_" Const prefix_flawed = "2x gtceu: small_" Const prefix_flawless = "2x gtceu:" " Const prefix_exquisite = "4x gtceu:" Const type_chipped = "chipped" Const type_flawed = "Flawed" Const type_flawless = "Flawless" Const type_exquisite = "exquisite" Let ChippedgetGemsObjlist = Event.get ('Forge: chipped_gems'). GetObjectids () Let FlawedgemsObjlist = Event.get (' FORGE: Flawed_ gems'). GetObjectids () Let FlawlessgetGemSObjlist = Event.get ('Forge: Flawless_gems'). GetObjectids () Let exquisitegemsObjlist = Event.get ('Forge: Exquisite_gems'). GetObjectids () Let GEMSOBJLIST = ChippedGemSObjlist.Concat (FlawedGemsObjlist.Concat (FlawlessgemsObjlist.Concat (ExquisitegemsObjlist)) GemRecipe = GetgeMRECIDEID (Gemsobjlist) Geminput = getGeminput (GEMSOBJLIST) Let ChippedoutPut = getGemoutPut (chippedgemsobjlist, prefix_chipped, type_chipped) Let FlawedoutPut = getGeMoutPut (FlawedgemsObjlist, Prefix_flawed, Type_flawed) Let FlawlessoutPut = getGemoutPut (Flawlessgemsobjlist, Prefix_flawless, Type_flawless) Let ExquisiteoutPut = getGemoutput (exquisitegemsObjlist, Prefix_exquisite, Type_exquisite) Gemoutput = chippedoutput.concat (FlawedoutPut.Concat (FlawlessoutPut.concat (ExquisiteOutPut)))) }) // Import formula ServerEvents.recipes (event => {{ For (let i = 0; I {{ Event.recipes.gtceu.macerator (GemRecipe [i]) .Iteminputs (Geminput [i]) .ItemoutPuts (Gemoutput [i]) .Eut (gtvalues.va [gtvalues.ulv]) .Duration (20) } }) Ultimate effect
// Add broken, flawless, flawless, exquisite gem pieces
National Service DNF Dark Ni
2025-01-28 09:19:27The new screenshot of the be
2025-01-28 09:18:57The 15th anniversary wallpap
2025-01-28 09:18:273DM Xuanyuan Sinicization Gr
2025-01-28 09:17:57French magazine is the first
2025-01-28 09:17:27The sneak game "Republic" wi
2025-01-28 09:16:57The story between humans and
2025-01-28 09:16:27Capture "Trinity 3: Artifact
2025-01-28 09:15:27Wind direction change "Myste
2025-01-28 09:14:57DICE's new project "Dream" w
2025-01-28 09:14:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:26Master Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25King Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25Guide Minecraft Skins
Minecraft Skins
2024-12-10 04:11:24Dark Knight Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Sparta Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Moncraft Skins of the War
Minecraft Skins
2024-12-10 04:11:22Red Witch Minecraft Skins
Minecraft Skins
2024-12-10 04:11:22Golden Cavaliers Minecraft S
Minecraft Skins
2024-12-10 04:11:22