Advertisement
akon1248

Guardian Beam (MundoSK, skript-mirror, SkQuery)

Jun 7th, 2019
2,086
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.37 KB | None | 0 0
  1. import:
  2. java.lang.Byte
  3. java.lang.Integer
  4. java.util.Arrays
  5. org.bukkit.Bukkit
  6. net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam
  7. net.minecraft.server.v1_12_R1.ScoreboardTeam
  8. net.minecraft.server.v1_12_R1.ScoreboardTeamBase$EnumTeamPush
  9. function createGuardianBeamLocToLoc(loc1: location, loc2: location, viewers: players, delay: integer):
  10. set {_id1} to random integer between 1 and 2147483647
  11. set {_id2} to random integer between 1 and 2147483647
  12. set {_uuid1} to new uuid
  13. set {_uuid2} to new uuid
  14. set {_packet1} to new play_server_spawn_entity_living packet
  15. set int pnum 0 of {_packet1} to {_id1}
  16. set int pnum 1 of {_packet1} to 68
  17. set "UUID" pinfo 0 of {_packet1} to {_uuid1}
  18. set double pnum 0 of {_packet1} to x-coordinate of {_loc1}
  19. set double pnum 1 of {_packet1} to y-coordinate of {_loc1}
  20. set double pnum 2 of {_packet1} to z-coordinate of {_loc1}
  21. set byte pnum 0 of {_packet1} to floor((vector yaw of vector from {_loc1} to {_loc2})*256/360)
  22. set byte pnum 1 of {_packet1} to floor((vector pitch of vector from {_loc1} to {_loc2})*256/360)
  23. set byte pnum 2 of {_packet1} to floor((vector yaw of vector from {_loc1} to {_loc2})*256/360)
  24. set {_json1::0} to Byte.valueOf("32")
  25. set {_json1::12} to false
  26. set {_json1::13} to Integer.valueOf("%{_id2}%")
  27. set "DataWatcher" pjson 0 of {_packet1} to json from listvar {_json1::*}
  28. set {_packet2} to new play_server_spawn_entity packet
  29. set int pnum 0 of {_packet2} to {_id2}
  30. set int pnum 6 of {_packet2} to 78
  31. set "UUID" pinfo 0 of {_packet1} to {_uuid2}
  32. set double pnum 0 of {_packet2} to x-coordinate of {_loc2}
  33. set double pnum 1 of {_packet2} to y-coordinate of {_loc2}
  34. set double pnum 2 of {_packet2} to z-coordinate of {_loc2}
  35. set {_packet3} to new play_server_entity_metadata packet
  36. set int pnum 0 of {_packet3} to {_id2}
  37. set {_json2::0} to Byte.valueOf("32")
  38. set {_json2::5} to true
  39. set {_json2::11} to Byte.valueOf("17")
  40. set "WatchableCollection" pjson 0 of {_packet3} to json from listvar {_json2::*}
  41. set {_nmsscoreboard} to Bukkit.getScoreboardManager().getNewScoreboard().getHandle()
  42. set {_nmsscoreboardteam} to new ScoreboardTeam({_nmsscoreboard}, random 16 char string from `a-zA-Z0-9`)
  43. {_nmsscoreboardteam}.setCollisionRule(EnumTeamPush.NEVER!)
  44. set {_teampacket1} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, 0)
  45. set {_teampacket2} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, Arrays.asList({_uuid1}, {_uuid2}), 3)
  46. set {_teampacket3} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, Arrays.asList({_uuid1}, {_uuid2}), 4)
  47. set {_teampacket4} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, 1)
  48. loop {_viewers::*}:
  49. send loop-value packet {_packet1}
  50. send loop-value packet {_packet2}
  51. send loop-value packet {_packet3}
  52. loop-value.getHandle().playerConnection!.sendPacket({_teampacket1})
  53. loop-value.getHandle().playerConnection!.sendPacket({_teampacket2})
  54. wait "%{_delay}% tick" parsed as timespan
  55. set {_packet4} to new play_server_entity_destroy packet
  56. set int array pnum 0 of {_packet4} to {_id1} and {_id2}
  57. loop {_viewers::*}:
  58. send loop-value packet {_packet4}
  59. loop-value.getHandle().playerConnection!.sendPacket({_teampacket3})
  60. loop-value.getHandle().playerConnection!.sendPacket({_teampacket4})
  61. function createGuardianBeamEntityToEntity(ent1: entity, ent2: entity, viewers: players, delay: integer, startloctype: integer):
  62. {_startloctype} is between 0 and 2
  63. if {_startloctype} is 0:
  64. set {_loc} to location of head of {_ent1}
  65. else if {_startloctype} is 1:
  66. set {_loc} to location {_ent1}.getHeight()/2 meter above location of {_ent1}
  67. else if {_startloctype} is 2:
  68. set {_loc} to location of {_ent1}
  69. set {_id} to random integer between 1 and 2147483647
  70. set {_uuid} to new uuid
  71. set {_packet1} to new play_server_spawn_entity_living packet
  72. set int pnum 0 of {_packet1} to {_id}
  73. set int pnum 1 of {_packet1} to 68
  74. set "UUID" pinfo 0 of {_packet1} to {_uuid}
  75. set double pnum 0 of {_packet1} to x-coordinate of {_loc}
  76. set double pnum 1 of {_packet1} to y-coordinate of {_loc}
  77. set double pnum 2 of {_packet1} to z-coordinate of {_loc}
  78. set byte pnum 0 of {_packet1} to floor((vector yaw of vector from {_loc} to {_ent2})*256/360)
  79. set byte pnum 1 of {_packet1} to floor((vector pitch of vector from {_loc} to {_ent2})*256/360)
  80. set byte pnum 2 of {_packet1} to floor((vector yaw of vector from {_loc} to {_ent2})*256/360)
  81. set {_json1::0} to Byte.valueOf("32")
  82. set {_json1::12} to false
  83. set {_json1::13} to Integer.valueOf("%id of {_ent2}%")
  84. set "DataWatcher" pjson 0 of {_packet1} to json from listvar {_json1::*}
  85. set {_nmsscoreboard} to Bukkit.getScoreboardManager().getNewScoreboard().getHandle()
  86. set {_nmsscoreboardteam} to new ScoreboardTeam({_nmsscoreboard}, random 16 char string from `a-zA-Z0-9`)
  87. {_nmsscoreboardteam}.setCollisionRule(EnumTeamPush.NEVER!)
  88. set {_teampacket1} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, 0)
  89. set {_teampacket2} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, Arrays.asList({_uuid}), 3)
  90. set {_teampacket3} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, Arrays.asList({_uuid}), 4)
  91. set {_teampacket4} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, 1)
  92. loop {_viewers::*}:
  93. send loop-value packet {_packet1}
  94. loop-value.getHandle().playerConnection!.sendPacket({_teampacket1})
  95. loop-value.getHandle().playerConnection!.sendPacket({_teampacket2})
  96. loop {_delay} times:
  97. if {_startloctype} is 0:
  98. set {_loc} to location of head of {_ent1}
  99. else if {_startloctype} is 1:
  100. set {_loc} to location {_ent1}.getHeight()/2 meter above location of {_ent1}
  101. else if {_startloctype} is 2:
  102. set {_loc} to location of {_ent1}
  103. set {_packet2} to new play_server_entity_teleport packet
  104. set int pnum 0 of {_packet2} to {_id}
  105. set double pnum 0 of {_packet2} to x-coordinate of {_loc}
  106. set double pnum 1 of {_packet2} to y-coordinate of {_loc}
  107. set double pnum 2 of {_packet2} to z-coordinate of {_loc}
  108. loop {_viewers::*}:
  109. send loop-value-2 packet {_packet2}
  110. if {_ent1} is dead:
  111. stop loop
  112. if {_ent2} is dead:
  113. stop loop
  114. wait 1 tick
  115. set {_packet4} to new play_server_entity_destroy packet
  116. set int array pnum 0 of {_packet4} to {_id}
  117. loop {_viewers::*}:
  118. send loop-value packet {_packet4}
  119. loop-value.getHandle().playerConnection!.sendPacket({_teampacket3})
  120. loop-value.getHandle().playerConnection!.sendPacket({_teampacket4})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement