[1.12.2] Use the CRT event to imitate the high version of the mechanical power "use" formula

Not much nonsense, directly on the code.

 // Use formula examples

Deploying (

, // Items used = inputItem

"Minecraft: Grass", // The converted block = inputBlock type string

0, // Meta value of the converted block = inputBlock_Meta (not filled 0)

, //

2, // Meta value converted into the block = inputBlock_Meta (not filled 0)

True // Whether it consumes items used = itemexpended settings to true and consume

// Use the wooden stick (consumption) to convert the grass square into a birch board

Cure

// Image high -version mechanical power "use" formula function

Function Deploying (INPUTITEM As IITEMSTACK, InputBlock as String, InputBlock_Meta as Int, OutputBlock as IITEMSTACK, OUTPUTBLOCK_META AS Int, Itemexpend as Bool) {

Events.onPlayerInteractBlock (Function (event as playerInteractBlock) {{

Var deploying_block = event.block;

Var deploying_item = event.item;

Var deploying_position = event.position;

Var World0 = EVENT.WORLD;

Var Player = Event.player;

If (inputITEM.Matches (deploying_item)) {{

If (! Isnull (deploying_block) && deploying_block.definition.id == inputBlock &&BLOCK.Meta == InputBlock_Meta) { World0.Destroyblock (deploying_position, false);

World0.SetBlockState (OutputBlock.asblock (). Definition.getStateFrommeta (outputBlock_meta), deploy_position)

Event.player.sendstatusMessage (format.red ("" §4 successful! ");

IfMexpend! = False) {

Deploying_item.mutable (). Withamount (deploying_item.amount-1);

}

}

}

});

}

*Need the support of Zenutils

If you want it, take the Copy for free and use love to generate electricity (after all, it is a very simple event to complete)

(I am also a hard -working incident, just do not provide a principle tutorial!)