Paste #107204: Unnamed Denizen Script Paste

Date: 2023/03/10 21:13:09 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


entity_manipulator_item:
    debug: false
    type: item
    material: bamboo
    display name: Entity Manipulator
    mechanisms:
        unbreakable: true
    flags:
        active_manipulator: false

entity_manipulator_inventory:
    debug: false
    type: inventory
    inventory: chest
    title: <&8><bold>Entity Manipulator
    gui: true
    slots:
    - [rotate_15_item] [] [] [] [] [] [] [] []
    - [] [] [] [] [] [] [] [] []

entity_manipulator_command:
    debug: false
    type: command
    name: entitymanipulator
    description: A stick that lets you manipulate targeted entities.
    usage: /entitymanipulator
    aliases:
    - em
    permission: give.entitymanipulator
    script:
    - give entity_manipulator_item quantity:1

entity_manipulator_item_world:
    debug: true
    type: world
    events:
        # Player selects item in toolbar.
        on player scrolls their hotbar item:entity_manipulator_item:
        ## Doesn't work.
        - narrate <player.item_in_hand.has_flag[active_manipulator]>
        # Open Inventory and cancel world interaction.
        on player right clicks block with:entity_manipulator_item:
        - inventory open d:entity_manipulator_inventory
        - determine cancelled
        # Don't break any blocks.
        on player left clicks block with:entity_manipulator_item:
        - determine cancelled
        # Cancel Damage Dealt to Entity. NPC's still receive a damage triggered event though!!
        on player damages entity with:entity_manipulator_item bukkit_priority:low:
        - narrate "Low Priority: <context.cancelled>"
        - determine cancelled
        on player damages entity with:entity_manipulator_item bukkit_priority:high:
        - narrate "High Priority: <context.cancelled>"
        - determine cancelled

        # Set Active Manipulation Flag:
        after player clicks rotate_15_item in entity_manipulator_inventory:
        - if <player.item_in_hand> matches entity_manipulator_item:
            - inventory flag slot:hand active_manipulator:rotate_15_item
            - narrate "Active Tool Set: Rotate Entity 15 Degrees (clockwise)" targets:<server.online_players>
        - inventory close

        # Triggered Logic
        on player animates ARM_SWING with:entity_manipulator_item:
        - if <player.target.exists>:
            ## Doesn't work.
            - if <player.item_in_hand.flag[active_manipulator]>:
                - narrate <player.item_in_hand>

# Manipulation Item Containers!

rotate_15_item:
    type: item
    material: arrow