Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import:
- java.lang.Byte
- java.lang.Integer
- java.util.Arrays
- org.bukkit.Bukkit
- net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam
- net.minecraft.server.v1_12_R1.ScoreboardTeam
- net.minecraft.server.v1_12_R1.ScoreboardTeamBase$EnumTeamPush
- function createGuardianBeamLocToLoc(loc1: location, loc2: location, viewers: players, delay: integer):
- set {_id1} to random integer between 1 and 2147483647
- set {_id2} to random integer between 1 and 2147483647
- set {_uuid1} to new uuid
- set {_uuid2} to new uuid
- set {_packet1} to new play_server_spawn_entity_living packet
- set int pnum 0 of {_packet1} to {_id1}
- set int pnum 1 of {_packet1} to 68
- set "UUID" pinfo 0 of {_packet1} to {_uuid1}
- set double pnum 0 of {_packet1} to x-coordinate of {_loc1}
- set double pnum 1 of {_packet1} to y-coordinate of {_loc1}
- set double pnum 2 of {_packet1} to z-coordinate of {_loc1}
- set byte pnum 0 of {_packet1} to floor((vector yaw of vector from {_loc1} to {_loc2})*256/360)
- set byte pnum 1 of {_packet1} to floor((vector pitch of vector from {_loc1} to {_loc2})*256/360)
- set byte pnum 2 of {_packet1} to floor((vector yaw of vector from {_loc1} to {_loc2})*256/360)
- set {_json1::0} to Byte.valueOf("32")
- set {_json1::12} to false
- set {_json1::13} to Integer.valueOf("%{_id2}%")
- set "DataWatcher" pjson 0 of {_packet1} to json from listvar {_json1::*}
- set {_packet2} to new play_server_spawn_entity packet
- set int pnum 0 of {_packet2} to {_id2}
- set int pnum 6 of {_packet2} to 78
- set "UUID" pinfo 0 of {_packet1} to {_uuid2}
- set double pnum 0 of {_packet2} to x-coordinate of {_loc2}
- set double pnum 1 of {_packet2} to y-coordinate of {_loc2}
- set double pnum 2 of {_packet2} to z-coordinate of {_loc2}
- set {_packet3} to new play_server_entity_metadata packet
- set int pnum 0 of {_packet3} to {_id2}
- set {_json2::0} to Byte.valueOf("32")
- set {_json2::5} to true
- set {_json2::11} to Byte.valueOf("17")
- set "WatchableCollection" pjson 0 of {_packet3} to json from listvar {_json2::*}
- set {_nmsscoreboard} to Bukkit.getScoreboardManager().getNewScoreboard().getHandle()
- set {_nmsscoreboardteam} to new ScoreboardTeam({_nmsscoreboard}, random 16 char string from `a-zA-Z0-9`)
- {_nmsscoreboardteam}.setCollisionRule(EnumTeamPush.NEVER!)
- set {_teampacket1} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, 0)
- set {_teampacket2} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, Arrays.asList({_uuid1}, {_uuid2}), 3)
- set {_teampacket3} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, Arrays.asList({_uuid1}, {_uuid2}), 4)
- set {_teampacket4} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, 1)
- loop {_viewers::*}:
- send loop-value packet {_packet1}
- send loop-value packet {_packet2}
- send loop-value packet {_packet3}
- loop-value.getHandle().playerConnection!.sendPacket({_teampacket1})
- loop-value.getHandle().playerConnection!.sendPacket({_teampacket2})
- wait "%{_delay}% tick" parsed as timespan
- set {_packet4} to new play_server_entity_destroy packet
- set int array pnum 0 of {_packet4} to {_id1} and {_id2}
- loop {_viewers::*}:
- send loop-value packet {_packet4}
- loop-value.getHandle().playerConnection!.sendPacket({_teampacket3})
- loop-value.getHandle().playerConnection!.sendPacket({_teampacket4})
- function createGuardianBeamEntityToEntity(ent1: entity, ent2: entity, viewers: players, delay: integer, startloctype: integer):
- {_startloctype} is between 0 and 2
- if {_startloctype} is 0:
- set {_loc} to location of head of {_ent1}
- else if {_startloctype} is 1:
- set {_loc} to location {_ent1}.getHeight()/2 meter above location of {_ent1}
- else if {_startloctype} is 2:
- set {_loc} to location of {_ent1}
- set {_id} to random integer between 1 and 2147483647
- set {_uuid} to new uuid
- set {_packet1} to new play_server_spawn_entity_living packet
- set int pnum 0 of {_packet1} to {_id}
- set int pnum 1 of {_packet1} to 68
- set "UUID" pinfo 0 of {_packet1} to {_uuid}
- set double pnum 0 of {_packet1} to x-coordinate of {_loc}
- set double pnum 1 of {_packet1} to y-coordinate of {_loc}
- set double pnum 2 of {_packet1} to z-coordinate of {_loc}
- set byte pnum 0 of {_packet1} to floor((vector yaw of vector from {_loc} to {_ent2})*256/360)
- set byte pnum 1 of {_packet1} to floor((vector pitch of vector from {_loc} to {_ent2})*256/360)
- set byte pnum 2 of {_packet1} to floor((vector yaw of vector from {_loc} to {_ent2})*256/360)
- set {_json1::0} to Byte.valueOf("32")
- set {_json1::12} to false
- set {_json1::13} to Integer.valueOf("%id of {_ent2}%")
- set "DataWatcher" pjson 0 of {_packet1} to json from listvar {_json1::*}
- set {_nmsscoreboard} to Bukkit.getScoreboardManager().getNewScoreboard().getHandle()
- set {_nmsscoreboardteam} to new ScoreboardTeam({_nmsscoreboard}, random 16 char string from `a-zA-Z0-9`)
- {_nmsscoreboardteam}.setCollisionRule(EnumTeamPush.NEVER!)
- set {_teampacket1} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, 0)
- set {_teampacket2} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, Arrays.asList({_uuid}), 3)
- set {_teampacket3} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, Arrays.asList({_uuid}), 4)
- set {_teampacket4} to new PacketPlayOutScoreboardTeam({_nmsscoreboardteam}, 1)
- loop {_viewers::*}:
- send loop-value packet {_packet1}
- loop-value.getHandle().playerConnection!.sendPacket({_teampacket1})
- loop-value.getHandle().playerConnection!.sendPacket({_teampacket2})
- loop {_delay} times:
- if {_startloctype} is 0:
- set {_loc} to location of head of {_ent1}
- else if {_startloctype} is 1:
- set {_loc} to location {_ent1}.getHeight()/2 meter above location of {_ent1}
- else if {_startloctype} is 2:
- set {_loc} to location of {_ent1}
- set {_packet2} to new play_server_entity_teleport packet
- set int pnum 0 of {_packet2} to {_id}
- set double pnum 0 of {_packet2} to x-coordinate of {_loc}
- set double pnum 1 of {_packet2} to y-coordinate of {_loc}
- set double pnum 2 of {_packet2} to z-coordinate of {_loc}
- loop {_viewers::*}:
- send loop-value-2 packet {_packet2}
- if {_ent1} is dead:
- stop loop
- if {_ent2} is dead:
- stop loop
- wait 1 tick
- set {_packet4} to new play_server_entity_destroy packet
- set int array pnum 0 of {_packet4} to {_id}
- loop {_viewers::*}:
- send loop-value packet {_packet4}
- loop-value.getHandle().playerConnection!.sendPacket({_teampacket3})
- loop-value.getHandle().playerConnection!.sendPacket({_teampacket4})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement