-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 602b75c
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- featherlight/feather.lua | ||
-- /lua require('featherlight.feather').start() | ||
|
||
local pkg = {} | ||
local module = ... | ||
|
||
function pkg.start() | ||
singleton() | ||
Events.on("SwingArmEvent"):call(function(event) | ||
local item = event.item | ||
if item and item.nbt and item.nbt.tag and item.nbt.tag.Wand == "featherlight-flight" then | ||
local p = event.player | ||
if p.motion:sqrMagnitude() < 0.1 then | ||
p.motion = p.lookVec * 1.3 | ||
else | ||
p.motion = p.motion + p.lookVec * 0.5 | ||
end | ||
end | ||
end) | ||
end | ||
|
||
function singleton() | ||
spell:execute([[/wol spell break byName "%s"]],module) | ||
spell.name = module | ||
end | ||
|
||
return pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- featherlight/give-feather.lua | ||
-- /lua require('featherlight.give-feather').register() | ||
-- /lua require('featherlight.give-feather').giveFeather() | ||
|
||
local pkg = {} | ||
local module = ... | ||
|
||
function pkg.register() | ||
Commands.register("give-feather",string.format([[ | ||
require('%s').giveFeather(...) | ||
]],module), "/give-feather [<player>]", 1) | ||
end | ||
|
||
function pkg.giveFeather(player) | ||
player = player or spell.owner.name | ||
spell:execute([[/give %s minecraft:feather 1 0 | ||
{Wand:"featherlight-flight",display:{Name:"Wand of Featherlight Flight",Lore:["Look into the sky and swing this wand"]},ench:[{id:99,lvl:1}]} | ||
]], player) | ||
end | ||
|
||
return pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
-- featherlight/particle-trail.lua | ||
-- /lua require('featherlight.particle-trail').start() | ||
|
||
local pkg = {} | ||
local module = ... | ||
|
||
function pkg.start() | ||
singleton() | ||
local players = Entities.find("@a") | ||
Events.on("PlayerLoggedInEvent"):call(function(event) | ||
table.insert(players,event.player) | ||
end) | ||
Events.on("PlayerLoggedOutEvent"):call(function(event) | ||
for i,p in pairs(players) do | ||
if players[i] == p then | ||
table.remove(players,i) | ||
break | ||
end | ||
end | ||
end) | ||
while true do | ||
for _,p in pairs(players) do | ||
local item = p.mainhand | ||
if item and item.nbt and item.nbt.tag and item.nbt.tag.Wand == "featherlight-flight" then | ||
if p.motion:sqrMagnitude() > 0.1 then | ||
spell.rotationYaw = p.rotationYaw | ||
spell.pos = p.pos - 0.2 * spell.lookVec | ||
spell:move("up",0.2) | ||
pkg.particle() | ||
end | ||
end | ||
end | ||
sleep(1) | ||
if Time.gametime % (20*10) == 0 then | ||
players = Entities.find("@a") | ||
end | ||
end | ||
end | ||
|
||
function pkg.particle() | ||
spell:execute("/particle flame ~ ~0.2 ~ 0 0 0 0.01 100 force @a") | ||
end | ||
|
||
function singleton() | ||
spell:execute([[/wol spell break byName "%s"]],module) | ||
spell.name = module | ||
end | ||
|
||
return pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- featherlight/startup.lua | ||
|
||
spell:execute([[/lua require('featherlight.feather').start()]]) | ||
spell:execute([[/lua require('featherlight.particle-trail').start()]]) | ||
|
||
require('featherlight.give-feather').register() |