Advertisement
TheBirkIsReal

Untitled

Jun 25th, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.27 KB | None | 0 0
  1. datapack (
  2.     name = "Ticker",
  3.     namespace = "ticker",
  4.     description = "It ticks",
  5.     path = "./",
  6. )
  7.  
  8. func main @load {
  9.     /scoreboard objectives add SomeCounter dummy "Some Counter"
  10.     /scoreboard players set @a SomeCounter 0
  11. }
  12.  
  13. func tick @tick {
  14.     /scoreboard players add @a SomeCounter 1
  15.  
  16.     as @a[SomeCounter=20..] {
  17.         /tellraw @s {"text":"20 ticks has passed"}
  18.         /scoreboard players set @s SomeCounter 0
  19.     }
  20. }
  21.  
  22. # The above would generate the datapack below
  23.  
  24. Ticker/
  25.   pack.mcmeta
  26.   data/
  27.     minecraft/
  28.       tags/
  29.         functions/
  30.           load.json
  31.           tick.json
  32.     ticker/
  33.       functions/
  34.         main.mcfunction
  35.         tick.mcfunction
  36.         execute0_ln16.mcfunction
  37.  
  38. main.mcfunction:
  39.   scoreboard objectives add SomeCounter dummy
  40.   scoreboard players set @a SomeCounter 0
  41.  
  42. tick.mcfunction
  43.   scoreboard players add @a SomeCounter 1
  44.   execute as @p[scores={SomeCounter=20..}] run function ticker:execute0_ln16
  45.  
  46. execute0_ln15.mcfunction:
  47.   tellraw @s {"text":"20 ticks has passed"}
  48.   scoreboard players set @s SomeCounter 0
  49.  
  50. pack.mcmeta:
  51. {
  52.     "pack": {
  53.         "description": "It ticks",
  54.         "pack_format": 1
  55.     }
  56. }
  57.  
  58. load.json:
  59. {
  60.     values: ["ticker:main"]
  61. }
  62.  
  63. tick.json:
  64. {
  65.     values: ["ticker:tick"]
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement