Skip to content

Instantly share code, notes, and snippets.

View mkarneim's full-sized avatar

Michael Karneim mkarneim

  • Munich, Germany
View GitHub Profile
@mkarneim
mkarneim / sample.lua
Last active February 12, 2017 09:18
Sample Prog
require "gist.4d55b3573209200edcf73e1dbbd442ce.sample-lib"
BLOCK = {
hasName = function(exp)
return function(act)
return act.name == exp
end
end,
is = function(exp)
return function(act)
@mkarneim
mkarneim / sample-lib.lua
Last active January 22, 2017 07:34
Sample Library
OPPOSITE = {NORTH=SOUTH,EAST=WEST,SOUTH=NORTH,WEST=EAST,UP=DOWN,DOWN=UP,LEFT=RIGHT,RIGHT=LEFT,FORWARD=BACK,BACK=FORWARD}
ROTATE90CW = {NORTH=EAST,EAST=SOUTH,SOUTH=WEST,WEST=NORTH}
ROTATE90CCW = {NORTH=WEST,WEST=SOUTH,SOUTH=EAST,EAST=NORTH}
particleOn=0
function vec3(x,y,z)
return {x=x,y=y,z=z}
end
require "gist.8deed890e0d92ef19506e889819b2e97.sample"
-- Wand of equal Trade
function woet()
print("Starting Wand of equal Trade 1")
click = events.register("RIGHT_CLICK", "LEFT_CLICK")
for event in click.next do
print("event",event.type,event.id)
if event.item ~= nil
@mkarneim
mkarneim / startup.lua
Last active January 8, 2017 14:40
Startup Script
require "gist.8deed890e0d92ef19506e889819b2e97.sample"
function startup()
cmd("gamerule sendCommandFeedback false")
cmd("gamerule commandBlockOutput false")
--cmd('lua aura("@e[type=Player]")')
end
@mkarneim
mkarneim / loocraft.lua
Last active January 8, 2017 14:40
loocraft specific scripts
require "gist.8deed890e0d92ef19506e889819b2e97.sample"
require "gist.835077aed5123947fe006e6d5ed5582b.books"
function spawnpoint(pos)
if pos == nil then
move(UP)
pos = vec3(getWorldPos())
end
local eventqueue = events.register(PLAYER_JOINED)
for event in eventqueue.next do
@mkarneim
mkarneim / wizards-of-lua.lua
Last active April 27, 2017 17:45
main script of the wizards of lua server
require "gist.8deed890e0d92ef19506e889819b2e97.sample"
require "gist.835077aed5123947fe006e6d5ed5582b.books"
function startup()
cmd("gamerule sendCommandFeedback false")
cmd("gamerule commandBlockOutput false")
cmd("lua createBook1ForPlayer()")
end
function createBook1ForPlayer()
@mkarneim
mkarneim / magical-city.lua
Last active August 21, 2017 18:50
Magical City Spells
-- Magical City Spells
-- ( https://gist.github.com/mkarneim/937afb517191e446008fb80a0abfbe14 )
require "gist.835077aed5123947fe006e6d5ed5582b.books"
-- https://gist.github.com/mkarneim/6cd6d5801b462fc85e63cd6c308b7f9f
require "gist.6cd6d5801b462fc85e63cd6c308b7f9f.selection"
-- https://gist.github.com/mkarneim/cfd15dc4a8a6d4c5bd471b62a36a126d
require "gist.cfd15dc4a8a6d4c5bd471b62a36a126d.architect"
@mkarneim
mkarneim / books.lua
Last active April 21, 2017 13:38
Functions for creating books in MC
-- Books
function page(content)
return [["{\"text\":\"]]..content..[[\",\"italic\":true}"]]
end
-- deprecated
function writeBook(dataTag,n)
giveBook(dataTag,n)
end
@mkarneim
mkarneim / md5.lua
Created January 22, 2017 22:07
MD5 sum in pure Lua
local md5 = {
_VERSION = "md5.lua 1.1.0",
_DESCRIPTION = "MD5 computation in Lua (5.1-3, LuaJIT)",
_URL = "https://github.com/kikito/md5.lua",
_LICENSE = [[
MIT LICENSE
Copyright (c) 2013 Enrique García Cota + Adam Baldwin + hanzao + Equi 4 Software
Permission is hereby granted, free of charge, to any person obtaining a
@mkarneim
mkarneim / sha1.lua
Created January 22, 2017 22:31
sha pure lua
local sha1 = {
_VERSION = "sha.lua 0.5.0",
_URL = "https://github.com/kikito/sha.lua",
_DESCRIPTION = [[
SHA-1 secure hash computation, and HMAC-SHA1 signature computation in Lua (5.1)
Based on code originally by Jeffrey Friedl (http://regex.info/blog/lua/sha1)
And modified by Eike Decker - (http://cube3d.de/uploads/Main/sha1.txt)
]],
_LICENSE = [[
MIT LICENSE