Commit Graph

418 Commits

Author SHA1 Message Date
DaniD3v
070a50833b Moved config into its own crate 2024-08-31 19:38:47 +02:00
DaniD3v
a17ed23b00 Moved Difficulty into pumpkin-core 2024-08-31 19:34:35 +02:00
DaniD3v
2fbf450ed3 Moved GameMode into pumpkin-core 2024-08-31 19:33:47 +02:00
DaniD3v
6740e717f7 Reordered Imports 2024-08-31 19:29:24 +02:00
DaniD3v
bb543b7178 Moved configuration to LazyLock 2024-08-31 19:29:22 +02:00
DaniD3v
e48ca3b99f Moved configuration structs into own files
- PVPConfiguration
- RCONConfiguration
- CompressionConfiguration
- CommandsConfiguration
2024-08-31 19:27:06 +02:00
DaniD3v
a6cb88b48f Added LoadConfiguration trait.
De-duplicates code from both BasicConfiguration and AdvancedConfiguration.
Allow config to fail writing. (On e.g. immutable linux distros)
2024-08-31 19:27:06 +02:00
DaniD3v
003219d3e8 Sorted main.rs inputs 2024-08-31 19:27:06 +02:00
DaniD3v
d2924d4632 Moved auth_config to auth
Make it consistent with `proxy` and `resource_pack`
2024-08-31 19:27:06 +02:00
DaniD3v
d57d9ffdcc Use proper IP Address abstraction instead of using format!() 2024-08-31 19:27:06 +02:00
DaniD3v
ff68b5cac5 Removed manual Default implementation 2024-08-31 19:27:06 +02:00
DaniD3v
3535d2cda1 Fixed new clippy lint 2024-08-31 19:27:06 +02:00
Snowiiii
e4fd015265 Fix .gitignore 2024-08-31 11:48:34 +02:00
Snowiiii
ee4e18282e Support multiple worlds
- We moved all players to seperate worlds. This will save performance when many different players are on different worlds. The only thing broken now are commands because of async stuff
2024-08-31 11:39:59 +02:00
Alexander Medvedev
6a45746703 Merge pull request #66 from kralverde/xoroshiro
implement xoroshiro128 RNG
2024-08-30 17:53:14 +01:00
Snowiiii
f45ebb2d4f Cache: Chunks 2024-08-30 18:42:54 +02:00
lukas0008
ab73f3a3a4 Cargo fmt 2024-08-30 18:00:23 +02:00
lukas0008
8bb00e26be Make ChunkData use Vector2 instead of ChunkCoordinates 2024-08-30 17:40:55 +02:00
lukas0008
5f05a1886b Change coordinates, and add .get_block to ChunkBlocks
- Renamed ChunkRelativeScalar to ChunkRelativeOffset
- Added more traits to Height and ChunkRelativeOffset
- Added .get_block to ChunkBlocks
2024-08-30 15:07:54 +02:00
lukas0008
0c79d38de9 Update .gitignore 2024-08-30 14:46:49 +02:00
kralverde
fea3cf7ad1 refactor and verify 2024-08-29 18:25:02 -04:00
Snowiiii
3cc0c9a52a Broadcast Sneaking/Sprinting
For some reason Sneaking "partially" works. Only the player names becomes darker when sneaking but the actual pose does not change. Weird
2024-08-29 22:43:43 +02:00
Snowiiii
7ed46e25a0 Add EntityPose 2024-08-29 17:35:49 +02:00
kralverde
df92b5fbcf verify originals were not mutated 2024-08-28 23:44:21 -04:00
kralverde
21c7c2c04c tweaks 2024-08-28 23:26:56 -04:00
kralverde
0a351171c6 implement xoroshiro128 RNG 2024-08-28 19:16:22 -04:00
Snowiiii
443febefdb Update README.md 2024-08-28 19:04:31 +02:00
Alexander Medvedev
94f1e21dec Create FUNDING.yml 2024-08-28 18:59:56 +02:00
Snowiiii
c36b6d3464 Less unwraps 2024-08-28 18:52:30 +02:00
Alexander Medvedev
0ba9b37048 Merge pull request #63 from DaniD3v/master
Superflat Worldgeneration
2024-08-28 16:44:28 +01:00
DaniD3v
ff06d05487 Made ChunkNBT struct slightly more readable 2024-08-28 17:35:01 +02:00
DaniD3v
e2d2b53f41 Fixed bug where whole chunk can break in one mined block 2024-08-28 17:34:56 +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
43c724dec7 Added Superflat implementation. 2024-08-28 17:34:37 +02:00
DaniD3v
9149e82508 Added WorldGenerator traits and a GenericWorldGenerator. 2024-08-28 17:28:48 +02:00
DaniD3v
4031c4dc13 Added Seed Type. 2024-08-28 12:52:26 +02:00
DaniD3v
eb4d47aa74 Added an Enum for Biomes 2024-08-28 12:52:26 +02:00
DaniD3v
b5b27885c7 Added ChunkStatus to check if a chunk is fully generated yet.
When loading a partially generated world there's some
incomplete chunks that might not have a heightmap yet.

If that is the case we return a ChunkNotGeneratedError
to indicate that it's ok to (re-)generate it.
2024-08-28 12:52:26 +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
cdb0e6b761 Refractored coordinates.rs 2024-08-28 12:52:26 +02:00
DaniD3v
cf283323fc BlockId refactor.
Moved `BlockId` to it's own file.
Prefixed all of the `block_registry` types with Registry to avoid confusion.
Made stuff that should not be public private.
2024-08-28 12:52:19 +02:00
DaniD3v
bef3ddef50 Replaced redundant .map with .for_each 2024-08-28 12:52:19 +02:00
DaniD3v
a8d9c89da2 Implemented Default for ChunkHeightmaps and ChunkBlocks 2024-08-28 12:52:19 +02:00
DaniD3v
52c34caaa6 Added ChunkBlocks abstraction for ChunkData
ChunkBlocks makes it easy & safer to access blocks of a chunk.
It also makes it possible to consistently handle the heightmap updates in 1 place.
2024-08-28 12:52:07 +02:00
DaniD3v
1d1dd2ed6c Added consts CHUNK_AREA, SUBCHUNK_VOLUME and CHUNK_VOLUME, 2024-08-28 12:52:07 +02:00
DaniD3v
4565133ef5 Refractored ChunkData::from_bytes
Simply count blocks instead of doing some complex operation with k/j/i
Marked comment with TODO
Replaced if/else condition with std::cmp::max
Removed some redundant `.enumerate()`s
2024-08-28 12:52:07 +02:00
DaniD3v
fe56d32463 Renamed block_size to block_bit_size for readability 2024-08-28 12:52:07 +02:00
DaniD3v
33ec123148 Added BlockIdentifierNotFound Error to differentiate from BlockStateIdNotFound 2024-08-28 12:52:07 +02:00
DaniD3v
43164ee4f1 Added abstraction for BlockId
`i32` is really ambiguous and it is not immediately obvious what it is supposed to represent.
`BlockId` is much more readable.

Changed internal type to u16 because we currently have ~30k/64k block states.
(and i32 doesn't make a lot of sense for an Id, except when replicating mojang behavior)
2024-08-28 12:52:07 +02:00
DaniD3v
5a21a687d8 Block structs refractor + added comments
renamed a few fields for clarity.
added examples for fields that might not immediately be obvious.
removed some `Option`s that are not necessary.

renamed `BlockElement` to `BlockType` because you could mistake
`BlockElement` for the main way to represent a Block (e.g. in Chunks).
2024-08-28 12:52:07 +02:00