Paste #115137: Unnamed Denizen Script Paste

Date: 2023/09/12 06:54:52 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


bonsai_pot:
    type: item
    debug: false
    material: paper
    display name: <&f>Pot de bonsai
    lore:
    - <empty>
    - <&f>Placer une terre
    - <&f>une pousse d'arbre
    - <&f>pour commencer la culture
    - <empty>
    mechanisms:
        custom_model_data: 10205

dirt_bonsai_pot:
  type: entity
  debug: false
  entity_type: block_display
  mechanisms:
    material: dirt
    scale: 0.74,0.3,0.74

sapling_bonsai_pot:
  type: entity
  debug: false
  entity_type: item_display
  mechanisms:
    item: oak_sapling
    scale: 0,0,0

bonsai_pot_event:
    type: world
    Debug: true
    events:
        on player right clicks block with:bonsai_pot:
        - if <placeholder[superior_island_location_is_member]> matches yes:
            - if <context.location.advanced_matches[air]>:
                - determine cancelled
            - if <context.location.above.advanced_matches[air]>:
                - ratelimit <player> 5t
                - take iteminhand quantity:1
                - worldedit paste file:../../WorldEdit/schematics/bonsai_pot position:<context.location.above> noair
                - playsound <player.location> sound:block_wood_place
                - flag <context.location.above> bonsai_pot

        on player breaks block location_flagged:bonsai_pot:
        - if <placeholder[superior_island_location_is_member]> matches yes:
            - flag <context.location> bonsai_pot:!
            - drop <context.location> bonsai_pot
            - if <context.location.has_flag[dirtOn]>:
                - drop <context.location> dirt
                - remove <context.location.flag[dirtOn]>
                - flag <context.location> dirtOn:!
            - if <context.location.has_flag[saplingOn]>:
                - drop <context.location> <context.location.flag[saplingType]>
                - remove <context.location.flag[saplingOn]>
                - flag <context.location> saplingType:!
                - flag server bonsai_pots:<-:<context.location>
            - flag <context.location> bonsai_rdy:!
            - determine cancelled

        on player right clicks block location_flagged:bonsai_pot:
        - determine passively cancelled


        - if <player.item_in_hand.advanced_matches[dirt]>:
            - if <context.location.has_flag[dirtOn].not>:
                - take iteminhand quantity:1
                - playsound <player> sound:block_grass_place
                - spawn dirt_bonsai_pot <context.location.center.add[-0.37,-0.4,-0.37]> save:dirt
                - flag <context.location> dirtOn:<entry[dirt].spawned_entity>
                - stop


        - if <player.item_in_hand.advanced_matches[*_sapling]>:
            - if <context.location.has_flag[dirtOn]>:
                - if <context.location.has_flag[saplingOn]>:
                    - remove <context.location.flag[saplingOn]>
                    - drop <context.location> <context.location.flag[saplingType]>
                - flag <context.location> saplingType:<player.item_in_hand.material.name>
                - flag <context.location> saplingMaterial:<context.location.flag[saplingType].before[_sapling]>
                - take iteminhand quantity:1
                - spawn sapling_bonsai_pot <context.location.center.add[0,-0.09,0]> save:sapling
                - define sapling <entry[sapling].spawned_entity>
                - flag <context.location> saplingOn:<[sapling]>
                - define saplingType <context.location.flag[saplingType]>
                - adjust <[sapling]> interpolation_duration:0t
                - adjust <[sapling]> interpolation_start:0
                - adjust <[sapling]> scale:0,0,0
                - adjust <[sapling]> translation:0,0,0
                - playsound <player> sound:block_cherry_sapling_place
                - adjust <[sapling]> item:<context.location.flag[saplingType]>
                - adjust <[sapling]> interpolation_duration:10s
                - adjust <[sapling]> interpolation_start:0
                - adjust <[sapling]> scale:0.8,0.8,0.8
                - adjust <[sapling]> translation:0,0.4,0
                - wait 10s
                - if <[saplingType]> == <context.location.flag[saplingType]>:
                            - if <context.location.below.advanced_matches[chest]>:
                                - if <context.location.has_flag[dirtOn]> && <context.location.has_flag[saplingOn]> && <context.location.has_flag[saplingMaterial]>:
                                    - if <context.location.flag[saplingMaterial]> == oak || dark_oak:
                                        - if <context.location.below.inventory.can_fit[<list[oak_log|oak_leaves|stick|apple]>].quantity[1]>:
                                            - give <list[<context.location.flag[saplingMaterial]>_log|<context.location.flag[saplingMaterial]>_leaves|stick|apple]> to:<context.location.below.inventory>
                                        - else:
                                            - playeffect at:<context.location.center> effect:villager_angry quantity:1 offset:0
                                    - if <context.location.flag[saplingMaterial]> == spruce || birch || jungle || acacia || cherry:
                                        - if <context.location.below.inventory.can_fit[<list[spruce_log|spruce_leaves|stick]>].quantity[1]>:
                                            - give <list[<context.location.flag[saplingMaterial]>_log|<context.location.flag[saplingMaterial]>_leaves|stick]> to:<context.location.below.inventory>
                                        - else:
                                            - playeffect at:<context.location.center> effect:villager_angry quantity:1 offset:0
                            - else:
                                - playeffect at:<context.location.center> effect:villager_angry quantity:1 offset:0
                - flag server bonsai_pots:->:<context.location>


        - if <player.is_sneaking>:

            - if <context.location.has_flag[saplingOn]>:
                - playsound <player> sound:block_cherry_sapling_break
                - remove <context.location.flag[saplingOn]>
                - drop <context.location> <context.location.flag[saplingType]>
                - flag <context.location> saplingOn:!
                - flag <context.location> saplingType:!
                - flag server bonsai_pots:<-:<context.location>
                - stop


            - if <context.location.has_flag[dirtOn]>:
                - playsound <player> sound:block_grass_break
                - remove <context.location.flag[DirtOn]>
                - drop <context.location> dirt
                - flag <context.location> dirtOn:!
                - flag server bonsai_pots:<-:<context.location>
                - stop

        on player right clicks chest with:bonsai_pot:
        - determine cancelled

        on system time secondly every:10:
        - foreach <server.flag[bonsai_pots]> as:bonsai:
                - if <[bonsai].has_flag[saplingOn]>:
                        - define saplingType <[bonsai].flag[saplingType]>
                        - define sapling <[bonsai].flag[saplingOn]>
                        - adjust <[sapling]> interpolation_duration:0t
                        - adjust <[sapling]> interpolation_start:0
                        - adjust <[sapling]> scale:0,0,0
                        - adjust <[sapling]> translation:0,0,0

                        - wait 1s

                        - adjust <[sapling]> interpolation_duration:9s
                        - adjust <[sapling]> interpolation_start:0
                        - adjust <[sapling]> scale:0.8,0.8,0.8
                        - adjust <[sapling]> translation:0,0.4,0
                        - wait 9s
                        - if <[bonsai].below.advanced_matches[chest]>:
                                        - if <[bonsai].has_flag[dirtOn]> && <[bonsai].has_flag[saplingOn]> && <[bonsai].has_flag[saplingMaterial]>:
                                            - if <[bonsai].flag[saplingMaterial]> == oak || dark_oak:
                                                - if <[bonsai].below.inventory.can_fit[<list[oak_log|oak_leaves|stick|apple]>].quantity[1]>:
                                                    - give <list[<[bonsai].flag[saplingMaterial]>_log|<[bonsai].flag[saplingMaterial]>_leaves|stick|apple]> to:<[bonsai].below.inventory>
                                                - else:
                                                    - playeffect at:<[bonsai].center> effect:villager_angry quantity:1 offset:0
                                            - else:
                                                - if <[bonsai].below.inventory.can_fit[<list[spruce_log|spruce_leaves|stick]>].quantity[1]>:
                                                    - give <list[<[bonsai].flag[saplingMaterial]>_log|<[bonsai].flag[saplingMaterial]>_leaves|stick]> to:<[bonsai].below.inventory>
                                                - else:
                                                    - playeffect at:<[bonsai].center> effect:villager_angry quantity:1 offset:0
                        - else:
                            - playeffect at:<[bonsai].center> effect:villager_angry quantity:1 offset:0