Block NBT's going wild under some conditions

Published by Hidan on
Status
Fixed
Issue description

I was working casually on well... something and have notice that if you set one NBT value when block is placed
to for example 5 and do simple maths to apply new value using previous value than weird stuff happen's

example
On Block Placed I will set tag value:
Generate = 5

Than I will do simple maths to apply this to another block so

Set NBT tag value Energy of a block at Y+1
[[Tag Generate] + [Tag Energy of a block at Y+1]]

Logic say that it will be adding +5 to block above however for some odd reason if taking value from 2 different blocks
it will 
1. generate only by 1 
2. it reverse operators so + is - and - is +

I'm providing example

Take a look at 2 last procedures
SolarT1Generator and EnergyHarvestGetAndApply

In game right click on energy harvester
NOTE: I have applied limits there but you still can see its going to -4 for some reason

 

PS: Changing logical tag in gui threw GUI button is not working :L

Issue comments

With Numerical 2020.1 didn't have any issues
With Logical it had sometimes 

I noticed that if there is no block at X-1 for example that have required variable than it will be decreasing its value however if block with required values exist there than it will not gonna decrease it

 

SolarT1 has no on placed procedure though. I will need more context to be able to understand this problem.

If ops < 0:

this is not the case so it goes to else if which mathces (ops = 0, 0 < 200)

it checks for opsgen 4 times, if the block has no nbt value, -1 is returned, 4*-1 -> -4

next tick, ops < 0 mathces so ops is set back to 0

Value alternates between -4 and 0 each tick and when you right click on the block, you get one of the two possible values 0 or -4.

 

If I place SOLART1 on all 4 sides, values stop alternating as expected as get nbt procedure block is no longer returning -1 for the nbt values on the locations where there were no blocks before.

I will recreta the equation that I did in 2020.1 and see if it will behave same way or in the way that it did in snapshot and will let you know if results are different in both versions 

OK I guess I'm just stupid, I will fix my stupid maths loginc 
but there is still that issue with Logical tag :L

logic

 

This should swith Tag to True if tag is False and vice versa but it only switches one time 
And If  I use Else If here than it will swith from F to T than T to F and get stuck again

Uploaded
So I dispalyed it in 2 ways
With Button in GUI
And Right click on block

Button does not even displaying message
but on right click it displays however tag is not changed, same with button

 

I can replicate this and this bug is indeed very strange. Did this bug with logical tags happen in 2020.1 too?

I have encountered it for the first time in 2019.9
however if you place there block to run different procedure, it will be working than

 

however if you place there block to run different procedure, it will be working than

I don't fully understand what you mean by this, could you elaborate? Thank you for your info, I really can't seem to find the cause so every clue helps :D

like if you put another IF statement there than it will be working for some od reasons
Thats the way I did in 2019.9 and its working fine, however if I remove second IF from ther and leave just Set NBT Logic Tag block
than it will stop working
lol