This commit is contained in:
2026-09-24 18:34:16 -03:00
parent a758037f20
commit a37ffd9127
20 changed files with 799 additions and 20 deletions
+10 -1
View File
@@ -1,6 +1,7 @@
import { AssetManager } from "./assets.ts";
import { ClientWorld } from "./client_world.ts";
import { InputManager } from "./input_manager.ts";
import { Connection, get_player_name, get_server_url } from "./network.ts";
import { begin_drawing, clear_background, end_drawing, init_font, init_window } from "./renderer/mod.ts";
await import("./blocks/mod.ts");
@@ -90,7 +91,15 @@ await AssetManager.instance.load_all();
init_font();
const client_world = new ClientWorld();
const connection = await Connection.open(get_server_url(), get_player_name());
if (connection) {
console.log(`Connected to ${get_server_url()}`);
} else {
console.log("Couldn't reach a server, playing single player");
}
const client_world = new ClientWorld(connection);
client_world.add_chat(connection ? "Connected to the server" : "Playing single player");
const loop = new ClientLoop(client_world);
loop.start();