Silk Spawners

Scripts that are ready to be just dropped-in and used! Exclusively high-quality scripts selected by the Denizen team.
Post Reply
User avatar
bear
Regular
Regular
Posts: 12
Joined: January 26th, 2019, 2:39 pm

Silk Spawners

Post by bear » April 6th, 2020, 2:45 pm

Simple script replacement for an entire plugin concept: Silk-touch pickaxes retain spawners when broken.

Step One: Hold your pickaxe
Step Two: Swing your pickaxe at spawner
Step Three: $$$$$

Here's the haste link: https://one.denizenscript.com/haste/67203

And here's the raw script:
Spoiler!

Code: Select all

Silk_Spawners:
    type: world
    debug: false
    events:
        on player breaks spawner with *pickaxe:
            - if !<player.item_in_hand.enchantments.contains[silk_touch]>:
                - stop
            - define Type <context.location.spawner_type.entity_type.to_titlecase>
            - determine <context.material.item.with[display_name=<[Type]><&sp>Spawner;nbt=key/<[Type]>]>
        on player places spawner:
            - if !<context.item_in_hand.has_nbt[key]>:
                - stop
            - define Type <context.item_in_hand.nbt[key]>
            - wait 1t
            - adjust <context.location> spawner_type:<[Type]>
Last edited by bear on April 9th, 2020, 8:05 am, edited 1 time in total.

User avatar
mcmonkey
Site Admin
Site Admin
Posts: 267
Joined: August 5th, 2016, 7:27 pm
Location: Los Angeles, California, USA
Contact:

Re: Silk Spawners

Post by mcmonkey » April 6th, 2020, 2:59 pm

Code: Select all

        on player places spawner:
            - if !<player.item_in_hand.has_nbt[key]>:
                - stop
            - if <context.hand> == HAND:
                - define Type <player.item_in_hand.nbt[key]>
            - else:
                - define Type <player.item_in_offhand.nbt[key]> 
^ somethings gone funky in the handedness logic here.

Code: Select all

            - modifyblock <context.location> spawner 
^ is there a particular reason for this modifyblock of a block into what it should already be?
Denizen lead developer. On Discord as mcmonkey#6666.

User avatar
bear
Regular
Regular
Posts: 12
Joined: January 26th, 2019, 2:39 pm

Re: Silk Spawners

Post by bear » April 9th, 2020, 8:08 am

mcmonkey wrote:
April 6th, 2020, 2:59 pm
^ somethings gone funky in the handedness logic here.
I forgot to change that to the context as opposed to the playertag's equivalent; thanks for pointing that out
mcmonkey wrote:
April 6th, 2020, 2:59 pm
^ is there a particular reason for this modifyblock of a block into what it should already be?
I don't think so, I can't remember why I had that there, and it clearly works without it so I've removed it. Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests