Commit Graph

15 Commits

Author SHA1 Message Date
Epix
93510eecd5 Grammar fixes, terminology change (#633)
* Major grammar sweep

* Remove extra backtick

* Use more specific terminology for chunk data storage

* Forgor to cargofmt

* Fix typo "thier"

* Fix typo "clousures"

* Try new terminology

* Forgor to cargofmt

* Use "Subchunks" instead of "Heterogeneous" for ChunkBlocks variant

* Fix variable name

* Forgor to change comment
2025-03-16 10:40:17 +01:00
vyPal
f0bdfc943e Add more events to the Plugin API (#552)
* Add PlayerChangeWorld event

* Fix docs

* Add PlayerGamemodeChange event

* Add PlayerLogin event

* Fix clippy

* Fix docs

* Add PlayerChat event

* Fix some event impls

* Post-merge issues

* Add PlayerCommandSend event

* Fix PlayerCommandSend event

* Fix PlayerLogin event docs

* Add PlayerMove event

* Implement PlayerCommandSend event

* Implement player position sync when move event cancelled

* Add PlayerMove event to handle_position_rotation

* Fix docs

* Implement PlayerTeleport event

* Add ServerBroadcast event

* Fix some event impls

* Add ServerPluginEnable event

* Add ServerPluginDisable event

* Implement plugin enable/disable events

* Add ServerComand event

* Fix clippy

* Add teleport method to player

* Fix player teleport event impl

* Fix imports

* remove not needed clones

* Fix clippy

* Fix formatting

* Respect server.defaultgamemode

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-03-12 08:14:40 +01:00
4lve
eb27cfa16a Generate Blocks and Properties Revamp (#613)
* Add block builder

* Implement loot tables

* chaos snapshot

* LFG

* add oak fence

* lever facing

* Add trait for CardinalDirection

* fix clippy

* fix clippy

* reimplement partial state of loottable

* Implement neighbor block updates

* add oak door

* Fix crash on invalid state

* Fixes

* Add fences

* Add doors

* Refactor how we handle block properties when implemented in many places

* Remove old loot_table, moved to block generation

* Better Block Properties

* Add fence gates

* Update block_grouper and add logs

* Build tags instead and make it easier to define variants of blocks

* Save block states

* Allow nether fences to connect with fence gates

* Move away from hardcoded property names

* Clean up property remaps

* start refactor of blocks

* refactor block compile build

* refactor name map for property groups

* Make it so fences can't connect to the air part of a fence gate

* Use extractor instead of hard coded property names

* to_value and from_value should be stripped of "L" prefix

* Prefix isn't used anymore

* use hashes to verify uniqueness

* Don't declare IntProvider twice and fix typo

* remove some comments that don't apply anymore

* Move loot table so it's shared

* Futureproof Loot Tables

* Implement BlockStateProperty condition for LootTables

* Move experience to pumpkin_utils

* Add is_liquid

---------

Co-authored-by: kralverde <github@email.kralverde.dev>
2025-03-10 18:06:44 +01:00
Alexander Medvedev
1fb2be46d4 Update to Rust edition 2024 2025-02-20 18:42:20 +01:00
kralverde
e146130fd2 Check version of level.dat before trying to deserialize it (#555)
* initial commit

* cargo: fmt

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-02-18 17:41:27 +01:00
vyPal
9c324990fa world: change player list to rwlock (#550) 2025-02-14 17:49:45 +01:00
Thomas Tartrau
73d3fe0373 Add new plugin events / change plugin organization (#536)
* refactor: make file per event

* feat: edit plugins organization
2025-02-12 16:37:23 +01:00
suprohub
186e846858 Plugin event rewrite (#513)
* simplify all

* fmt

* Consider using derive macro

* Add new events

* Add events call

* minor fixes

* minor fixes

* fix

* optimize code

* big changes

* fix skill issue

* fix

* Consider not specify patch version

* make logger shared

* i want test one thing

* Add one useful function

* add little amouth of docs

* use config instead

* revert changes

* fmt

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-02-01 18:14:28 +01:00
Alexander Medvedev
466d4380cf Some Refactors 2025-02-01 17:53:41 +01:00
Alexander Medvedev
ef497fb435 Refactor World Entity System
Also support Item drops (WIP)
2025-01-31 21:45:20 +01:00
vyPal
8bb47b6ec7 Allow plugins to unregister commands (#522)
* Add unregister function

* Add unregister_command to plugin context

* Send command suggestions packet to all players

* cargo clippy

* cargo clippy again
2025-01-31 13:12:57 +01:00
Alexander Medvedev
e82a52fc9e Improve Error handling when loading Plugins 2025-01-29 20:29:16 +00:00
suprohub
49c697b431 Plugin api events rewrite (#510)
* simplify all

* fmt
2025-01-28 20:30:34 +01:00
Alexander Medvedev
41fac573ba Fix some typos 2025-01-28 14:05:17 +01:00
vyPal
a0ae1ae515 add Plugin system (#339)
* Add pumpkin-api crate for API definitions

* Add proc-macro definitions for pumpkin-api

* Add pumpkin-api and pumpkin-api-macros to workspace

* Add basic PluginManager implementation plugin loading

* Update .gitignore to include specific plugin file types

* Add example plugin

* Cargo fmt

* Fix clippy issues

* Refactoring to prevent a circular import

* Add base impl for plugin hooks

* Move plugin manager to server

* Make metadata have static lifetime

* Add default implementations to events

* Add hooks to proc macro

* Update example

* Fix formatting

* Fix clippy warnings

* Load metadata from Cargo.toml

* Mark plugins as an implemented feature :D

* Implement new event handling

* Create a static global reference to the plugin manager

* Emit player join and leave events

* Update macro generation

* Update example

* Fix formatting

* Fix clippy issue

* Simplify event handling

* Add plugin command to list plugins

* Make handlers async

* Update macros

* Update example

* Fix formatting and clippy issues

* Better styling on plugins command

* Fix clippy issues

* Cargo fmt

* Disable doctest for lib target on pumpkin crate

* New API for plugins

* Update api macros

* Update plugin example

* A bit of clean up

* Some QoL (and performance) improvements

* Cargo fmt and clippy fixes

* refactoring, better event handling, new context functions

* Async on_load and on_unload

* Fix mutex lock never going out of scope

* Async plugin loading

* Add plugin management command

* Fix clippy issues

* Fix import issues

* Move TcpConnection out of client

* Move packet encoding out of client

* Allow plugins to register commands

* Fix fmt and clippy

* Implement plugin list in query

* Make arguments public so that plugins can use them

* Update proc_macros to handle runtime

* Make tree_builder public for use in plugins

* Make FindArg trait public for use in plugins

* Update example plugin

* Fix merge related issues

* Fix cargo fmt

* Post-merge fixes (also 69th commit, nice)

* New event system

* cargo fmt

* Impl block break event

* cargo fmt and clippy

* Reduced plugin size

* Reduce dependency count

* Old code cleanup

* cargo fmt

* Add event priority and blocking options to event registration and handling

* Refactor event handling to support blocking execution and improve event registration

* Fix post-merge errors

* Update example plugin

* increase mpsc channel capacity and handle write errors gracefully

* Use Arc<Player> instead of &Player

* add missing import

* Update example plugin with playing sounds

* Remove example plugin

* Create plugins dir if doesnt exist

* Remove unused vars

* Remove unnecessary clones

* Fix impl

* cargo fmt

* Make server pub in context
2025-01-24 17:26:09 +01:00