Solved Custom Mob Spawner

  • 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!


May 27, 2017
Category: ?

Suggested name: CustomSilkSpawner

What I want:
1. If you break a spawner (doesn't need silk touch) it'll drop the spawner complete with it's nbt tags or whatever (like Spawn Range, Spawn Delay, etc)
2. If you place a spawner it'll place it complete with it's nbt tags or whatever ^
3. The nbt tags or whatever will be in a form of rarity/tiers (idk like tier stone, coal, iron,etc i can change it after i study the code)
4. and a command for buying it

Ideas for commands:
/CSS [<text>] [<text>] [<text>] [<text>]
arg 1 is give
arg 2 target player or all
arg 3 type of mob
arg 4 rarity/tiers

Ideas for permissions:
i can figure this out later, i just need the codes, i'm seriously stuck

When I'd like it by:
IDK a reasonable time I guess?

Plugins I have: (if needed more tell me)

YES I'm just starting out


P.S I got these but I don't think it helps

Haven't checked for errors sry
on break of mob spawner:
    if {_s::%event-block%} is not set:
        set {_s::%event-block%} to "%nbt of targeted block%"
        set {_s::%event-block%::*} to {_s::%event-block%} split at """"
        if {_s::%event-block%::2} is "minecraft:pig":
            drop a mob spawner named "PIG"

on place of mob spawner:
        player is holding mob spawner named "Blaze"
        set mob type of spawner target block to "Blaze"
        player is holding mob spawner named "PIG"
        set mob type of spawner target block to "Pig"
Last edited:
You can't store nbt into a block, you know that.
Do something like this, i'm busy and I can't do it for you:

On place of mob spawner:
  • save the location to a list variable index
  • save the nbt to the the variable value (set this value to nbt of player's tool)
On break of mob spawner:
  • loop the mob spawner variable list
  • if the index is the same as the event-location, you found a custom mob spawner.
  • cancel the drop of the spawner
  • give the player or make drop a spawner with the custom NBT that was stored on the loop-value
  • Like
Reactions: Luxic