your current location:首页 > news>Use CM and KJS to create a complex NBT formula instance-digital suffering well (pseudo) [cm] CUSTM MACHINERY MINECRAFT G

Use CM and KJS to create a complex NBT formula instance-digital suffering well (pseudo) [cm] CUSTM MACHINERY MINECRAFT G

2024-12-10 17:55:53|Myriagame |source:minecraft skins

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

Version 1.16.5

First create a machine

 {{

"Name": "block.custommachinery.digital_agonizer",, "

"APPEARANCE": {

"Block": "Hostilenetworks: Loot_fabricator",,

"Light": 1,

"Hardness": 4,

"Resistance": 3000,

"Mining_level": 0

},

"Components": [[

{{

"Id": "data_model",

"Type": "Custommachinery: Item",

"Filter": ["Hostlinetworks: Data_model"],

"Whitelist": true

},

{{

"Type": "Custommachinery: Energy",

"Capacity": 1000000

},

{"Id": "live_essence_flum",

"Type": "Custommachinery: Fluid",

"Capacity": 10000, 10000,

"Filter": ["Bloodmagic: Life_essence_flum"],

"Whitelist": true

}

],,,

"gui": [

{{

"Type": "Custommachinery: slot",

"X": 191,

"Y": 49,

"Id": "data_model"

},

{{

"Type": "Custommachinery: Texture",

"X": 40,

"Y": 35,

"Texture": "Bloodmagic: Textures/GUI/Masterroutingnode.png"},

{{

"Type": "Custommachinery: Texture",

"X": 191,

"Y": 49,

"Width": 18,

"Height": 18,

"Texture": "Hostilenetworks: Textures/GUI/Slot.png"

},

{{

"Type": "Custommachinery: Texture",

"X": 23,

"Y": 35,

"Texture": "Hostilenetworks: Textures/GUI/DIGITAL_AGONIZER.PNG" "" "

},

{{

"Type": "Custommachinery: Energy", "X": 27,

"Y": 45,

"Width": 7,

"Height": 100,

"EMPTYTEXTURE": "HostileNetworks: Textures/Gui/Energy_empty.png",

"FilledTexture": "HostileNetworks: Textures/Gui/Energy_filled.png"

},

{{

"Type": "Custommachinery: Fluid",

"X": 119,

"Y": 49,

"Height": 18,

"Texture": "Custommachinery: Textures/Gui/Base_slot.png",,

"ID": "live_essence_flum"

},

{"Type": "Custommachinery: Player_inventory",

"X": 47,

"Y": 73

},

{{

"Type": "Custommachinery: Text",

"X": 48,

"Y": 40,

"Text": "block.custommachinery.digital_agonizer"

},

{{

"Type": "Custommachinery: Text",

"X": 48,

"Y": 62,

"Text": "Container.Inventory"

}

],,,

"jei": [

{{

"Type": "Custommachinery: slot", "x": 119,

"Y": 49,

"Id": "data_model"

}

]

}

The following is the material

slot.png

Energy_filled.png

Energy_empty.png

digital_agonizer.png

Then add a formula

 if (platform.getmods (). Containskey ('Custommachinery') &

Platform.getmods (). Containskey ('HostileNetworks') &

Platform.getmods (). Containskey ('Bloodmagic') {{

Const valueMap = New Map ([['hostilenetworks: slime', 15]];

Onevent ('recipes', event => {

Event.shaped (item.of ('custommachinery: custom_machine_item', '{Machine: "Hostilenetworks: Digital_Agonizer"}'), [[} '), [

'N',

'Wow',

'Gcg'

], {{

N:#Forge: Ingots/Netherite ',

W: 'Bloodmagic: Weakbloodorb', O:#Forge: Obsidian ',

G:#Forge: Ingots/Gold ',

C: Minecraft: Comparator '

});

Event.recipes.custommachinery.custom_machine ('Hostilenetworks: Digital_agonizer', -1), -1)

.RequirenerGypertick (128)

.RequirefunctionachTick (ctx => {{

Let machine = ctx.machine;

Let nbt = Machine.getItemstored ('data_model'). Nbt;

If (nbt! = Null) {

Let v = 10;

If (valueMap.has (`$ {nbt ['data_model'] ['id']}) {) {

V = valueMap.get (`$ {nbt ['data_model'] ['ID']}}

Let data = nbt ['data_model'] ['data'];

If (data> = 1254) {v+= 300}

Else if (data> = 354) {v+= 150}

Else if (data> = 54) {v+= 75}

Else if (data> = 6) {v+= 50}

Machine.addflum (FLUID.OF ('Bloodmagic: Life_essence_fluid', V), FALSE;

Return result.success ();

} Else {

Return result.error ("can'T find data model");}

})

})

}

17 lines set the formula to negative number, so that the formula is unlimited execution

Line 19-37 uses the RequireFunctionACHTICK () method, and you must return to result

24-25 Ried to retrieve the element of ValueMap. If it contains the specified NBT, set the initial value

After testing, a template strings must be used, tostring () or directly pass in can not be judged normally

28-31 Judgment data model level, increase LP according to different levels

32 Line adds the source of life of life to the fluid slot position

Actual effect

Known problem: The selection box of the machine will become transparent, resulting in the effect of the bezel.

Temporary solution: open light shadow, modify the color of the selection box