Skip to content

Commit

Permalink
ÃÃInitial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarneim committed Oct 5, 2018
0 parents commit 602b75c
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
27 changes: 27 additions & 0 deletions feather.lua
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
21 changes: 21 additions & 0 deletions give-feather.lua
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
49 changes: 49 additions & 0 deletions particle-trail.lua
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
6 changes: 6 additions & 0 deletions startup.lua
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()

0 comments on commit 602b75c

Please sign in to comment.