Commit Graph

90 Commits

Author SHA1 Message Date
lukas0008
8bb00e26be Make ChunkData use Vector2 instead of ChunkCoordinates 2024-08-30 17:40:55 +02:00
Snowiiii
c36b6d3464 Less unwraps 2024-08-28 18:52:30 +02:00
DaniD3v
112a899559 Added logic to generate chunks if they can't be read from the world file.
Moved warning about ./world folder to only appear when necessary +
Updated warning contents to reflect changes

Made the save_file in the `Level` struct optional
in case someone wants an entirely generated World.

Removed now redundant asserts.
2024-08-28 17:34:47 +02:00
DaniD3v
17b285081a Refractored read_chunk
Added new error types to indicate a chunk should be generated.
Renamed to `fetch_chunks` to indicate that it no longer just reads chunks (might write to the worldfile in the future)
Take a reference to a slice instead of an owned vector because the data is Copy anyways.

Remove the ChunkCoordinates that are sent over the mpsc Sender.
- The coordinates are stored in ChunkData anyways.
- If there is an Error the coordinates should not matter because the error can't be recovered from.

Moved the reading from file logic to `read_chunk`.
- So that we don't always have to repeat `channel.blocking_send(...); return;`
- To make it clearly distinct from the main program logic.

Replaced some verbose match statements with `Result.map_err()`.
2024-08-28 12:52:26 +02:00
DaniD3v
be98a730b0 Added abstraction for coordinates.
These ensure that there aren't any out of bound values
and make the code significantly more readable
2024-08-28 12:38:22 +02:00
Snowiiii
3b438872a8 Add pumpkin-plugin
mhh, Whats that?
2024-08-27 22:47:21 +02:00
Snowiiii
8cff0b4b76 Fix: clippy and fmt 2024-08-25 13:21:24 +02:00
Snowiiii
83aad86005 Made everything thread safe
- Also improved gamemode command
- We now can use Server in commands
2024-08-25 13:20:49 +02:00
Snowiiii
024789dfbb Fixed an upsi 2024-08-25 00:17:53 +02:00
Snowiiii
f40eb85c53 Don't clone PlayerConfig 2024-08-24 20:09:56 +02:00
Snowiiii
c7f15dee3d Refactor Client 2024-08-24 14:51:43 +02:00
lukas0008
e1a1a22047 Fix clippy warnings 2024-08-22 14:02:12 +02:00
Luk-ESC
afa68f381c fix typo in method name 2024-08-22 13:39:31 +02:00
Alexander Medvedev
b37039126a Make Icon Optional 2024-08-21 15:49:28 +01:00
Snowiiii
a6fbc3d13a Fix: Serverbound Chat Message 2024-08-20 13:19:50 +02:00
Alexander Medvedev
222b40c8bd Add World struct
We also check now if world exits
2024-08-19 21:14:48 +01:00
Snowiiii
40fe40355f Add BlockFace 2024-08-17 11:14:38 +02:00
ngspace
d913348ed4 Change fly speed to vanilla speed 2024-08-15 17:53:51 +03:00
Snowiiii
21983824a3 parse test chunk distance from config 2024-08-15 15:06:19 +02:00
Snowiiii
6459aef027 Add Basic Combat 2024-08-14 22:26:27 +02:00
Snowiiii
6485c99167 cargo fmt 2024-08-14 21:37:27 +02:00
lukas0008
2d3990bfa6 Fix rotation
- The rotation was previously not taking the modulus of the degree (which is incorrect).
- `head_yaw` is currently not used, since the server only receives the yaw and pitch packet, it can be assumed that head yaw can be identical to yaw.
2024-08-14 01:07:20 +02:00
lukas0008
03f9b377d5 Optimize chunk loading
- Chunk loading now is done in a more simple manner. Instead of splitting it into regions and having one file handle for all chunks in the same region, now all chunks make their own file handle for the region, the previous overhead was not worth it, since this seemed to increase performance.
- Speed up of ~15%
- Now the `.read_chunks` function does not return anything, instead it sends event to an mpsc channel.
- Dramatically decreased memory footprint.
2024-08-13 23:30:20 +02:00
lukas0008
5075c97faa Load the world radially 2024-08-13 14:59:52 +02:00
lukas0008
59749af69c Remove unnecessary logs and loading
- Load chunk (0,0) only in debug mode. This prevents crashes when the chunk for (0,0) does not exist, since this is only used for checking the size of the chunk packet.
- Remove log: `Getting chunks x, from region file y`
2024-08-13 14:14:19 +02:00
lukas0008
b68e9b809f Use rayon for processing chunks 2024-08-13 14:09:49 +02:00
Snowiiii
c5612f6ddb Handle older/newer Clients 2024-08-13 13:05:04 +02:00
Snowiiii
651089033d Chunks: remove some clone's 2024-08-13 10:53:24 +02:00
Snowiiii
9fc86e260b Add: Basic Combat 2024-08-13 09:16:00 +02:00
Snowiiii
c2bde2f73e Remove: Old chunk packet 2024-08-13 07:20:56 +02:00
Snowiiii
cfa20776f6 Add Clientbound Client Informations (Play) 2024-08-12 21:26:09 +02:00
lukas0008
435cd3b365 Remove development things 2024-08-12 20:43:15 +02:00
lukas0008
7a5984984f Merge fixes 2024-08-12 20:35:07 +02:00
lukas0008
5d6c38d1b2 Merge remote-tracking branch 'upstream/master' 2024-08-12 20:30:52 +02:00
lukas0008
eaf806a928 NOW IT FULLY WORKS 2024-08-12 20:23:15 +02:00
lukas0008
a991ce214b CHUNK LOADING KINDA WORKS 2024-08-12 20:22:59 +02:00
Snowiiii
50051d9dc9 Fixed: Clientbound Entity Metadata 2024-08-12 18:18:53 +02:00
Snowiiii
2909cad081 Avoid Packet cloning 2024-08-12 17:31:43 +02:00
Snowiiii
5cf19a4e98 Add ChatType 2024-08-12 15:46:24 +02:00
Snowiiii
65c2207c0a Add Player Tab list 2024-08-12 15:09:34 +02:00
Snowiiii
5b636111e4 Prepare ChatType registry 2024-08-11 17:55:41 +02:00
Snowiiii
76106ded18 Add WIP Resource Pack support 2024-08-09 22:14:41 +02:00
Snowiiii
770d73f080 minior position/rotation improvements 2024-08-09 14:29:51 +02:00
Snowiiii
e238417c89 Reduce loading time 2024-08-08 13:02:35 +02:00
Snowiiii
fe8cd334e1 Add Chat support 2024-08-08 11:27:09 +02:00
lukas0008
b9de0839fa Reapply "Remove reqwest blocking feature"
This reverts commit 33df6b0b1f.
2024-08-07 21:16:40 +02:00
lukas0008
33df6b0b1f Revert "Remove reqwest blocking feature"
This reverts commit 76ce44e58d.
2024-08-07 21:16:00 +02:00
lukas0008
76ce44e58d Remove reqwest blocking feature 2024-08-07 21:13:00 +02:00
lukas0008
873df335b8 Merge remote-tracking branch 'upstream/master' 2024-08-07 20:34:36 +02:00
lukas0008
2fd8686fea todo to TODO 2024-08-07 20:33:51 +02:00