Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- variables:
- {infectchance} = 10
- command /infectchance [<text>]:
- permission: zombie.admin
- permission message: &cYou do not have permission to use this command.
- trigger:
- set {_chance} to arg parsed as number
- if {_chance} is not set:
- send "&c使用法: /infectchance <数値>"
- else:
- set {infectchance} to {_chance} > 100 ? 100 : {_chance}
- function sendZombiePacket(p1: player, p2: player):
- {_p1} is not {_p2}
- set {_packet::1} to new play_server_spawn_entity_living packet
- set int pnum 0 of {_packet::1} to id of {_p2}
- set int pnum 1 of {_packet::1} to 54
- set double pnum 0 of {_packet::1} to x-coordinate of {_p2}
- set double pnum 1 of {_packet::1} to y-coordinate of {_p2}
- set double pnum 2 of {_packet::1} to z-coordinate of {_p2}
- set byte pnum 0 of {_packet::1} to floor(yaw of {_p2}*256/360)
- set byte pnum 1 of {_packet::1} to floor(pitch of {_p2}*256/360)
- set byte pnum 2 of {_packet::1} to floor(yaw of {_p2}*256/360)
- set int pnum 2 of {_packet::1} to x of velocity of {_p2}*8000
- set int pnum 3 of {_packet::1} to y of velocity of {_p2}*8000
- set int pnum 4 of {_packet::1} to z of velocity of {_p2}*8000
- set {_json::2} to "&2&l%{_p2}%"
- set {_json::3} to true
- set "DataWatcher" pjson 0 of {_packet::1} to json from listvar {_json::*}
- set {_packet::2} to new play_server_entity_equipment packet
- set int pnum 0 of {_packet::2} to id of {_p2}
- set "ItemSlots" penum 0 of {_packet::2} to "MAINHAND"
- if tool of {_p2} is set:
- set {_mainhand} to tool of {_p2}
- set "ItemModifier" pinfo 0 of {_packet::2} to {_mainhand}
- set {_packet::3} to new play_server_entity_equipment packet
- set int pnum 0 of {_packet::3} to id of {_p2}
- set "ItemSlots" penum 0 of {_packet::3} to "OFFHAND"
- if offhand tool of {_p2} is set:
- set {_offhand} to offhand tool of {_p2}
- set "ItemModifier" pinfo 0 of {_packet::2} to {_offhand}
- set {_packet::4} to new play_server_entity_equipment packet
- set int pnum 0 of {_packet::4} to id of {_p2}
- set "ItemSlots" penum 0 of {_packet::4} to "FEET"
- if boots of {_p2} is set:
- set {_feet} to boots of {_p2}
- set "ItemModifier" pinfo 0 of {_packet::4} to {_feet}
- set {_packet::5} to new play_server_entity_equipment packet
- set int pnum 0 of {_packet::5} to id of {_p2}
- set "ItemSlots" penum 0 of {_packet::5} to "LEGS"
- if leggings of {_p2} is set:
- set {_legs} to leggings of {_p2}
- set "ItemModifier" pinfo 0 of {_packet::5} to {_legs}
- set {_packet::6} to new play_server_entity_equipment packet
- set int pnum 0 of {_packet::6} to id of {_p2}
- set "ItemSlots" penum 0 of {_packet::6} to "CHEST"
- if chestplate of {_p2} is set:
- set {_chest} to chestplate of {_p2}
- set "ItemModifier" pinfo 0 of {_packet::6} to {_chest}
- set {_packet::7} to new play_server_entity_equipment packet
- set int pnum 0 of {_packet::7} to id of {_p2}
- set "ItemSlots" penum 0 of {_packet::7} to "HEAD"
- if helmet of {_p2} is set:
- set {_head} to helmet of {_p2}
- set "ItemModifier" pinfo 0 of {_packet::7} to {_head}
- loop 7 times:
- send {_p1} packet {_packet::%loop-number%}
- on packet event play_server_entity_equipment:
- player's world pentity 0 of event-packet is a player
- "ItemSlots" penum 0 of event-packet is "MAINHAND" or "OFFHAND"
- if "ItemSlots" penum 0 of event-packet is "MAINHAND":
- "ItemModifier" pinfo 0 of event-packet is not tool of player's world pentity 0 of event-packet
- set {_item} to tool of player's world pentity 0 of event-packet
- else if "ItemSlots" penum 0 of event-packet is "OFFHAND":
- "ItemModifier" pinfo 0 of event-packet is not offhand tool of player's world pentity 0 of event-packet
- set {_item} to offhand tool of player's world pentity 0 of event-packet
- {_item} is set
- set "ItemModifier" pinfo 0 of event-packet to {_item}
- on death of player:
- victim has scoreboard tag "zombie"
- remove "zombie" from scoreboard tags of victim
- reset victim's displayed skin
- on damage of player:
- victim do not have scoreboard tag "zombie"
- tag "Health" of nbt of victim <= final damage
- check [attacker is a zombie] or check [check [attacker is a player] and check [attacker has scoreboard tag "zombie"]]
- chance of {infectchance}%
- cancel event
- remove all potion effects from victim
- heal victim
- set food of victim to 10
- add "zombie" to scoreboard tags of victim
- broadcast "&2&l%victim%&aはゾンビになってしまった!"
- set victim's displayed skin to skin with value "eyJ0aW1lc3RhbXAiOjE1NDQ0NTk4Mzc4MjMsInByb2ZpbGVJZCI6IjQzYTgzNzNkNjQyOTQ1MTBhOWFhYjMwZjViM2NlYmIzIiwicHJvZmlsZU5hbWUiOiJTa3VsbENsaWVudFNraW42Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDY3NTUzYjMxOGJhMmVlMmI2MjZlOWI5ZGVkM2UxNWExZDBkOGQ5ZjM3MGZmMDNjOThiMzIzZTc4NTczYjlhIn19fQ==" signature "yUVWH96rIrYzOO4fCeB30pPSsdyaMJHwP0jKPfd+cfp5Bk5uOd5g547ISckhU0bZMWAkKqEeXUY3R1hsW3GJl+OKdTQwkKVhSdWf6AEV0LaTPav8TCd5jF2JVWDlGeXgHTp+TdBZPJIdWT1uuLuY42YdTfMGsywFE0rGljRo97hpMvBhgRcakw6d4friHUfzJy9shVeXW4gF8xZg79DP+WZ32F/IrsgoRU5O2nxM9ZgmjyaLTyO9WKQoMEpcLJl8vAet2NjJ1YH6klOxnqZpjYPebQuyfFb/ZfTfJv+AevccDCqr1T7OEM2u3MTwttcov5KbnhawrHZnVIBio2sTQGFUmzcsmIJht04YWGkQlrvSzQ4+6/Qyzixl4PE3pfbwg3truuJgItstLLbnNKFqa3H/RQam18vKdM8u7lqOomP4fWP4VEhBcIElnfwohy0PRJ+KOA5586WupKD3bxiAViUN4ywj212gyG6ie8KDDfrtC+e3VOWi/Vja+bJEmy2oHUndesySAZhNNMhrRIOYAARrhpcR0Cl8TmTVCYC4ooaKTdowi8cELLBxCnCJElozKUv2jhoWrpL4ZCSAepz85NdiQk2NjSNqgUOKzxf/pLD4iPs9R0+bVipyN8eGTpSzDdAQ4xO8n2nPQbcqfzqlIfY5hPF0S0+gApK68VXBGkA="
- play sound "entity.zombie.infect" to all players at attacker with volume 1 pitch 1
- loop all entities:
- if loop-entity is a player:
- sendZombiePacket(loop-entity, victim)
- else:
- target of loop-entity is victim
- delete target of loop-entity
- on packet event play_server_named_entity_spawn:
- player's world pentity 0 of event-packet is a player
- player's world pentity 0 of event-packet has scoreboard tag "zombie"
- wait 1 tick
- sendZombiePacket(player, player's world pentity 0 of event-packet)
- on join:
- player has scoreboard tag "zombie"
- set player's displayed skin to skin with value "eyJ0aW1lc3RhbXAiOjE1NDQ0NTk4Mzc4MjMsInByb2ZpbGVJZCI6IjQzYTgzNzNkNjQyOTQ1MTBhOWFhYjMwZjViM2NlYmIzIiwicHJvZmlsZU5hbWUiOiJTa3VsbENsaWVudFNraW42Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDY3NTUzYjMxOGJhMmVlMmI2MjZlOWI5ZGVkM2UxNWExZDBkOGQ5ZjM3MGZmMDNjOThiMzIzZTc4NTczYjlhIn19fQ==" signature "yUVWH96rIrYzOO4fCeB30pPSsdyaMJHwP0jKPfd+cfp5Bk5uOd5g547ISckhU0bZMWAkKqEeXUY3R1hsW3GJl+OKdTQwkKVhSdWf6AEV0LaTPav8TCd5jF2JVWDlGeXgHTp+TdBZPJIdWT1uuLuY42YdTfMGsywFE0rGljRo97hpMvBhgRcakw6d4friHUfzJy9shVeXW4gF8xZg79DP+WZ32F/IrsgoRU5O2nxM9ZgmjyaLTyO9WKQoMEpcLJl8vAet2NjJ1YH6klOxnqZpjYPebQuyfFb/ZfTfJv+AevccDCqr1T7OEM2u3MTwttcov5KbnhawrHZnVIBio2sTQGFUmzcsmIJht04YWGkQlrvSzQ4+6/Qyzixl4PE3pfbwg3truuJgItstLLbnNKFqa3H/RQam18vKdM8u7lqOomP4fWP4VEhBcIElnfwohy0PRJ+KOA5586WupKD3bxiAViUN4ywj212gyG6ie8KDDfrtC+e3VOWi/Vja+bJEmy2oHUndesySAZhNNMhrRIOYAARrhpcR0Cl8TmTVCYC4ooaKTdowi8cELLBxCnCJElozKUv2jhoWrpL4ZCSAepz85NdiQk2NjSNqgUOKzxf/pLD4iPs9R0+bVipyN8eGTpSzDdAQ4xO8n2nPQbcqfzqlIfY5hPF0S0+gApK68VXBGkA="
- every second:
- loop all entities:
- type of loop-entity is snow golem or iron golem
- target of loop-entity is not set
- set {_short} to 31
- loop players in radius 30 around loop-entity:
- loop-player-1 has scoreboard tag "zombie"
- {_short} > distance between loop-entity-1 and loop-player-1
- set {_short} to distance between loop-entity-1 and loop-player-1
- set {_target} to loop-player-1
- delete {_short}
- set target of loop-entity to {_target}
- delete {_target}
- on target:
- target of event-entity has scoreboard tag "zombie"
- cancel event
- on damage:
- attacker is a player
- attacker's gamemode is survival or adventure
- if attacker has scoreboard tag "zombie":
- check [victim is a zombie] or check [check [victim is a player] and check [victim has scoreboard tag "zombie"]]
- cancel event
- else:
- check [victim is a player] and check [victim do not have scoreboard tag "zombie"]
- cancel event
Advertisement
Add Comment
Please, Sign In to add comment