feat: add event listeners
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
local center = { x = 0, z = 0 }
|
||||
local radius = 100
|
||||
|
||||
function on_tick()
|
||||
function log_player_positions()
|
||||
local entities = client:find_entities(function(e)
|
||||
return e.kind == "minecraft:player"
|
||||
and e.position.x > center.x - radius + 1
|
||||
@@ -17,8 +17,14 @@ end
|
||||
function on_init()
|
||||
info("client initialized, setting information...")
|
||||
client:set_client_information({ view_distance = 16 })
|
||||
end
|
||||
|
||||
function on_login()
|
||||
info("player successfully logged in!")
|
||||
add_listener("login", function()
|
||||
info("player successfully logged in!")
|
||||
end)
|
||||
|
||||
add_listener("death", function()
|
||||
warn("player died!")
|
||||
end, "warn_player_died")
|
||||
|
||||
add_listener("tick", log_player_positions)
|
||||
end
|
||||
|
Reference in New Issue
Block a user