#How to create a custom block breaking system with NBT
1 messages · Page 1 of 1 (latest)
You need to be more specific. Provide explanations of what you are trying to achieve and where your code/logic fails
the part the fails is set tag "health" of nbt compound of event-block to "%{power::%player's uuid%} - tag "health" of nbt compound of event-block%"
its supposed to be Power - Health of the block
then it sets the tag to the new health
and if the health is <= 0: then it breaks it
that if tag "health" of nbt compound of event-block <= 0: also doesnt work
Not an nbt expert, but maybe try parsing the health as a number. NBT tags might be strings or something
Never used nbt though
yeah i tried that too. it gives no errors but it doesnt change anything
Hmm
if tag "health" of nbt compound of event-block parsed as an integer <= 0:
set tag "health" of nbt compound of event-block to "%{power::%player's uuid%} - tag "health" of nbt compound of event-block parsed as an integer%"
i got the if tag "health" of nbt compound of event-block parsed as an integer <= 0: to work.
just the substraction isnt working now
nope
if tag "health" of nbt compound of event-block is not set:
broadcast "%nbt compound of event-block%"
set tag "health" of nbt compound of event-block to "%{stoneblock1::health}%"
broadcast "%nbt compound of event-block%"
set tag "health" of nbt compound of event-block to "%{power::%player's uuid%} - tag "health" of nbt compound of event-block parsed as an integer%"
broadcast "%nbt compound of event-block%"
set {_nbt} to tag "health" of nbt compound of event-block
broadcast "%{_nbt}%"
if (tag "health" of nbt compound of event-block parsed as an integer) <= 0:
break event-block
send action bar "&7Destroyed" to player
else:
send action bar "&7%tag "health" of nbt compound of event-block%" to player```
i flipped the substraction to (tag - power)
the first broadcast is correct
but then it just goes into the negatives set to whatever power the player has
ðŸ‡
🇼
????? if i hit the block 10 times it breaks. no matter what power
Maybe number not integer if you are not using whole numbers
now
i dont know what its doing
it works
except that area
iiliterlaly dont know why
its
saving the nbt
somehow
i had to add the line delete tag "health" of nbt compound of event-block
so
its not setting hte nbt of the block
its setting the nbt of the location of the block somehow
cause even when the stoneblock is at the same location but broken and placed again it has the same nbt