* add pumpkin error handling for commands
* cleanup clear command
* fix so that all Container implementations follow the same order as the trait
* cleanup give command
* remove unnecessary function
* remove unnecessary function
* fix give command
* fix clear command
* fixup item placement logic
* cleanup clear command a little
* add cleaner registry parsing
* start adding recipes
* add tags, and some crafting things
* Fix echest command
* add partly working crafting interface
* add generated assets
* fix container commands and clippy lints
* fix issues with resolving recursive item tags for crafting
* add flatten3x3 function
* add shapeless crafting
* add tests to and fix recipe flattening function
* refactor recipe system a bit
* add rayon to speed up initial loading of recipes
* almost working after rebase
* add deserialization for new crafting type "transmute"
* make crafting work again
* make shapeless recipes not require all permutations
* fixed visual bug with when taking out ingredients for crafting
* add support for new tags system
* Added new packets
Added packets to pumpkin-protocol for damage and re-spawning.
* Made damage_type registry value accessible
* Added damage and fall damage
* fixed phasing bug
* fix issues caused by merge
* spawn player on ground
make the player spawn on the highest block instead of in the air.
* dont default player to flying
* mode last_pos to living_entity
* fix using entity instead of living_entity
* fixed fall damage not working properly when switching gamemodes
* Add query options to config
Added packet data types
Correctly parse a handshake packet
Add tokio to pumpkin protocol for `AsyncReadExt` convenience functions
* Add repr(u8) so that PacketType is a byte
* Respond to handshake correctly
* Allow for proper decoding of status packets and properly handle errors in decoding
* Implement challange tokens and verify with token and address
* Encode Basic status packet
Switch to CString since its better to and null errors higher up the code
* Encode Full status packet
* Add forgotten fields to full status packet
* Correctly respond to query clients when requesting full status
* Return actual address and port of server
Respect config options
Remove uncessary debug derives
* Remove packet type as it is redundant/unnecssary
* Implement basic status request
Refactor code for better error handling
* Update README
* Show players correctly in full status packet
* Store all packets in structs instead of enums
Break up en/decoding for each packet
Reduce client tracking
Get rid of QueryClients struct
Stop storing of magic value and check during decoding
Added tests for all decoding and encoding
Fix all sugestions from @StripedMonkey
Before only Clientbound Packet IDs where parsed from JSON, Now Serverbound Packet IDs are parsed from JSON as well. This makes porting to new minecraft version much easier
So currently we trough an error and don't load the entire chunk if a block is not found in the registry, Which is often the case when loading worlds from older or newer version than Currently supported. So now we will just not load the not founded blocks and load blocks which we found
* ctrlc: also handle `sigterm` and `sighup` via `termination` feature
This commit enables the `termination` feature in `ctrlc` so that
`sigterm` and `sighup` are also handled on UNIX systems. This in turn
improves Docker compatibility since containers now listen to the
`SIGTERM` signal it sends to containers when trying to stop the
container via `Ctrl-C` whilst attached.
* Replace `ctrlc` signal handling with `tokio`
This removes the `ctrlc` crate from the project, replacing (and upgrading) its functionality to also handle `sigterm` and `sighup`.
Sigterm handling is working on UNIX with this commit, I haven't tested Windows compatibility with `Ctrl-C` nor have I tested `sighup` or `sigint`.
Of course, compiles and runs on UNIX. Haven't tested Windows.
* fix: remove unused import; collapse if statement
* main: fix per-os signal handling
Will only compile Windows-specific/Unix-specific code when on their respective environments.
Handles signals in a separate tokio thread so it doesn't suspend the main thread.
Tested to work on UNIX (macOS) but not tested on Windows.
* main: cargo fmt
* main: fix setup_sighandler fn signature on windows
* main: attempt 2 at fixing windows sighandler
* main: enable ctrlc for all non-unix systems
Previously, ctrlc usage in tokio was only enabled on Windows systems
(since UNIX systems have their own signal handling in Pumpkin). Instead
of limiting ctrlc to just Windows, we can make it run on any non-UNIX
system since it should be platform independent anyhow.
* Implement max player limit
* Removed unnecessary `return`.
* Moved server full check to start of `handle_login_start`
Also removed unnecessary debug log.
* Use instead of for max players; add disable logic
* Fix semicolon missing
* pumpkin: Add player join and quit messages.
This implementation will send a 'joined the game' and 'left the game'
message akin to the vanilla server when a player joins or disconnects
respectively.
One caveat with this implementation is that it only broadcasts the
join/quit messages to players in the same world, unlike the vanilla
server, which broadcasts it to all online players (regardless of their
world).
I discussed this with Alex who suggested to keep it as per-world
(seemingly for now?) - [Discord conversation](https://discord.com/channels/1268592337445978193/1268611318617866261/1299668206734147597).
Regardless, this implementation works perfectly on my end. (yes, it has been tested)
* pumpkin: added logs for join/quit
* Move disconnect message code to world from player
Compiles and runs, sends join and quit messages in console with no
errors.
* Move join message from server to world
This reverts commit a1b97730bd.
Due to Errors
```
thread 'tokio-runtime-worker' panicked at pumpkin-protocol/src/client/play/c_chunk_data.rs:84:25:
index out of bounds: the len is 4096 but the index is 25374
```
These functions access only the world itself's current players, and thus
the old documentation was incorrect saying that it accesses the server's
online players.