Real custom machine: event [CRAFTTWEAKER MINECRAFT Game

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

The main modules are CRT and Zen Utils

The function is probably ... probably what mechanism can be done!114514 times stronger than MM!

The defect is ... the rendering animation is relatively stingy. You can only use particles (through instructions, have not written in, and do not want to write (annoyed)), but it is better than MM!

There is also a defect ... very facing the process, the required code ability and the ability to query wiki are relatively high.

You can go to see the cute red lotus limit first.

The activation method of the machine in this article is redstone pulse. If you want other activation methods, you haven't studied it yet ...

The purpose of this article is to show you the new work, oh no, see how powerful the incident is (how powerful the incident is (

As for the quality of the code, we just learned CRR for two or three weeks, which is very bad.

Clown code, just run.

Hurry up and start looking at the example!

Large cover

V1

Made in 20220914 without running special effects.But logic is relatively simple.

Effect

V2 effect is in [MC] Music Altar (CRT X Plant Magic, 1.12.2) _ Bilibili_minecraft

Use the notes box to play in the block of the base where the core of the altar is (octave will be tested)

And the altar (command block) has the right item

You can synthesize (get Tyra Ho)

Modified items:

You can have multiple synthetic tables.However, thousands of synthesis tables are good.

Of course, you can also write music by yourself.Example: "F4+L4X4F4+L4X4L4F4+M4R4M4F4+R4".

The core of the altar can be changed to any guy who will detect red stone pulse, such as the launch, the command block

Multi -blocks of the altar can change at will.

Module 1: Determine the redstone signal.

It may be more metaphysical, but this is the positive solution I have come up.

accomplish

 Function CheckstrongPower (W as IWorld, P as IBLOCKPOS) as Bool {

Value = [ifacing.north (), ifacing.east (), ifacing.south (),

Ifacing.west (), ifacing.down (), ifacing.up ()] as ifacing [];

For I in allfacing {

If (W.GetStrongPower (P.getOffset (i, 1), i)> 0) Return True;

}

Return false;

}

Function Checkrswork (W as IWorld, P as iBlockpos) as bool {

Value = [ifacing.north (), ifacing.east (), ifacing.south (),

Ifacing.west (), ifacing.down (), ifacing.up ()] as ifacing [];

If (CheckstrongPower (W, P)) Return True;

For I in allfacing {

IfckstrongPower (W, P.getOffset (i, 1))) Return true;}

Return false;

}

use

Redstone updates will trigger BlockneIghbornotifyEvent.

We intend to use the blocks of the red stone pulse itself as the core of the altar.

When the core of the altar is activated, checkrswork and then check the blockdata. If Powered <1 is not activated before, then you can work.

Module 2: Detecting multiple squares.

Since I only use/CT BlockInfo to find the META value of BlockState, and I wo n’t find Variant, so let ’s write two copies of Block matching and META matching.

accomplish

 Function match_by_meta (AS IBLOCKSTATE, B AS IBLOCKSTATE, C AS INT) AS BOOL {

Var return = false;

If (a.block.definition.id == b.block.definition.id) {

If (A.META == C | C <0) {{

RET = TRUE;

}

}

Return Ret;

}

Function CheckBlockstates (W as IWorld, P as iBlockpos, x_shift as int, y_shift as int, z_shift as int, multb as iblockstate [] [] [], multbme ta as int [] [] []) as bool {

For I in 0 to multb.length for j in 0 to multb [i] .Length for k in 0 to multb [i] [j] .Length {

If (isnull (multb [i] [j] [k]) continue;

If (! (MATCH_BY_META

P.getx ()+x_shift+i, p.get ()+y_shift+j,

P.getz ()+z_shift+k) .sblockpos ()),

Multb [i] [j] [k], multbmeta [i] [j] [k]))) Return false;

}

Return true;

}

Use example

 Val Altar as iBlockState = 

Val Multb as IBLOCKSTATE [] [] [] = [

[[],,

[Altar]]

] As iBlockstate [] [] [];

Val Multbmeta as int [] [] [] = [

[[2],,

[-1]]

] As int [] [] [];

... ...

// The altar is a command block on the crystal matrix.The command block is the core.

CheckBlockstates (World, POS, 0, -1,0, MultbMeta)

Synthetic table design

Note: I haven't got it in Jei ... but it's not difficult.

Including: some IINGREDIENT, a string represents music, a finished iItemstack.

accomplish

 var Muarecipes = [] as icodient [] [];

var recipemusics = [] as string [];

var muaresults = [] as Iitemstack [];

Add synthesis

 Muarecipes+= [*3, *2] as ithredRedient [];

RecipeMusics+= "F4+L4X4F4+L4X4L4F4+M4R4M4F4+R4"; // The six -meter year -old saying section, I forgot the achievement of which item is six trillion years. G ({mana: 2147483646});

Synthetic detection

What test?Wait for it to say

What to do when the block is updated?

 Events.onBlockneNeighborNotify

Var w as iWorld = Event.World;

Var pos0 as iBlockpos = Event.positation;

Var poses = [pOS0] as iBlockpos [];

For tempv0 in event.notifydsides {

Poses+= pos0.getOffset (tempv0,1);

}

// View all the blocks around the block of notify

For p in poses {

If (isnull (w.getBlock (p))) continue;

If (w.isairblock (p)) Continue;

If (isnull (w.getBlock (p) .data)) continue;

If (! (W.getBlock (p) .data has "powered")) continue;

// We have to control the command block or the notes box, which have Power as a record of redstone signals.And we also need to record the redstone signal.

If (w.getBlock (p) .data.powered <1 as byte) {{

If (Checkrswork (w, p)) {{

Var bl = w.getBlock (p);

Var dat as idata = w.getcustomchchunkdata (p); if (bl.definition.id == "minecraft: noteblock") {

// Get the notes.We do not have a drop, and the promotion is+.

// Then record in a CustomChunkdata: chunkmus

// If DAT already has this chunkmus, read it out, add the new note to the back

// Otherwise, create this item first, and then add the new notes to the back

// Bad news, we cannot listen to the box box incident.

// So we can only use thick means to guess the eight degrees corresponding to the sound quality, that is, the base block that will cause the sound change.

}

////// If it is a complete altar

Ifckblockstates (W, P, 0, -1,0, Multbmeta) {{

// Find peripheral items through iWorld.GetentITIESINAREA, and select all records // Select a synthetic table to see if all the items in the synthetic table are all available.The matching will be opened.If you find it, you don't need to control the synthetic table.

// Remember the number when matching the table, we also use to find the corresponding music and finished products.

// I found the item synthesis table, recorded chunkmus, and then cleared chunkmus

// Take a look at whether the end of Chunkmus is the song we (God) want, if not, then ignore the player

// If it is the correct track, then consume the material of the physical form and generate items above the altar.

}

}

}

}

});

Notes

 if (bl.definition.id == "minecraft: noteblock") {

Var str = "";

If (dat has "chunkmus") {str = dat.chunkmus as string;

}

Else {

W.SetcustomChunkdata ({chunkmus: str}, p);

}

If (! Isnull (bl.data)) {if (bl.data has "note") {

Var noten = bl.data.note as int;

Var f = 3 as int;

Var bname = w.getBlock (p.getoffset (ifacing.down (), 1)). Definition.id;

// For poor judgment of the sound of the notes incident, if (bname == "Minecraft: Planks" | BNAME == "Minecraft: Log" | bname == "Minecraft: Log2") {

F = 1;

}

If (bname == "minecraft: wool") {{

F = 2;

}

If (bname == "Minecraft: Clay") {{

F = 4;

} If (bname == "Minecraft: GOLD_BLOCK" | BNAME == "Minecraft: Packed_ice") {

F = 5;

}

If (bname == "Minecraft: Sand" | BNAME == "Minecraft: Glass") {{

F = 114514;

}

If (bname == "Minecraft: Stone" | BNAME == "Minecraft: Cobblestone") {{

F = 114514;

} Var judg = f*12+notn as int;

Var Sn As String = ""; // The result of drumming: explosion!

If (f <1000) {

Var T = JUDG%12;

If (t == 0 | t == 11) sn = "f";

Else if (t == 1 | t == 2) sn = "s";

Else if (t == 3 | t == 4) sn = "l";

Else if (t == 5) sn = "x";

Else if (t == 6 | t == 7) sn = "d";

Else if (t == 8 | t == 9) sn = "r";

Else if (t == 10) sn = "m";

Var p = (judg+6)/12;

Sn+= ('0'+p as byte) as byte;

If (t == 0 | t == 2 | t == 4 | t == 7 | t == 9) sn+= '+';

Print ("New Note Recorded"); Print (SN);

}

Str+= sn; if (str.Length> 7000) {{

Print ("Music Overflow");

Var test = "" as string;

For I in (Str.Length-3000) to Str.Length {

Temp+= str [i];

}

Str = test;

}

W.updatecustomchchunkdata ({chunkmus: str}, p); proprint ("existing notes:");

Print (str);

}}

}

altar

The altar is the command square

 if (CheckBlockstates (W, P, 0, -1,0, Multbmeta)) {

Server.CommandManager.executecommand (server, "say music altar is stimmulated");

If (p.get () <192) {{

Server.ComandManager.executecommand (server, "say the altar should be high in the sky");

Server.CommandManager.executecommand (server, "say enabling it to spream the music as far as possSible"); confadue;

}

If (! (Dat has "chunkmus") {{

Server.ComandManager.executecommand (server, "say charge the altar when notes are recreded");

Constinue;

}

// Get the list of items

Val R = 2;

var p1 = position3f.create (p.getx ()-r, p.get ()-r, p.getz ()-r); Var p2 = pose3f.create (p.getx ()+r, p.gety()+r, p.getz ()+r);

Var listofie = [] as IENTITYITEM [];

For E in W.GetentITIESIAREA (P1, P2) {

If (E intensteof IENTITEM) {{

Var j as IENTITYITEM = e;

Listofie+= j;

}

}

If (listofie.length <1) {{

Server.ComandManager.executecommand (server, "say Throw items or altar after playing the music");}

Var flags = [] as bool [];

Var Itemsin = [] as Iitemstack [];

For I in listofie {

Print (I.Item.Name);

Itemsin+= i.Item;

Flags+= true;

}

Server.ComandManager.executecommand (server, "say checking recipes");

// Poor synthetic table

If (MUARECIPES.LENGTH <1) {{

Server.CommandManager.executecommand (server, "say error: no available recipes");

Constinue;

}

Var recipeindex = (-1) as int;

Var t = 0;

For rnum in 0 to muarecipes.length {

Var match = true;

For Ingre in Muarec actually [rnum] {prop (rnum);

For I in Ingre.items {

Print (I.Name);

Break;

}

Var Found = false;

For it in itemsin {

If (Ingre.matches (it)) {if.amount <= it.amount) {

Found = true;

Server.ComandManager.executecommand (server, "say"+it.name);

}

Break;

}

} If (! Found) {

Match = false;

Break;

}

}

If (! Match) Continue;

T = t+1;

RecipeINDEX = T;

Break;

} If (recipeINDEX <0) Continue;

RecipeINDEX = recipeINDEX- 1;

Server.ComandManager.executeCommand (server, "say recipe found!");

// Record, clear chunkmus

Varmicinput = dat.chunkmus as string;

W.updatecustomChunkdata ({chunkmus: "" "}, p);

Print (recipeINDEX);

Print (recipemusics.Length);

Var researchmus = recipemusics [recipeindex];

If (Musicinput.Length

Print (requiredmus);

If (Musicinput.indexof (RequiredMus)! =

Musicinput.Length-Requiredmus.Length) Continue;

// Consumption of items and generate finished products.Okay, I swallowed all the items and then spit it out.

For I in listofie w.removentity (i);

Var return = [] as Iitemstack [];

For Ingre in Muarec actually [recipeINDEX] {

For it in 0 to itemsin.length {if (Ingre.matches (itesin [it])) {

If.amount <= itemsin [it] .Amount) Flags [it] = false;

If (Ingre.amount

RET+= itemsin [it] .withamount (itemsin [it] .amount -pere.amount);

}

}

}

for I in 0 to Flags.Length {if (FLAGS [i]) w.spawentity (itemsin [i] .createEntityItem (w, p.getx (), p.get ()+1, p.getz ()));;

}

For I in RET {

W.spaWentity (I.CreateEntityItem (w, p.getx (), p.get ()+1, p.getz ()));

}

W.spaWentity (Muaresults [recipeINDEX] .createEntityItem (w, p.getx (), p.get ()+1, p.getz ());

}

patch

Use Jei's "information" function to write a wheel to add a shop and explain

Of course, you can also write a function to add to the synthetic table

If you want to make the judgment more strict, you may think about it.

In other words, if you want to turn the synthetic table into a colorful altar, a workbench (, the core of the aggregation), you can try to add a thing similar to a box to several altars, and then check the inventory of the box.

In this way, any fluid aggregation is also feasible.

It's just instant synthesis ...

All code

 Import Crafttweaker.Block.iblockState;

import crafttweaker.block.iblock;

Import crafttweaker.util.position3f;

Import Crafttweaker.WORLD.IBLOCKPOS;

Import crafttweaker.World.ifacing;

Import Crafttweaker.events.ieventmanager; Import Crafttweaker.event.blockneNeighBornotifyEvent;

import crafttweaker.server.iserver;

import crafttweaker.Comand.icommandsender;

Import crafttweaker.World.iworld;

import crafttweaker.data.idata;

Import crafttweaker.entity.ientityItem;

import crafttweaker.item.iitemstack;

Import Crafttweaker.Item.INGREDIENT;

Function match_by_meta (A AS IBLOCKSTATE, B AS IBLOCKSTATE, C AS Int) As Bool {

Var return = false;

If (a.block.definition.id == b.block.definition.id) {

If (A.META == C | C <0) {{

RET = TRUE;

}

}

Return Ret;

}

Function CheckBlockstates (W as IWorld, P as iBlockpos, x_shift as int, y_shift as int, z_shift as int, multb as iblockstate [] [] [], multbme ta as int [] [] []) as bool {

For I in 0 to multb.length for j in 0 to multb [i] .Length for k in 0 to multb [i] [j] .Length {

If (isnull (multb [i] [j] [k]) continue;

If (! (MATCH_BY_META

P.getx ()+x_shift+i, p.get ()+y_shift+j,

P.getz ()+z_shift+k) .sblockpos ()),

Multb [i] [j] [k], multbmeta [i] [j] [k]))) Return false;

}

Return true;

}

Val Altar as iBlockState = ;

Val Multb as IBLOCKSTATE [] [] [] = [

[[],,

[Altar]]

] As iBlockstate [] [] [];

Val Multbmeta as int [] [] [] = [

[[2],,

[-1]]

] As int [] [] [];

var muarecipes = [] as ingredient [] [];

var recipemusics = [] as string [];

var muaresults = [] as Iitemstack [];

Muarecipes+= [*3, *2] as icedredient [];

RecipeMusics+= "F4+L4X4F4+L4X4L4F4+M4R4M4F4+R4";

muaresults+= .withtag ({mana: 2147483646});

value = [ifacing.north (), ifacing.east (), ifacing.south (),

Ifacing.west (), ifacing.down (), ifacing.up ()] as ifacing [];

function checkStrongPower(w as IWorld,p as IBlockPos) as bool{    val ALLFacing=[IFacing.north(),IFacing.east(),IFacing.south(),

Ifacing.west (), ifacing.down (), ifacing.up ()] as ifacing [];

For I in allfacing {

If (W.GetStrongPower (P.getOffset (i, 1), i)> 0) Return True;

}

Return false;

}

Function Checkrswork (W as IWorld, P as iBlockpos) as bool {

Value = [ifacing.north (), ifacing.east (), ifacing.south (),

Ifacing.west (), ifacing.down (), ifacing.up ()] as ifacing [];

If (CheckstrongPower (W, P)) Return True;

For I in allfacing {

IfCKSTRONGPOWER (W, P.getOffset (i, 1))) Return true;

}

Return false;

}

Events.onBlockneNeighBornotify

Var w as iWorld = Event.World;

Var pos0 as iBlockpos = Event.positation;

Var poses = [pOS0] as iBlockpos [];

For tempv0 in event.notifydsides {

Poses+= pos0.getOffset (tempv0,1);

}

For p in poses {

If (isnull (w.getBlock (p))) continue; if (w.isairblock (p)) continue;

If (isnull (w.getBlock (p) .data)) continue;

If (! (W.getBlock (p) .data has "powered")) continue;

If (w.getBlock (p) .data.powered <1 as byte) {{

If (Checkrswork (w, p)) {{

Print (w.getBlock (p) .definition.id);

Print ("Newly Updated");

Var bl = w.getBlock (p);

Var dat as idata = w.getcustomchchunkdata (p);

If (bl.definition.id == "Minecraft: NoteBlock") {{

Var str = "";

If (dat has "chunkmus") {

Str = dat.chunkmus as string;}

Else {

W.SetcustomChunkdata ({chunkmus: str}, p);

}

If (! Isnull (bl.data)) {if (bl.data has "note") {

Var noten = bl.data.note as int;

Var f = 3 as int;

Var bname = w.getBlock (p.getoffset (ifacing.down (), 1)). Definition.id;

If (bname == "Minecraft: Planks" | bname == "Minecraft: log" | bname == "minecraft: log2") {f = 1;

}

If (bname == "minecraft: wool") {{

F = 2;

}

If (bname == "Minecraft: Clay") {{

F = 4;

}

If (bname == "Minecraft: GOLD_BLOCK" | BNAME == "Minecraft: Packed_ice") {f = 5;

}

If (bname == "Minecraft: Sand" | BNAME == "Minecraft: Glass") {{

F = 114514;

}

If (bname == "Minecraft: Stone" | BNAME == "Minecraft: Cobblestone") {{

F = 114514;

}

Var judg = f*12+noten as int; var sn as string = "";

If (f <1000) {

Var T = JUDG%12;

If (t == 0 | t == 11) sn = "f";

Else if (t == 1 | t == 2) sn = "s";

Else if (t == 3 | t == 4) sn = "l";

Else if (t == 5) sn = "x";

Else if (t == 6 | t == 7) sn = "d"; else if (t == 8 | t == 9) sn = "r";

Else if (t == 10) sn = "m";

Var p = (judg+6)/12;

Sn+= ('0'+p as byte) as byte;

If (t == 0 | t == 2 | t == 4 | t == 7 | t == 9) sn+= '+';

Print ("New Note Recorded"); Print (SN);

}

Str+= sn; if (str.Length> 7000) {{

Print ("Music Overflow");

Var test = "" as string;

For I in (Str.Length-3000) to Str.Length {

Temp+= str [i];

}

Str = test;

}

W.updatecustomchchunkdata ({chunkmus: str}, p); proprint ("existing notes:");

Print (str);

}}

}

//////

Ifckblockstates (W, P, 0, -1,0, Multbmeta) {{

Server.CommandManager.executecommand (server, "say music altar is stimmulated");

If (p.get () <192) {{

Server.ComandManager.executecommand (server, "say the altar should be high in the sky");

Server.CommandManager.executecommand (server, "say enabling it to spream the music as far as possSible"); confadue;

}

If (! (Dat has "chunkmus") {{

Server.ComandManager.executecommand (server, "say charge the altar when notes are recreded");

Constinue;

}

// Obtain the list of entities

Val R = 2;

var p1 = position3f.create (p.getx ()-r, p.get ()-r, p.getz ()-r); Var p2 = pose3f.create (p.getx ()+r, p.gety()+r, p.getz ()+r);

Var listofie = [] as IENTITYITEM [];

For E in W.GetentITIESIAREA (P1, P2) {

If (E intensteof IENTITEM) {{

Var j as IENTITYITEM = e;

Listofie+= j;

}

}

If (listofie.length <1) {{

Server.ComandManager.executecommand (server, "say Throw items or altar after playing the music");}

Var flags = [] as bool [];

Var Itemsin = [] as Iitemstack [];

For I in listofie {

Print (I.Item.Name);

Itemsin+= i.Item;

Flags+= true;

}

Server.ComandManager.executecommand (server, "say checking recipes");

// Recipe check if (Muarecipes.Length <1) {{

Server.CommandManager.executecommand (server, "say error: no available recipes");

Constinue;

}

Var recipeindex = (-1) as int;

Var t = 0;

For rnum in 0 to muarecipes.length {

Var match = true;

For Ingre in Muarec actually [rnum] {prop (rnum);

For I in Ingre.items {

Print (I.Name);

Break;

}

Var Found = false;

For it in itemsin {

If (Ingre.matches (it)) {if.amount <= it.amount) {

Found = true;

Server.ComandManager.executecommand (server, "say"+it.name);

}

Break;

}

} If (! Found) {

Match = false;

Break;

}

}

If (! Match) Continue;

T = t+1;

RecipeINDEX = T;

Break;

} If (recipeINDEX <0) Continue;

RecipeINDEX = recipeINDEX- 1;

Server.ComandManager.executeCommand (server, "say recipe found!");

// Consume & Check Music

Varmicinput = dat.chunkmus as string;

W.updatecustomChunkdata ({chunkmus: "" "}, p);

Print (recipeINDEX);

Print (recipemusics.Length);

Var researchmus = recipemusics [recipeindex];

If (Musicinput.Length

Print (requiredmus);

If (Musicinput.indexof (RequiredMus)! =

Musicinput.Length-Requiredmus.Length) Continue;

// Consume Stacks and Give Results

For I in listofie w.removentity (i);

Var return = [] as Iitemstack [];

For Ingre in Muarec actually [recipeINDEX] {

For it in 0 to itemsin.length {if (Ingre.matches (itesin [it])) {

If.amount <= itemsin [it] .Amount) Flags [it] = false;

If (Ingre.amount

RET+= itemsin [it] .withamount (itemsin [it] .amount -pere.amount);

}

}

}

for I in 0 to Flags.Length {if (FLAGS [i]) w.spawentity (itemsin [i] .createEntityItem (w, p.getx (), p.get ()+1, p.getz ()));;

}

For I in RET {

W.spaWentity (I.CreateEntityItem (w, p.getx (), p.get ()+1, p.getz ()));

}

W.spaWentity (Muaresults [recipeINDEX] .createEntityItem (w, p.getx (), p.get ()+1, p.getz ());

}

}

}

}

});

V2

[MC] Music Altar (CRT X Plant Magic, 1.12.2) _ Bilibili_minecraft

Borrow the operating animation of the Tyra condensed board.Theoretically allows to directly use the Tyra condensed board to receive magic synthesis, but it will consume 2.1B Mana in that way, which is very expensive. Therefore, it is recommended that players use the music altar.

The infrastructure of the music altar is shown in the figure. The synthetic table changes as the synthetic table changes:

The steps to join the synthetic table are probably:

1. Add the synthetic table to the condensate board, add music score to the Jei description of the item, and add the music score in the Jei instructions of the note box

2. Add the static variable in the zs file.

Due to this process, we cannot use the events provided by Zenutil.Of course, we should write a function to run.

The precautions are that we cannot deposit information into the BlockData of various Tilentity because it will be automatically cleaned up.

So I deposited all the information into CustomChunkdata: the score number before the altar, the position before the altar, and the progress before the altar.(A block allows only one altar, otherwise the consequences will be at your own risk)

Effect

To activate a long shop and serialized notes box, you can see the music driving the Tyra condensed board.

Extended

The altar structure can be changed.The music is changed casually.There is no time for music, you can also record "lasttime updated last time" to make a time request.But how to tell players ...

Code

 Import Crafttweaker.events.ieventmanager;

Import Crafttweaker.Block.iblockDefinition;

import crafttweaker.block.iblockState;

import crafttweaker.block.iblock;

Import crafttweaker.World.ifacing;

Import crafttweaker.util.position3f;

Import Crafttweaker.WORLD.IBLOCKPOS;

Import crafttweaker.World.iworld;

import crafttweaker.data.idata;

import crafttweaker.server.iserver;

import crafttweaker.Comand.icommandsender;

Import Crafttweaker.event.WorldTickevent;

Import crafttweaker.event.blockneNeighborNotifyEvent;

import crafttweaker.item.iitemstack;

Import Crafttweaker.Item.INGREDIENT;

Import crafttweaker.entity.ientityItem;

// Add the instructions of the music box to the music box

Val nb = ;

MODS.JEI.JEI.AddDDEScripting (NB, "Music Altar Requires: A Repetitude Command Block Under the TERRA PLATE, With the REST 5 Faces Surrounded by Avartia's crystal matrix.

If the Command Block is at (x, y, z), then Botania's 4 Mana_pylons Should Be Placed at (x+2, Y, Z), (x-2, y, z), (x, y, z+2), (X, y, z-2). ");

MODS.JEI.JEI.AddDDDEScript (NB, "to use the music altar, first charge it, then play the noteblocks with correct notes in order, so that Numerous Mana Could be offeredWrong, Tiny Explosion Will Take Place Above the Plate, Terminating the Cract. "); Pulse on noteblock may not be detected ");

MODS.JEI.JEI.AddDDDEScript (NB, "Different from the Voice You Hear, The Octave DetEcted by the ALTAR is Determined as the Follow:");

MODS.JEI.JEI.AdDDDEScript (NB, "1 ~ 3: Minecraft: Planks Minecraft: Log Minecraft: Log2: Log2

2 ~ 4 Minecraft: Wool

4 ~ 6MineCraft: Clay5 ~ 7minecraft: GOLD_BLOCK MINECRAFT: Packed_ice

114514 ~ 114516: Minecraft: Sand Minecraft: Glass Minecraft: Stone Minecraft: Cobblestone

3 ~ 5: All the rest blocks ");

MODS.JEI.JEI.AdDDDDEScript (NB, "If there are severter altar exist in 1 chunk, unexpect behaviviour,");)

// Local storage, a note as a string.

// In fact, you should think: Muarecipes is a two -dimensional array.

// But because Static variables cannot be edited, but the elements in the Static array can be edited, we will add one more dimension, everything is good.

// If you don’t use static, you can't use the variables outside

Static Muarecipets as Iitemstack [] [] [] [] = [[]];

Static Muaresults as Iitemstack [] [] = [[]];

Static MuarecipeMusics As String [] [] [] [] = [[]];

// Add a new synthetic table

function addmuarecipe (out as IItemstack, INS As IITEMSTACK [], Music as String,

Cornerin As IINGREDIENT = , Cornerret As IINGREDIENT = ,

Color1 as int = 0x00ff88, color2 as int = 0x0088ff) as void {

// The default four corners of the synthetic table are all workbenches

// The lock center is a duplicate command block, and the crystal matrix on the four sides

// If you don’t use the music altar, it is also possible to use 2.1 billion mana

If (Music.length <1) Return;

Muarecipes [0] = Muarecipes [0]+ins;

Muaresults [0] = Muaresults [0]+out;

Var s as string = "";

Varmin as string [] = [] as string [];

For I in 0 to music.length {

If (S.Length <1 || Music [i] .tolowerCase == Music [i] .touppercase) s+= Music [i];

Else {

Musin+= s;

S = Music [i];

}

}

Musin+= s;

MuarecipeMusics [0] = MuarecipeMusics [0]+Musin;

Varm mx as iveRedient = ;

Var Muac as ingredient = ; Mods.BO , Cornerin, MUAC, MX, Cornerret);

MODS.JEI.JEI.AdDDDDEScript (out, "This it item should be craft on the music altar. For further information, Check The jei Description for Note Bo xes. Here is the music score:

"+Music);

}

// Tyra Ho Po = 3 Tyra Steel ingot+2 Living Wooden Branch+Six Six Specifications

addmuarecipe (. Withtag ({mana: 2147483646}),

[*2, *3],

"F4+L4X4F4+L4X4L4F4+M4R4M4F4+R4");

// Redstone signal detection.But if there is only 1GT signal like a magic detector, it cannot be detected.But the notes box explained.

Global alliblockfacing as ifacing [] = [iFacing.north (), ifacing.east (), ifacing.south (),

Ifacing.west (), ifacing.down (), ifacing.up ()];

(w aS iworld, p, p as iBlockpos) as? {

For I in alliblockfacing {

If (W.GetStrongPower (P.getOffset (i, 1), i)> 0) Return True;

}

Return false;

}

Function Checkrswork (W as IWorld, P as iBlockpos) as bool {

If (CheckstrongPower (W, P)) Return True;

For I in alliblockfacing {

IfCKSTRONGPOWER (W, P.getOffset (i, 1))) Return true;

}

Return false;

}

// Multi -square block structure testing

// This function is to detect a block

Function match_by_meta (A AS IBLOCKSTATE, B AS IBLOCKSTATE, C AS Int) As Bool {

Var return = false;

If (isnull (b)) Return true;

If (a.block.definition.id == b.block.definition.id) {

If (A.META == C | C <0) {{

RET = TRUE;

}

}

Return Ret;

}

// This function is to enter a structure and a coordinate to detect whether the structure is completed.

Function CheckBlockstates (W as IWorld, P as iBlockpos, x_shift as int, y_shift as int, z_shift as int, multb as iblockstate [] [] [], multbme ta as int [] [] []) as bool {

For I in 0 to multb.length for j in 0 to multb [i] .Length for k in 0 to multb [i] [j] .Length {

If (isnull (multb [i] [j] [k]) continue;

If (! (MATCH_BY_META

P.getx ()+x_shift+i,

P.get ()+y_shift+j,

P.getz ()+z_shift+k) .sblockpos ()), multb [i] [j] [k], multbmeta [i] [j] [k])))))))))

}

Return true;

}

// This function is to write the altar structure directly

Function Checkmualucture (W as iworld, P as iBlockpos) as bool {

Var pl as iBlockstate = ;

Varm mx as iblockstate = ;

Var muc as iBlockState = ;

Var trpl as iBlockState = ;

Var Z0 as iBlockState [] = [null, null, null, null, null, null];

Var Z1 as iBlockState [] = [null, null, pl, null, null, null];

Var Z2 as iBlockstate [] = [null, null, mx, null, null, null];

Var Z3 as iBlockstate [] = [PL, MX, MUAC, MX, PL];

Var Z4 as iBlockState [] = [null, null, trpl, null, null];

Var mz0 ​​as int [] = [-1, -1, -1, -1, -1, -1];

Var mz1 as int [] = [-1, -1,2, -1, -1];

Var mz2 as int [] = [-1,2, -1,2, -1]; Return CheckBlockstates (W, P, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2

[Z0, Z1, Z0], [Z0, Z2, Z0], [Z2, Z3, Z4], [Z0, Z2, Z0], [Z0, Z1, Z0]],

[[mz0,mz0,mz0],[mz0,mz1,mz0],[mz1,mz2,mz0],[mz0,mz1,mz0],[mz0,mz0,mz0]]);

}

// Convert the Note in the BlockData of the Institute of the Institute of the Institute.

// NoteBlockConverter

function convert_note_block_data_to_string (DAT As Idata, Base as IBLOCK) as String {

Var str = "";

If (dat has "note") {{

Var noten = dat.note as int;

Var f = 3 as int;

Var bname = base.definition.id;

If (bname == "Minecraft: Planks" | bname == "Minecraft: log" | bname == "minecraft: log2") {

F = 1;

}

If (bname == "minecraft: wool") {{

F = 2;

}

If (bname == "Minecraft: Clay") {{

F = 4;

} If (bname == "Minecraft: GOLD_BLOCK" | BNAME == "Minecraft: Packed_ice") {

F = 5;

}

If (bname == "Minecraft: Sand" | BNAME == "Minecraft: Glass") {{

F = 114514;

}

If (bname == "Minecraft: Stone" | BNAME == "Minecraft: Cobblestone") {{

F = 114514;

}

Var judg = f*12+noten as int;

Var sn as string = "";;

If (f <1000) {

Var T = JUDG%12;

If (t == 0 | t == 11) sn = "f";

Else if (t == 1 | t == 2) sn = "s";

Else if (t == 3 | t == 4) sn = "l";

Else if (t == 5) sn = "x";

Else if (t == 6 | t == 7) sn = "d"; else if (t == 8 | t == 9) sn = "r";

Else if (t == 10) sn = "m";

Var p = (judg+6)/12;

Sn+= ('0'+p as byte) as byte;

If (t == 0 | t == 2 | t == 4 | t == 7 | t == 9) sn+= '+';

Print ("New Note Recorded"); Print (SN);

}

Str+= sn;

If (Str.Length> 7000) {

Print ("Music Overflow");

Var test = "" as string;

For I in (Str.Length-3000) to Str.Length {

Temp+= str [i];

}

Str = test;

}}

Return Str;

}

// The command block is charged to detect whether the altar structure is completed.If so, record it into chunkdata

// Musicaltarchecking

Events.onBlockneNeighBornotify

Var w as iWorld = Event.World;

Var pos0 as iBlockpos = Event.positation;

Var poses = [pOS0] as iBlockpos [];

For tempv0 in event.notifydsides {

Poses+= pos0.getOffset (tempv0,1);

}

For p in poses {

If (isnull (w.getBlock (p))) continue;

If (w.isairblock (p)) Continue;

If (isnull (w.getBlock (p) .data)) continue;

If (! (W.getBlock (p) .data has "powered")) continue;

If (w.getBlock (p) .data.powered> 0 as byte) Continue;

If (! Checkrswork (w, p)) continue;

// CheckStruction

If (! CheckMuastruction (w, p)) continue;

Server.CommandManager.executecommand (server, "say music altar is stimmulated");

// Record the mua to the chunk

Var dat as idata = w.getcustomchchunkdata (p); if (true) {

W.updatecustomchchunkdata ({"Muainfo": {

"X": p.getx () as int,

"Y": p.get () as int,

"Z": p.getz () as int,

"RecipeINDEX": -1 as int,

"Progress": -1 as int

}}, P);

}

Server.ComandManager.executecommand (server, "saying in registering the mua");

}

});

// The notes box is activated by the redstone signal.

// NoteBlockDetection

Events.onBlockneNeighBornotify

Var w as iWorld = Event.World;

Var pos0 as iBlockpos = Event.positation;

Var poses = [pOS0] as iBlockpos [];

For tempv0 in event.notifyDsides {poses+= pos0.getOffset (tempv0,1);

}

For p in poses {

If (isnull (w.getBlock (p))) continue;

If (w.isairblock (p)) Continue;

If (isnull (w.getBlock (p) .data)) continue;

If (! (W.getBlock (p) .data has "powered")) continue;

//Server.CommandManager.executecommand (Server ,"say Noteblock a ");

If (w.getBlock (p) .data.powered> 0 as byte) Continue;

//Server.ComandManager.executeCommand (Server ,"say Noteblock B ");

If (! Checkrswork (w, p)) continue;

//Server.CommandManager.executecommand_Server ,"say Noteblock C ");

Var b = w.getBlock (p);

If (b.definition.id! = "Minecraft: NoteBlock") Continue;

//Server.ComandManager.executecommand (Server ,"say Noteblock Stimulated ");

// Get altar coordinates

// Obtain the positive of mua var dat as idata = w.getcustomChunkdata (P);

If (! (Dat has "muainfo") continue;

If (! (Dat.muainfo Has "y") {{

Continue;

}

If (dat.muainfo.y <0) Continue;

Var aps iblockpos = position3f.create (dat.muainfo.x, dat.muainfo.y, dat.muainfo.z) as iBlockpos;

Var plp = ap.getOffset (ifacing.up (), 1);

// View whether the altar is normal

// Check if_ the altar is all right

If (! CheckMuastruction (W, AP)) {

If (w.getBlock (plp) .definition.id == "Botania: Terraplate") {{

W.SetBlockState (w.getBlockstate (PLP), w.getBlock (plp) .data+{"mana": 0} as idata, plp);

}

Var Tempdata as idata = DAT+{"y": -1};

W.UPDATECUSTMCHUNKDATA ({"Muainfo": Tempdata}, P);}

Else {

// The altar is normal.

// View the entity list to see what score should be used now.

// Obtain the Current recipe index from the entities

Var pos1 as position3f = posity3f.create (ap.getx (), ap.get ()+1, ap.getz ());

Var pos2 as position3f = posity3f.create (AP.Getx ()+1, AP.GETy ()+2, AP.Getz ()+1);

Var ITemin as Iitemstack [] = [];

For I in W.GetentITIESIAREA (POS1, POS2) {

If (I Instanceof IENTITYITEM) {{

Var t as iv stationityItem = i;

Itemin+= (t.Item);

}

}

// var test = scripts.exp.t; if (Itemin.Length <0) continue;

/**

Val Muarec = scripts.altars.musicaltarv2Recipe.muarecipes [0];

Val Muares = scripts.alTars.musicaltarv2Recipe.muaresults [0];

VAL MUAMUS = scripts.alTars.musicalTarv2RECIPE.MUARECIPEMUSICS [0];

Val Muarec as Iitemstack [] [] = Muarecipes [0];

Val Muares as Iitemstack [] = Muaresults [0];

Val Muamus as String [] [] = MuarecipeMusics [0];

If (MUAREC.Length <1) Continue;

Var intex as int = -1 as int;

For I in 0 to Muarec.Length {

Var flag as bool = true;

If (muarec [i] .length! = Itemin.length) flag = false;

Else if (muarec [i] .Length == 0) flag = true; else {

Var flags as bool [] = []; // itemin [j] is user

For j in 0 to itemin.length {

Flags+= false;

}

For j in 0 to muarec [i] .length {

Var Fl3 = false; // WHETHER MUAREC [i] [J] is Found

For k in 0 to itemin.length {

If (flags [k]) Continue;

Var a as IITEMSTACK = itemin [J]; VAR B AS IItemstack = Muarec [i] [j];

Iffinition.id! = B.Definition.id) Continue;

If (a.amount! = B.amount) Continue;

If (A.CAPNBT! = B.CAPNBT) Continue;

Fl3 = true;

Flags [k] = true;

Break;

}

}}

If (FLAG) {

Index = i;

Break;

}

}

//Server.ComandManager.executecommand (Server ,"say Recipenumber: "+(Index as String));

//Server.CommandManager.executeComManDMAND."say Old Data (Check): "+(W.GetCustomChunkdata (P) .muainfo as String));

// If the physical list does not have a corresponding synthetic table, then open

If (index <0) Continue;

// I found the synthetic table to see how the progress is

VAR Progress1 as int = -1 as int; // If it is different from the synthetic table recorded before, or the previous music has been bounced, then it should be started from scratch.

Ifx! = (Dat.muainfo.Rcipeindex as int) ||

// Otherwise, then play

Else progress1 = dat.muainfo.progress as int;

//Server.ComandManager.executecommand (Server ,"say Progress1: "+(Progress1 as String));

// Look at the sound and music of the bouncing.

If (convert_note_block_data_to_string (w.getBlock (p) .data, w.getBlock (p.getoffset (ifacing.down (), 1), 1))))))))))))))))))))))))))))))))))))))))))))).

! = MUAMUS [Index] [Progress1]) {

// Failure

// Are you right, manufacture explosions (will not consume items, will not destroy the block), and the performance is clear

//Server.ComandManager.executeCommand (Server ,"say Detected Note: "+CORT_NOTE_BLOCK_DATA_TO_STRING t (ifacing.down (), 1)))); //; //Server.ComandManager.executeCommand (server, "say expected not:"+MUAMUS [Index] [[Progress1]);

W.SetBlockState (w.getBlockstate (PLP), w.getBlock (plp) .data+{"mana": 0} as idata, plp);

W.PerFormexplification (NULL, AP.GETX ()+0.5, AP.Get ()+0.7, AP.getz ()+0.5, Progress1/300, FALSE, FALSE);

Var testa as idata = dat.muainfo+{"recipeindex": -1};

W.updatecustomchchunkdata ({"Muainfo": Tempdata}, P);

}

Else {// Success

// Successful, modify the built -in magic power of the Tyra condensed board

Var mana as int = ((2147483641.0 as double)/MUAMUS [Index] .Length*(Progress1+1)) as int; as int;

W.SetBlockState (W.GetBlockstate (PLP), W.GetBlock (PLP) .data+{"mana": mana} as idata, plp); VAR TEMPDATA AS Idata = DAT.MUain fo+{"Progress": Progress1+1 as int, "RecipeINDEX": Index as int};

//Server.CommandManager.executecommand (Server ,"say New Data: "+(Tempdata As String));

W.updatecustomchchunkdata ({"Muainfo": Tempdata}, P);

//Server.ComandManager.executeComManDMAND."say New Data (Check): "+(W.GetCustomChunkdata (P) .muainfo as String));

// MUSIC ENDS

If (project1+1> = muamus [index] .length) {

Var testa as idata = dat.muainfo+{"recipeINDEX":-1 as int};

W.updatecustomchchunkdata ({"Muainfo": Tempdata}, P);

}}

}

}

});

end