#-###############################-# # # # Jetpack # # # #-###############################-# options: fuel-ticks-per-coal: 50 jetpack-speed: 0.2 jetpack-item: unbreakable chain chestplate jetpack-name: "&7Jetpack" recipe-enabled: true jetpack-recipe: diamond block, elytra, diamond block, feather, diamond chestplate, feather, diamond block, diamond block, diamond block action-bar-enabled: true action-bar: "&7Węgiel: &8%{_coal-amount}% &9| &7Paliwo: &8%{_fuel-amount}%" on jump: if tag "itemType" of nbt compound of player's chestplate is not "jetpack": stop if {jetpack::fuel::%player%} is not set: if player doesn't have coal: stop convertCoalToFuel(player) wait 1 tick set player's flying speed to {@jetpack-speed} jetpackEnablePlayer(player) while {jetpack::active::%player%} is set: jetpackFunction(player) wait 1 tick on load: if {@recipe-enabled} is true: set {_item} to {@jetpack-item} named {@jetpack-name} set tag "itemType" of nbt compound of {_item} to "jetpack" register new shaped recipe for {_item} using {@jetpack-recipe} with id "skript_jetpack" on inventory click: if tag "itemType" of nbt compound of event-item is not "jetpack": stop if {jetpack::active::%player%} is set: jetpackDisablePlayer(player) function jetpackFunction(p: player): if {_p} is not flying: jetpackDisablePlayer({_p}) stop if {jetpack::fuel::%{_p}%} > 0: push {_p} downwards with speed 0.05 remove 1 from {jetpack::fuel::%{_p}%} show smoke at {_p}'s location if {@action-bar-enabled} is true: set {_coal-amount} to amount of coal in {_p}'s inventory set {_fuel-amount} to {jetpack::fuel::%{_p}%} send action bar {@action-bar} to {_p} if block 0.1 under {_p} is not solid: stop jetpackDisablePlayer({_p}) stop clear {jetpack::fuel::%{_p}%} if {_p} has coal: convertCoalToFuel({_p}) stop jetpackDisablePlayer({_p}) function jetpackEnablePlayer(p: player): set {jetpack::active::%{_p}%} to true force {_p} to fly function jetpackDisablePlayer(p: player): clear {jetpack::active::%{_p}%} force {_p} to stop flying function convertCoalToFuel(p: player): remove 1 of coal from {_p}'s inventory set {jetpack::fuel::%{_p}%} to {@fuel-ticks-per-coal}