[Need Help] Checking NBT of block with SkStuff

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Ticxo

Member
Aug 28, 2017
4
0
0
28
I'm pretty new to Skript, so I need some help.

What I'm trying to do is to check the NBT tags of a block with the on break event.
I saw "NBT of an entity, block or item" in SkStuff, but it seems to only work when you're adding/removing a tag from an entity/block.

Basically, I want to add custom drops for spawners in the world(like blaze spawner drop some blaze rod, zombie spawner drop some flesh or potato)

Any help?


Some info:
1) When I set a variable to the block's NBT tag and send it out in chat, it show's something like this: {MaxNearbyEntities:4s,......,Weight:1}]} (too long, so I use ... instead)

Script used:
on break of mob_spawner:
set {_tag} to nbt of event-block
send "%{_tag}%"

2) if I compare the variable with the block's NBT(both are the same since the variable is the block's NBT), it throws me an error. I guess this is the problem of NBT tags aren't strings
 
Nope, it's so random actually. Sometimes I get invalid item data type, sometimes it doesn't understand my Comparison

Edit: I will try to reproduce as many error as possible
 
Scripts:
on break of mob_spawner:
set {_tag} to nbt of event-block
if %{_tag}% is nbt of event-block:
send "it's the same"

Error: Can't compare '%{_tag}%' with a types.compound
 
Oh yea, why did I miss that one. But I still have another problem

Im now checking only the SpawnData of the mob spawner.

set {_tag} to tag "SpawnData" of nbt of event-block
if {_tag} is {id:"minecraft:blaze"}:
#do something here

error: ':"minecraft:blaze"}' is not a valid item data

what about this one?
 
Status
Not open for further replies.