summaryrefslogtreecommitdiffstats
path: root/cwd
diff options
context:
space:
mode:
Diffstat (limited to '')
-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