1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Need Help] Checking NBT of block with SkStuff

Discussion in 'Skript' started by Ticxo, Aug 28, 2017.

Tags:
Thread Status:
Not open for further replies.
  1. Ticxo

    Ticxo Member

    Joined:
    Aug 28, 2017
    Messages:
    4
    Likes Received:
    0
    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
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Comparison line/error?
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    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
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    I meant Post the errors and the Rest of your Script...
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    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
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Remove the %%... Thats pretty basic stuff mate you should know those Things before asking here.
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    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?
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Code (Skript):
    1. if {_tag} is "{id:""minecraft:blaze""}":
     
Thread Status:
Not open for further replies.
Loading...