akon1248

投げナイフ

Feb 25th, 2019
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. on rightclick with iron sword:
  2. {timers.%player%::throwingknife} is not set
  3. play sound "entity.arrow.shoot" to all players at player with volume 1 pitch 1.2
  4. set {_loc} to location 1.5 meter above location of player
  5. spawn an armor stand at location sin(90-pitch of player*-1)*0.4 meter below location cos(90-pitch of player*-1)*0.4 meter horizontal forwards location 0.75 meter below location 0.1875 meter horizontal to the right location 0.3 meter backwards location 1 meter forwards location 1.5 meter above location of player
  6. add "{NoGravity:1b,Invisible:1b,Marker:1b,Small:1b,Rotation:[%yaw of player%f,0f],Pose:{Head:[90f,%pitch of player*-1+45%f,90f]}}" to nbt of last spawned armor stand
  7. wait 1 tick
  8. add "{ArmorItems:[{},{},{},{id:""minecraft:iron_sword"",Count:1b,Damage:0s}]}" to nbt of last spawned armor stand
  9. set {knife::%UUID of last spawned armor stand%} to {_loc}
  10. set {knifeage.%UUID of last spawned armor stand%} to 200
  11. set {knifeshooter.%UUID of last spawned armor stand%} to player
  12. set {timers.%player%::throwingknife} to 200
  13. function getEntityFromUUID(uuid: text) :: entity:
  14. loop all entities:
  15. if UUID of loop-entity is "%{_uuid}%":
  16. return loop-entity
  17. stop loop
  18. every tick:
  19. loop {knife::*}:
  20. {knifeage.%loop-index%} >= 1
  21. set {_knife} to getEntityFromUUID(loop-index)
  22. set {_nohitblocks::*} to 0, 6, 8, 9, 10, 11, 30, 31, 32, 36, 37, 38, 39, 40, 50, 51, 55, 63, 65, 68, 69, 70, 72, 76, 77, 93, 94, 131, 143, 147, 148, 149, 150, 175 and 425
  23. loop 12 times:
  24. set {knife::%loop-index%} to location 0.25 meter forwards {knife::%loop-index%}
  25. teleport {_knife} to location sin(90-pitch of {knife::%loop-index%}*-1)*0.4 meter below location cos(90-pitch of {knife::%loop-index%}*-1)*0.4 meter horizontal forwards location 0.7 meter below location 0.1875 meter horizontal to the right location 0.3 meter backwards {knife::%loop-index%}
  26. loop entities in radius 0.5 around {knife::%loop-index%}:
  27. loop-entity is a living entity
  28. loop-entity is not armor stand
  29. loop-entity is not {knifeshooter.%loop-index%}
  30. if loop-entity is a player:
  31. loop-entity's gamemode is survival or adventure
  32. make {knifeshooter.%loop-index%} damage loop-entity by 6
  33. delete {knife::%loop-index%}
  34. delete {knifeage.%loop-index%}
  35. delete {knifeshooter.%loop-index%}
  36. kill {_knife}
  37. else if loop-entity is not a player:
  38. make {knifeshooter.%loop-index%} damage loop-entity by 6
  39. delete {knife::%loop-index%}
  40. delete {knifeage.%loop-index%}
  41. delete {knifeshooter.%loop-index%}
  42. kill {_knife}
  43. if {_nohitblocks::*} do not contain id of block at location 0.3 meter forwards {knife::%loop-index%}:
  44. play sound "entity.zombie.attack_iron_door" to all players at {knife::%loop-index%} with volume 1 pitch 2
  45. play sound "entity.item.break" to all players at {knife::%loop-index%} with volume 1 pitch 2
  46. delete {knife::%loop-index%}
  47. delete {knifeage.%loop-index%}
  48. delete {knifeshooter.%loop-index%}
  49. delayKill({_knife}, 60)
  50. remove 1 from {knifeage.%loop-index%}
  51. {knifeage.%loop-index%} is 0
  52. delete {knife::%loop-index%}
  53. delete {knifeage.%loop-index%}
  54. delete {knifeshooter.%loop-index%}
  55. kill {_knife}
  56. loop all players:
  57. {timers.%loop-player%::throwingknife} >= 1
  58. remove 1 from {timers.%loop-player%::throwingknife}
  59. if loop-player's tool is iron sword:
  60. send action bar from "&e投げナイフが使用可能になるまであと%ceil({timers.%loop-player%::throwingknife}/20)%秒" to loop-player
  61. {timers.%loop-player%::throwingknife} is 0
  62. delete {timers.%loop-player%::throwingknife}
  63. send action bar from "&e投げナイフが使用可能になりました" to loop-player
  64. function delayKill(e: entity, delay: number):
  65. if {_delay} is 0:
  66. kill {_e}
  67. else:
  68. loop {_delay} times:
  69. wait 1 tick
  70. kill {_e}
Advertisement
Add Comment
Please, Sign In to add comment