Paste #69280: Untitled Paste

Date: 2020/05/20 11:32:43 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


thebucket:
  type: item
  material: bucket
  display name: "<&e>Bucket"
  lore:
  - <&f>Dear god...

BucketStop:
  type: world
  debug: false
  events:
    on player starts sneaking:
    - flag <player> Sucking:!
    on player left clicks:
    - flag <player> Sucking:!
    on player picks up item:
    - if <player.has_flag[sucking]>:
      - determine cancelled
    on player fills thebucket:
    - determine cancelled
    on player empties thebucket:
    - determine cancelled
    on entity damaged by thorns:
    - if <context.damager.location.distance[<context.entity.location>]> >= 4.5:
      - determine cancelled
    on thebucket despawns:
    - determine cancelled


BucketProjectile:
  type: world
  debug: false
  events:
    on player picks up item:
    - if <server.flag[bucketprojectiles].contains[<context.entity>]>:
      - determine cancelled
    on tick:
    - if <server.flag[bucketprojectiles]||null> != null:
      - foreach <server.flag[bucketprojectiles]> as:entity:
        - define velocity <[entity].velocity.mul[1.2]>
        - define vx <[velocity].x.abs>
        - define vy <[velocity].y.abs>
        - define vz <[velocity].z.abs>
        - define v <[vx].add[<[vy]>].add[<[vz]>]||0>
        - define max <[entity].bounding_box.last>
        - define min <[entity].bounding_box.first>
        - define cuboid <cuboid[<[min]>|<[max]>]>
        - define center <[cuboid].center>
        - define size1 <[max].sub[<[min]>]>
        - define sizex <[size1].x.abs>
        - define sizey <[size1].y.abs>
        - define sizez <[size1].z.abs>
        - define size <[sizex].add[sizey].add[sizez]||0>
        - if <[entity].entity_type> == dropped_item:
          - define entities <[center].find.entities.within[<[size].mul[8.6]>].exclude[<[entity].flag[shooter].as_entity>]||null>
        - else:
          - define entities <[center].find.entities.within[<[size].mul[3.6]>].exclude[<[entity].flag[shooter].as_entity>]||null>
        - if <[entity].entity_type> == dropped_item:
          - define item <[entity].item>
          - if <[item].max_durability||null> != null:
            - define durability <[item].max_durability>
            - if <[durability]> > 500:
              - define damage <[v].mul[2.25].mul[<[durability].mul[0.0017]>]>
            - else:
              - define damage <[v].mul[2.25].mul[<[durability].mul[0.0057]>]>
          - else:
            - if <[item].material.block_strength||null> != null:
              - define strength <[item].material.block_strength>
              - if <[strength]> == -1:
                - define damage <[v].mul[18278241246]>
              - else:
                - define damage <[v].mul[2.25].mul[<[strength].mul[0.3]>]>
            - else:
              - define damage <[v].mul[0.2]>
        - else:
          - define damage <[v].mul[2.25].mul[<[size].mul[1.2]>]>
        - define nearblocks:<[center].find.blocks.within[<[size].mul[1.8]>].filter[<material.block_strength.is[OR_MORE].than[<[damage]>]>]||!>
        #- define blocksbroken <[center].find.blocks.within[<[size].mul[2.2]>].filter[<material.name.is[!=].to[air]>].filter[<material.block_strength.is[OR_LESS].than[<[v].mul[1.8].add[<[size].mul[2]>]>]>]>
        - if <[v]> >= 0.7 && <[entities].size> > 1:
          - hurt <[entities]> <[damage]> source:<[entity].flag[shooter].as_entity>
        - if <[nearblocks].size||0> >= 1:
          - hurt <[entity]> <[damage]>
        #- if <[blocksbroken]||null> != null:
          #- foreach <[blocksbroken]> as:block:
            #- modifyblock <[block].as_location> air naturally delayed source:<player>
        - if <[v]> <= 0.4 || <[entity].is_on_ground> || <[entity]||null> == null || <[size]> == 0:
          - flag server bucketprojectiles:<-:<[entity]>
          - flag <[entity]> shooter:!

BucketEscape:
  type: world
  debug: false
  events:
    on player dies:
    - if <player.location.world.name> == bucket:
      - 

