akon1248

Gaster Blaster

Feb 2nd, 2019
1,418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. function pitchAtan2(loc1: location, loc2: location) :: number:
  2. set {_dx} to x-coordinate of {_loc2} - x-coordinate of {_loc1}
  3. set {_dy} to y-coordinate of {_loc2} - y-coordinate of {_loc1}
  4. set {_dz} to z-coordinate of {_loc2} - z-coordinate of {_loc1}
  5. set {_pitch} to 0-atan2(sqrt({_dx}^2+{_dz}^2), {_dy})
  6. return {_pitch}
  7. function yawAtan2(loc1: location, loc2: location) :: number:
  8. set {_dx} to x-coordinate of {_loc2} - x-coordinate of {_loc1}
  9. set {_dz} to z-coordinate of {_loc2} - z-coordinate of {_loc1}
  10. set {_yaw} to atan2({_dx}, {_dz})-90
  11. return {_yaw}
  12. function gasterBlaster(shooter: entity, target: entity):
  13. add string, cobweb, dead grass, banner, lever, redstone wire, wooden button, stone button, torch, fire, lava, water, portal, end portal, ender gateway, "6" parsed as itemtype, "37" parsed as itemtype, "38" parsed as itemtype, "39" parsed as itemtype, "40" parsed as itemtype, "175" parsed as itemtype and air to {_nohitblocks::*}
  14. execute console command "execute %UUID of {_shooter}% ~ ~ ~ playsound gasterblaster.all master @a ~ ~ ~ 3"
  15. spawn an armor stand at location random number between 2 and 3 meter above location random number between -7 and 7 meter right location of {_shooter}
  16. set {_blaster} to last spawned armor stand
  17. add "{Invisible:1b,Marker:1b,NoGravity:1b,ArmorItems:[{},{},{},{id:""minecraft:skull"",Count:1b,Damage:5s}]}" to nbt of {_blaster}
  18. wait 1 tick
  19. set {_pitch} to pitchAtan2({_blaster}, {_target})
  20. if {_pitch} < 0:
  21. add 360 to {_pitch}
  22. add "{Pose:{Head:[%{_pitch}%f,0f,0f]},Rotation:[%yawAtan2({_blaster}, {_target})%f,0f]}" to nbt of {_blaster}
  23. set {_shootloc} to location 1.25 meter above location of {_blaster}
  24. set pitch of {_shootloc} to pitchAtan2({_shootloc}, {_target})
  25. wait 0.5 second
  26. loop 200 times:
  27. set {_loopnum} to loop-number
  28. set {_x} to x-coordinate of location {_loopnum}*0.5 meter forwards {_shootloc}
  29. set {_y} to y-coordinate of location {_loopnum}*0.5 meter forwards {_shootloc}
  30. set {_z} to z-coordinate of location {_loopnum}*0.5 meter forwards {_shootloc}
  31. execute console command "execute %UUID of {_shooter}% ~ ~ ~ particle instantSpell %{_x}% %{_y}% %{_z}% 0.5 0.5 0.5 0 50 force"
  32. loop entities in radius 0.75 around location {_loopnum}*0.5 meter forwards {_shootloc}:
  33. loop-entity is a living entity
  34. loop-entity is not {_shooter}
  35. {_hit.%UUID of loop-entity%} is not set
  36. make {_shooter} damage loop-entity by 10
  37. loop-entity.setNoDamageTicks(0)
  38. set {_hit.%UUID of loop-entity%} to 1
  39. execute console command "execute %UUID of loop-entity% ~ ~ ~ effect @s 20 10 2"
  40. if {_nohitblocks::*} do not contain block at location {_loopnum}*0.5+0.5 meter forwards {_shootloc}:
  41. execute console command "execute %UUID of {_shooter}% ~ ~ ~ particle fireworksSpark %{_x}% %{_y}% %{_z}% 0 0 0 0.5 1000 force"
  42. stop loop
  43. wait 1.5 second
  44. kill {_blaster}
  45. on shoot:
  46. shooter is a skeleton
  47. cancel event
  48. gasterBlaster(shooter, target of shooter)
  49. on shoot:
  50. shooter is a wither
  51. cancel event
  52. gasterBlaster(shooter, target of shooter)
  53. on shoot:
  54. shooter is a blaze
  55. cancel event
  56. gasterBlaster(shooter, target of shooter)
Advertisement
Add Comment
Please, Sign In to add comment