Solved Spawner Pickaxe

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

Dominiiikk_

Member
Apr 6, 2024
10
0
1
24
Hey, I'm basically trying to make a spawner pickaxe. But every time I mine the spawner I only get the blank spawner without the set mob inside. How to fix it? :emoji_frowning:

Code:
on break of mob spawner:
    if player has permission "minespawner.all":
        if player's tool is netherite pickaxe:
            if player's tool is enchanted with silk touch 10:
                cancel event   
                give event-block to player
                break event-block
 
event-block literally just refers to the block they mined, which means a mob spawner.
I'm not 100% sure how you would go about fixing this, but I'll look into it.

In the meantime, try this. Requires SkBee addon for skript (https://github.com/ShaneBeee/SkBee/releases/tag/3.4.3)
Python:
on break of mob spawner:
    if player has permission "minespawner.all":
        if player's tool is netherite pickaxe:
            if player's tool is enchanted with silk touch 10:
                cancel drops
                set {_d} to event-block
                set {_f} to nbt of event-block
                set nbt of {_d} to nbt compound of {_f}
                drop 1 of {_d} at event-location
 
event-block literally just refers to the block they mined, which means a mob spawner.
I'm not 100% sure how you would go about fixing this, but I'll look into it.

In the meantime, try this. Requires SkBee addon for skript (https://github.com/ShaneBeee/SkBee/releases/tag/3.4.3)
Python:
on break of mob spawner:
    if player has permission "minespawner.all":
        if player's tool is netherite pickaxe:
            if player's tool is enchanted with silk touch 10:
                cancel drops
                set {_d} to event-block
                set {_f} to nbt of event-block
                set nbt of {_d} to nbt compound of {_f}
                drop 1 of {_d} at event-location
Hi, sorry for late reply. I get this error when using this code.

Can you help me with that?

1712786513090.png
 
That's strange...try this
AppleScript:
on break of mob spawner:
    if player has permission "minespawner.all":
        if player's tool is netherite pickaxe:
            if player's tool is enchanted with silk touch 10:
                cancel drops
                set {_d} to event-block
                set {_f} to nbt of targeted block
                add nbt compound of {_f} to nbt of {_d}
                drop 1 of {_d} at event-location
 
That's strange...try this
AppleScript:
on break of mob spawner:
    if player has permission "minespawner.all":
        if player's tool is netherite pickaxe:
            if player's tool is enchanted with silk touch 10:
                cancel drops
                set {_d} to event-block
                set {_f} to nbt of targeted block
                add nbt compound of {_f} to nbt of {_d}
                drop 1 of {_d} at event-location
Its wierd, but it still drops without any NBT data
 
This is so weird, I don't have the chance to test right now. Would you try debugging by broadcasting {_f} and {_d}?
Even wierder is that the broadcast is showing the NBT data. So the problem looks to be with the dropped item?

Code:
21:34:48[INFO] {Delay:37s,MaxNearbyEntities:6s,MaxSpawnDelay:800s,MinSpawnDelay:200s,RequiredPlayerRange:16s,SpawnCount:4s,SpawnData:{entity:{id:"minecraft:pig"}},SpawnPotentials:[],SpawnRange:4s,custom:{},id:"minecraft:mob_spawner",x:77,y:64,z:243}
21:34:48[INFO] 'mob spawner' at 77.5, 64.5, 243.5 in world 'world'
 
Yeah. MAYBE this will work? I haven't used NBT with skript much I'm going to be honest but it is a little weird that this hasn't been working.
AppleScript:
set {_f} to nbt of event-block
drop 1 of mob spawner with nbt compound from {_f}
 
So it has all the delay and stuff but it just spawns as the default pig spawner...
It looks like it wipes only the entity tag, but keeps all other. It just turns into blank spawner without any entity.

1712865405853.png


If I mine this one again it has all the NBT tags but not the entity.
1712865513367.png
 
Alright, so I figured it out methinks, change "nbt of event-block" to "nbt of target block", like we had before, because "event-block" just refers to mob spawner, like we saw before with {_d}, so it is just going to have the default spawner NBT which means a pig. With target block, it should get the NBT of the actual mined block (maybe??).

Also try using NBT compound rather than NBT
Python:
set {_f} to nbt compound of target block
drop 1 of mob spawner with nbt {_f}
 
Alright, so I figured it out methinks, change "nbt of event-block" to "nbt of target block", like we had before, because "event-block" just refers to mob spawner, like we saw before with {_d}, so it is just going to have the default spawner NBT which means a pig. With target block, it should get the NBT of the actual mined block (maybe??).

Also try using NBT compound rather than NBT
Python:
set {_f} to nbt compound of target block
drop 1 of mob spawner with nbt {_f}

Idk why, but I still cant make this work. All the time it makes the spawner without any entity..
I found this, but that used SkStuff, which does not work now, but if this mechanic could be somehow transfered to SkBee?

Code:
break of mob spawner:
    player's gamemode is not creative
    player's tool is any pickaxe of silk touch
    set {_s} to "%nbt of targeted block%"
    set {_s::*} to {_s} split at """"
    drop mob spawner with nbt "{BlockEntityTag:{SpawnData:{id:""%{_s::2}%""},id:""minecraft:mob_spawner"",SpawnPotentials:[0:{Entity:{id:""%{_s::2}%""},Weight:1}]},display:{Name:""%{_s::2}%""}}"
 
I found something like that as well (something similar), It's for an old version of Minecraft (and skript). You could try the Minecraft summon item command using console, I'm just so confused.
 
I found something like that as well (something similar), It's for an old version of Minecraft (and skript). You could try the Minecraft summon item command using console, I'm just so confused.
So I found a way to make this work. I'm using CMI as my core plugin, so I used the ablitiy to give spawners with mobs inside of them.

Code:
on break of mob spawner:
    if player has permission "urovne.pata":
        if player's tool is netherite pickaxe:
            if player's tool is enchanted with silk touch 10:
                cancel drops
                set {_s} to "%nbt of targeted block%"
                set {_s::*} to {_s} split at "minecraft:"
                set {_d::*} to {_s::2} split at """}}"
                execute console command "give %player% spawner:%{_d::1}%"

Thanks for all the help!