#How to create a custom block breaking system with NBT

1 messages · Page 1 of 1 (latest)

agile fractal
#

how do i get this to work

#

so {stoneblock1::health} is 30

#

the {power} is whatever the player has

autumn vessel
agile fractal
#

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

autumn vessel
#

Not an nbt expert, but maybe try parsing the health as a number. NBT tags might be strings or something

Never used nbt though

agile fractal
#

yeah i tried that too. it gives no errors but it doesnt change anything

autumn vessel
#

Hmm

agile fractal
#

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

#

🇭 sku_o 🇼

#

????? if i hit the block 10 times it breaks. no matter what power

autumn vessel
#

Maybe number not integer if you are not using whole numbers

agile fractal
#

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

agile fractal
#

i got it

#

the plugin Realmines bugs it out