Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.
on damage of player:
damage cause was fall
{fall::%victim%} is set
cancel event
delete {fall::%victim%}
function grapple(player: player, fishinghook: entity):
set {_pushing} to 2
push {_player} upwards at speed 0.3
wait a tick
push {_player} direction from {_player} to {_fishinghook} at speed {_pushing} + ((distance between {_player} and {_fishinghook}) * 0.01)
set {fall::%{_player}%} to true
on fishing:
name of player's tool is "grappling hook"
if fishing state is in ground:
grapple(player, fishing hook)
else if fishing state is reel in:
loop all armor stands in radius 2 around fishing hook:
metadata "grappling" of loop-entity is set
clear loop-entity
grapple(player, fishing hook)
stop
else if fishing state is fishing:
add velocity of fishing hook to velocity of fishing hook
on player tool change:
wait a tick
player's tool is not a fishing rod
loop all armor stands:
metadata "grappling" of loop-entity is player
clear loop-entity
command /clearstands:
trigger:
loop all armor stands:
if metadata "grappling" of loop-entity is set:
clear loop-entity
add 1 to {_cleared}
message "%{_cleared}%"
on disconnect:
loop all armor stands:
metadata "grappling" of loop-entity is player
clear loop-entity
on script unload:
delete {fall::*}
loop all armor stands:
metadata "grappling" of loop-entity is set
clear loop-entity
on projectile hit:
projectile is a fish hook
set {_hook} to projectile
set {_shooter} to shooter
name of {_shooter}'s tool is "grappling hook"
set {_location} to event-location
# The collision was off by a block.
# This is for cosmetic looks. Rather than having the hook floating in mid air;
# It'll be right on the side of the block, to simulate being hooked to the block.
if distance between event-location and event-block is greater than 1.10:
# Move the collision location closer to the actual block.
set {_vector} to vector between event-location and event-block
# Premade values that I think make the hook look like it's on the block.
set {_div} to vector x of {_vector} / 2.5, y of {_vector} / 2.5, z of {_vector} / 2.5
set {_vector} to {_vector} ** {_div}
set {_location} to location {_vector}
spawn an armor stand at {_location}:
set passenger of event-entity to {_hook}
set gravity of event-entity to false
set armour stand visible of event-entity to false
set small of event-entity to true
set arms of event-entity to false
set marker of event-entity to true
set base plate of event-entity to false
set metadata "grappling" of event-entity to {_shooter}
play sound "BLOCK_NOTE_BLOCK_DIDGERIDOO" at volume 0.5 and pitch 2 for {_shooter}
{_shooter} is not on the ground
# Ensure they're not currently ground jumping
block below below {_shooter} is air
# While the hook exists.
while {_hook} is valid:
wait a tick
if {_shooter} is not on the ground:
y-coordinate of {_shooter} is less than y-coordinate of {_hook}
# Gravity realism
distance between {_shooter} and {_hook} is greater than 6
set {_distance} to distance between {_shooter} and {_hook} / 1.4
set {_velocity} to {_distance} * 0.01
push {_shooter} upwards at speed {_velocity}
else:
stop
clear event-entity