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.

Nbt of Block

Discussion in 'Skript' started by ShaneBee, Aug 12, 2018.

Thread Status:
Not open for further replies.
  1. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    Skript Version: dev37c
    SkStuff: 1.6.4.1-fork-1.12

    Okay, so I have figured out how to add NBT to an item. Basically what I am trying to figure out how to do is,
    Create a spawner (check)
    Give it to the player (check)
    Change the spawner that was placed on the ground (help)
    So THIS works:
    Code (Skript):
    1. command /test:
    2.     trigger:
    3.         give player spawner with nbt "{BlockEntityTag:{SpawnData:{id:""chicken""},SpawnCount:5,MinSpawnDelay:1,MaxSpawnDelay:2,Delay:1,MaxNearbyEntities:100,SpawnPotentials:[{Entity:{id:""chicken""},Weight:1}]},display:{Name:""chicken""}}"
    4.  
    YAY for that... but now I am trying to my damndest to figure out how to add NBT to a block
    I placed a spawner, pulled the NBT and tried to add the same NBT back just for testing, and no go.
    Here is my test
    Code (Skript):
    1. on right click on spawner:
    2.     set nbt of event-block to "{MaxNearbyEntities:6s,RequiredPlayerRange:16s,SpawnCount:4s,SpawnData:{id:""minecraft:cow""},MaxSpawnDelay:800s,Delay:150s,x:287,y:64,z:199,id:""minecraft:mob_spawner"",SpawnRange:4s,MinSpawnDelay:200s,SpawnPotentials:[{Entity:{id:""minecraft:cow""},Weight:1}]}"
    3.  
    The error I get is:
    Code (Skript):
    1. [22:53:05 ERROR]: a types.compound can't be set to anything (test.sk, line 47: set nbt of event-block to "{MaxNearbyEntities:6s,RequiredPlayerRange:16s,SpawnCount:4s,SpawnData:{id:""minecraft:cow""},MaxSpawnDelay:800s,Delay:150s,x:287,y:64,z:199,id:""minecraft:mob_spawner"",SpawnRange:4s,MinSpawnDelay:200s,SpawnPotentials:[{Entity:{id:""minecraft:cow""},Weight:1}]}"')
    The syntax in the docs is stated as:
    Code (Skript):
    1. nbt[[ ]tag[s]] of %entity/block/item%
    I feel like I have tried everything. Does anyone have any clue how the heck to do this?
     
  2. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    14
    Medals:
    SkStuff is broken in dev 36+
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    NOOOOOOOOOOOOOOOOOOOO :emoji_frowning: Don't tell me these sad works :emoji_broken_heart:
     
  4. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    14
    Medals:
    I know ur feel bro, i have to do weird nbt stuff but i cant rip
    --- Double Post Merged, Aug 12, 2018, Original Post Date: Aug 12, 2018 ---
    However there is a TukeNuke version of it.. Also think its broken tho
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    Thats actually the version I have been using. Its the only version that allows me to add NBT to an item, just not a block sadly!
     
  6. jaylawl

    jaylawl Well-Known Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    Instead of setting the nbt of the block, try replacing the event-block with a new one:
    Code (Skript):
    1. set event-block to spawner with custom nbt "{}"
    or maybe:
    Code (Skript):
    1. set {_spawner} to spawner named "asd" with custom nbt "{}"
    2. set event-block to {_spawner}
    I know this doesn't make much sense but doing enough hacky stuff like this usually gets SkStuff to do the job, i've been there too
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    Hey thanks, I have already tried both of those an no go. They don't throw errors, but it just places a normal pig spawner.
     
  8. Mr_Simba

    Mr_Simba King of the Pridelands
    Moderator Supporter

    Joined:
    Dec 9, 2016
    Messages:
    257
    Likes Received:
    55
    Medals:
    IIRC you don't set NBT, you add it. add the text to NBT of event-block.
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    I tried that as well... didn't do anything.
     
  10. Mr_Simba

    Mr_Simba King of the Pridelands
    Moderator Supporter

    Joined:
    Dec 9, 2016
    Messages:
    257
    Likes Received:
    55
    Medals:
    That's still probably due to SkStuff not working on new Skript versions, as other have stated.
     
  11. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    you can use skript mirror
    Code (Skript):
    1. import:
    2.     org.bukkit.entity.EntityType
    3.  
    4. set {_spawner} to clicked block.getState()
    5. {_spawner}.setSpawnedType(EntityType.CHICKEN!)
    6. whatever else you wanna set
    7. {_spawner}.update()
     
  12. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    UGH... i really need to learn how to use Skript-Mirror and understand all the Java stuff.. because I know that is probably my best bet in this case.
     
Thread Status:
Not open for further replies.
Loading...