Bucketlocked:
  type: world
  debug: false
  events:
    on player changes world:
    - if <player.location.world.name> == bucket:
      - if <player.has_flag[out].not>:
        - flag <player> out:!
        - playsound <player.location.above[60]> sound:ENTITY_ZOMBIE_ATTACK_IRON_DOOR pitch:0 volume:5
        - playsound <player.location.above[60]> sound:BLOCK_ANVIL_PLACE pitch:0 volume:5
        - foreach <server.list_online_players.filter[<inventory.contains.scriptname[thebucket]>]> as:player:
          - if <[player]||null> != null:
            - playsound <[player].location> sound:ENTITY_ZOMBIE_ATTACK_IRON_DOOR pitch:2 volume:0.2
            - playsound <[player].location> sound:BLOCK_ANVIL_PLACE pitch:2 volume:0.2
            - playsound <[player].location> sound:BLOCK_NOTE_BLOCK_CHIME pitch:2 volume:0.2
            #- narrate "<&e><context.entity.name> is trying to get out!" targets:<[player]>
        - determine cancelled
      - else:
        - flag <player> out:!
    - else:
      - if <context.destination.world.name> == bucket && <player.location.world.name> != bucket && !<player.has_flag[suckedtp]>:
        - determine cancelled
    on entity teleports:
    - if <context.entity.location.world.name> == bucket:
      - if <context.entity.has_flag[out].not> && <context.destination.world.name> != bucket:
        - flag <player> out:!
        - playsound <player.location.above[60]> sound:ENTITY_ZOMBIE_ATTACK_IRON_DOOR pitch:0 volume:5
        - playsound <player.location.above[60]> sound:BLOCK_ANVIL_PLACE pitch:0 volume:5
        - foreach <server.list_online_players.filter[<inventory.contains.scriptname[thebucket]>]> as:player:
          - if <[player]||null> != null && <context.entity.name||null> != null:
            - playsound <[player].location> sound:ENTITY_ZOMBIE_ATTACK_IRON_DOOR pitch:2 volume:0.2
            - playsound <[player].location> sound:BLOCK_ANVIL_PLACE pitch:2 volume:0.2
            - playsound <[player].location> sound:BLOCK_NOTE_BLOCK_CHIME pitch:2 volume:0.2
            #- narrate "<&e><context.entity.name> is trying to get out!" targets:<[player]>
        - determine cancelled
      - if <context.entity.has_flag[out]>:
        - wait 1t
        - flag <player> out:!
    - else:
      - if <context.destination.world.name> == bucket && <context.entity.location.world.name> != bucket && !<context.entity.has_flag[suckedtp]>:
        - determine cancelled

BucketFall:
  type: world
  debug: false
  events:
    # Event for preventing first fall damage
    on entity damaged by fall:
    - if <context.entity.has_flag[bucketfall]>:
      - flag <context.entity> bucketfall:!
      - if <context.entity.world.name> == bucket:
        - determine cancelled

# Get entities inside bucket
# For 3 seconds, start sucking entities in front
# Check for 3 second cooldown for unnecesary spam

