Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on rightclick with iron sword:
- {timers.%player%::throwingknife} is not set
- play sound "entity.arrow.shoot" to all players at player with volume 1 pitch 1.2
- set {_loc} to location 1.5 meter above location of player
- 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
- 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
- wait 1 tick
- add "{ArmorItems:[{},{},{},{id:""minecraft:iron_sword"",Count:1b,Damage:0s}]}" to nbt of last spawned armor stand
- set {knife::%UUID of last spawned armor stand%} to {_loc}
- set {knifeage.%UUID of last spawned armor stand%} to 200
- set {knifeshooter.%UUID of last spawned armor stand%} to player
- set {timers.%player%::throwingknife} to 200
- function getEntityFromUUID(uuid: text) :: entity:
- loop all entities:
- if UUID of loop-entity is "%{_uuid}%":
- return loop-entity
- stop loop
- every tick:
- loop {knife::*}:
- {knifeage.%loop-index%} >= 1
- set {_knife} to getEntityFromUUID(loop-index)
- 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
- loop 12 times:
- set {knife::%loop-index%} to location 0.25 meter forwards {knife::%loop-index%}
- 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%}
- loop entities in radius 0.5 around {knife::%loop-index%}:
- loop-entity is a living entity
- loop-entity is not armor stand
- loop-entity is not {knifeshooter.%loop-index%}
- if loop-entity is a player:
- loop-entity's gamemode is survival or adventure
- make {knifeshooter.%loop-index%} damage loop-entity by 6
- delete {knife::%loop-index%}
- delete {knifeage.%loop-index%}
- delete {knifeshooter.%loop-index%}
- kill {_knife}
- else if loop-entity is not a player:
- make {knifeshooter.%loop-index%} damage loop-entity by 6
- delete {knife::%loop-index%}
- delete {knifeage.%loop-index%}
- delete {knifeshooter.%loop-index%}
- kill {_knife}
- if {_nohitblocks::*} do not contain id of block at location 0.3 meter forwards {knife::%loop-index%}:
- play sound "entity.zombie.attack_iron_door" to all players at {knife::%loop-index%} with volume 1 pitch 2
- play sound "entity.item.break" to all players at {knife::%loop-index%} with volume 1 pitch 2
- delete {knife::%loop-index%}
- delete {knifeage.%loop-index%}
- delete {knifeshooter.%loop-index%}
- delayKill({_knife}, 60)
- remove 1 from {knifeage.%loop-index%}
- {knifeage.%loop-index%} is 0
- delete {knife::%loop-index%}
- delete {knifeage.%loop-index%}
- delete {knifeshooter.%loop-index%}
- kill {_knife}
- loop all players:
- {timers.%loop-player%::throwingknife} >= 1
- remove 1 from {timers.%loop-player%::throwingknife}
- if loop-player's tool is iron sword:
- send action bar from "&e投げナイフが使用可能になるまであと%ceil({timers.%loop-player%::throwingknife}/20)%秒" to loop-player
- {timers.%loop-player%::throwingknife} is 0
- delete {timers.%loop-player%::throwingknife}
- send action bar from "&e投げナイフが使用可能になりました" to loop-player
- function delayKill(e: entity, delay: number):
- if {_delay} is 0:
- kill {_e}
- else:
- loop {_delay} times:
- wait 1 tick
- kill {_e}
Advertisement
Add Comment
Please, Sign In to add comment