summaryrefslogtreecommitdiffstats
path: root/cwd
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2019-05-19 20:03:48 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2019-05-19 20:03:48 +0200
commit646f77ec6bc27af231b6ff8974e631b86188beb6 (patch)
treeea48447a4bdc947e67bbd900fd5716d48755619c /cwd
parentImplemented lua's "require" for AM (diff)
downloadAltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.gz
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.bz2
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.lz
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.xz
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.tar.zst
AltCraft-646f77ec6bc27af231b6ff8974e631b86188beb6.zip
Diffstat (limited to 'cwd')
-rw-r--r--cwd/assets/altcraft/scripts/blocks.lua22
-rw-r--r--cwd/assets/altcraft/scripts/init.lua9
2 files changed, 27 insertions, 4 deletions
diff --git a/cwd/assets/altcraft/scripts/blocks.lua b/cwd/assets/altcraft/scripts/blocks.lua
index ad00742..07a1f77 100644
--- a/cwd/assets/altcraft/scripts/blocks.lua
+++ b/cwd/assets/altcraft/scripts/blocks.lua
@@ -1,2 +1,20 @@
-print("Hello from altcraft/blocks!")
-return "CONTENT OF ac/blocks" \ No newline at end of file
+local function GetBlockInfo(blockPos)
+ print("Request data for "..blockPos)
+ local bi = BlockInfo.new()
+ bi.collides = true
+ bi.blockstate = ""
+ bi.variant = ""
+ return bi
+end
+
+local function RegisterBlocks()
+ AC.RegisterBlock(BlockId.new(1,0), true, "stone", "normal")
+ AC.RegisterBlock(BlockId.new(2,0), true, "grass", "snowy=false")
+ AC.RegisterBlock(BlockId.new(3,0), true, "dirt", "normal")
+ AC.RegisterBlock(BlockId.new(31,1), false, "tall_grass", "normal")
+end
+
+return {
+ GetBlockInfo = GetBlockInfo,
+ RegisterBlocks = RegisterBlocks,
+} \ No newline at end of file
diff --git a/cwd/assets/altcraft/scripts/init.lua b/cwd/assets/altcraft/scripts/init.lua
index f001017..5021a00 100644
--- a/cwd/assets/altcraft/scripts/init.lua
+++ b/cwd/assets/altcraft/scripts/init.lua
@@ -5,6 +5,7 @@ local plugin = {
onUnload = nil,
onChangeState = nil,
onTick = nil,
+ onRequestBlockInfo = nil,
}
function plugin.onLoad ()
@@ -32,8 +33,12 @@ function plugin.onTick (deltaTime)
end
end
-blocks = require("altcraft/blocks")
-print("From init: "..blocks)
+local blocks = require("altcraft/blocks")
+blocks.RegisterBlocks()
+
+function plugin.onRequestBlockInfo(blockPos)
+ return blocks.GetBlockInfo(blockPos)
+end
AC.RegisterPlugin(plugin)
plugin = nil \ No newline at end of file