BucketIn:
  type: world
  debug: false
  events:
    on player right clicks with thebucket:
    - determine cancelled passively
    - if <player.location.world.name> == Bucket:
      - playsound <player.location.above[20]> sound:ENTITY_ZOMBIE_ATTACK_IRON_DOOR pitch:0 volume:5
      - playsound <player.location.above[20]> sound:BLOCK_ANVIL_PLACE pitch:0 volume:5
      - stop
    - if !<player.has_flag[Sucking]>:
      - run locally BucketSuckEffects speed:0
    on tick every:5:
    - foreach <server.list_online_players_flagged[Sucking]> as:player:
      - if <[player].item_in_hand.script.name||null> != TheBucket:
        - flag <[player]> Sucking:!


  BucketSuckEffects:
  # Effects, start suck and give cooldown/sucking flag
  - flag <player> Sucking duration:3s
  - while <player.has_flag[Sucking]>:
    - run locally BucketSuckTechnical speed:0
    - playeffect at:<player.location.above[1.6].forward[1.75]> effect:cloud data:0 quantity:2 offset:0.5,0.5,0.5
    - playeffect at:<player.location.above[1.6].forward[2.15]> effect:cloud data:0 quantity:2 offset:0.6,0.6,0.6
    - playeffect at:<player.location.above[1.6].forward[2.25]> effect:cloud data:0 quantity:2 offset:0.7,0.7,0.7
    - playeffect at:<player.location.above[1.6].forward[2.35]> effect:cloud data:0 quantity:2 offset:0.8,0.8,0.8
    - playsound at:<player.location.above[1.6].forward[1.75]> sound:ITEM_BUCKET_FILL
    - actionbar "<&6>Entities in bucket: <&e><world[bucket].entities.size>" targets:<player>
    - wait 1t

  BucketSuckTechnical:
  # Define entities within player eye location
  - define entitieswithin <player.eye_location.find.entities.within[5].exclude[<player>]>
  # Foreach - Check if the player is facing the entities and define them as sucked
  # If true, add it to definition entitylist
  # If false (no available entities), stop script
  - foreach <[entitieswithin]> as:entity:
    - if <player.eye_location.facing[<[entity]>].degrees[70,70]>:
      - define sucked <[sucked].include[<[entity]>]||<list[<[entity]>]||null>>
  - if <[sucked]||null> == null:
    - stop
  # Foreach - Flag entity as sucked. While flagged, get shot towards player until sucked or 3 sec runs out.
  - foreach <[sucked]> as:entity:
    - flag <[entity]> sucked duration:6t
    - flag <[entity]> suckedtp duration:1.5s
    - while <[entity].has_flag[sucked]> && <[entity].location.distance[<player.location>]> >= 1:
      - if <[entity].is_projectile>:
        - if <[entity].location.distance[<player.location>]> <= 2.4:
          - run locally BucketInside speed:0 def:<[entity]>
      - else:
        - shoot <[entity]> destination:<player.location> speed:1 no_rotate
      - wait 5t
    - waituntil <[entity].location.distance[<player.location>]> <= 2.4 || !<[entity].has_flag[sucked]>
    - if <[entity].location.distance[<player.location>]> <= 2.4:
      - run locally BucketInside speed:0 def:<[entity]>
      - actionbar "<&6>Entities in bucket: <&e><world[bucket].entities.size>" targets:<player>
      - stop
    - if !<[entity].has_flag[sucked]>:
      - stop

  BucketInside:
  # Teleport in bucket dimension at spawn chunks and y 333
  # Flag to prevent first fall damage with event on damaged by fall
  - define entity <[1]>
  - playsound <[entity].location> sound:ITEM_BOTTLE_FILL_DRAGONBREATH
  - flag <[entity]> bucketfall
  - adjust <[entity]> remove_when_far_away:false
  - teleport <[entity]> <location[0.5,355,0.5,Bucket]>
  - flag <[entity]> sucked:!

BucketOut:
  type: world
  debug: false
  events:
    on player left clicks with TheBucket:
    - determine cancelled passively
    - if <player.location.world.name> == Bucket:
      - playsound <player.location.above[20]> sound:ENTITY_ZOMBIE_ATTACK_IRON_DOOR pitch:0 volume:5
      - playsound <player.location.above[20]> sound:BLOCK_ANVIL_PLACE pitch:0 volume:5
      - stop
    - if !<player.has_flag[Sucking]>:
      - run locally BucketOutScript speed:0
      - run locally BucketOutScript2 speed:0

  BucketOutScript:
  # Check if empty
  - if <world[bucket].entities.is_empty>:
    - playsound <player> sound:UI_BUTTON_CLICK
    - actionbar "<&c>No entities in the bucket" targets:<player>
    - stop
  # Some particles and sound
  - repeat 5:
    - actionbar "<&6>Entities in bucket: <&e><world[bucket].entities.size>" targets:<player>
    - playeffect at:<player.location.above[1.6].forward[1.75]> effect:WATER_SPLASH quantity:50 offset:0.3,0.3,0.3
    - wait 1t

  BucketOutScript2:
  # Check if empty
  - if <world[bucket].entities.is_empty>:
    - playsound <player> sound:UI_BUTTON_CLICK
    - actionbar "<&c>No entities in the bucket" targets:<player>
    - stop
  - playsound <player.location.above[1.6].forward[1.75]> sound:ITEM_BUCKET_EMPTY
  # Define random entity to get out
  - define entity <world[bucket].entities.random>
  # Teleport and shoot
  - flag <[entity]> out duration:2s
  - adjust <[entity]> fall_distance:0
  - if <[entity].is_projectile>:
    - shoot <[entity]> origin:<player.eye_location.above[1.6].forward[1.75]> speed:3 shooter:<player>
  - else:
    - if <[entity].entity_type> != player:
      - teleport <[entity]> <player.location.above[1.6].forward[1.75]>
    - if <[entity].entity_type> != player:
      - adjust <[entity]> velocity:<player.eye_location.direction.vector.mul[3].with_y[<player.eye_location.direction.vector.y.mul[1.5]>]>
    - else:
      - shoot <[entity]> origin:<player.eye_location.forward[1.75]> speed:3
    - flag server bucketprojectiles:->:<[entity]>
    - flag <[entity]> shooter:<player>
    - wait 1t
    - actionbar "<&6>Entities in bucket: <&e><world[bucket].entities.size>" targets:<player>