Topic category: Help with Minecraft modding (Java Edition)
Hello everyone. I was making a mod in which I needed to process custom blocks in the pos1 pos2 space. (I had to take NBT(num) from them). Previously, in the block that was supposed to receive the sum of NBT (num) of all blocks, I entered p1 and p2. Calculates correctly, but does not work in any way. Honestly, I tried to make three cycles nested in each other myself, but firstly, it was too cumbersome, and secondly, nothing worked out that way. Does anyone have a template for such a task? Or at least hint how it can all be made easier. please ;(
P.S. if I made a mistake in the forum, then I apologize, maybe someone has this working template, then I will be grateful. I will be grateful for any help.
P.S.S. I don't understand English well, but I will listen to anyone who can help
Hi, tell me, could you describe the task in detail, what should it be?
Multiblock structure? What should she do and depending on what?
As they say, the devil is in the details, I roughly understand what you mean, but for less water, write everything in detail
Well. The task is as follows. There is a block (controller) that must collect NBT tags (numbers) of blocks. In this block (controller), the player must enter the coordinates of the first block (with the NBT tag) and the coordinates of the second block (with the NBT tag). In any case, a matrix is obtained. Let's say the player entered the coordinates (first block) x1=0 y1=0 z1=0 and (second block) x2=10 y2=10 z2=10. And so the block (controller) must define each block in the space from 0 0 0 to 10 10 10 and if it is the right block by condition, it (controller) takes the NBT tags of these blocks and adds them to itself in NBT and adds them.
I hope you have clearly described my task. I have to write through a translator, because I don't speak pure English (Sorry
I also write through a translator
I now tried to implement all this for an example, but it turned out to be too complicated and cumbersome for me.
but i have ideas
All blocks must have the checkbox slab entity checked
Further, if the matrix perimeter is determined by blocks, then in these blocks you need to place a procedure that will write the coordinates of these blocks to global variables by trigger when the block is set.
The coordinates are transferred to the controller through global variables, it is not necessary through the NBT.
Next is the matter of selections
if the matrix is 0 0 0 x 10 10 10
we perform a cyclic check of each block for the presence of NBT
While(z<11){
While(x<11){
x=x+1
While(y<11){
[Get NBTteg from block at X Y Z]
y=y+1
}
y=0
}
x=0
}
[Set NBTteg from block <<Controller>>]
The main thing is to correctly set the cycle
And write the NBT from blocks into variables, and after the completion of the calculations, write the result to write the NBT of the Controller
Sorry I made a mistake
While(z<11){
z=z+1
While(x<11){
x=x+1
While(y<11){
[Get NBTteg from block at X Y Z]
y=y+1
}
y=0
}
x=0
}
[Set NBTteg from block <<Controller>>]
OMG Thank you so much. I will definitely try your way. ) Good luck with everything.