Commit Graph

67 Commits

Author SHA1 Message Date
Alexander Medvedev
b55feecd74 ci: cargo machete 2026-08-05 13:27:23 +02:00
Alexander Medvedev
7350fba3b0 chore: chunk loading/saving move from serde to manual
should be faster now
2026-08-05 12:23:44 +02:00
Giovanni Giordano
0fe896892f docs: document pumpkin-nbt (#2648) 2026-07-30 14:13:47 +02:00
Alexander Medvedev
3103e97e18 ci: remove macos-15-intel 2026-07-24 12:31:57 +02:00
TheDarkSword
e480f32265 fix(pumpkin): stop entities from duplicating on chunk reload (#2342)
* fix(pumpkin): stop entities from duplicating on chunk reload

Entities lived in two places at once: the live World::entities list and the
serialized NBT in the entity chunk's data. On load the saved NBT was turned
into live entities but never cleared, and on unload each live entity was
appended back onto that still-populated list - so the persisted entity count
doubled every load/unload (reconnect) cycle. Freshly spawned entities hit the
same trap: add_entity_silent pushed their NBT into the chunk immediately, so
they were both live and serialized, doubling on the first unload too.

Make the live entity the single source of truth, matching vanilla:
- on load, take (clear) the chunk's serialized entities as they become live,
  and restore their persisted UUID so they keep their identity;
- a second watcher of an already-loaded chunk is sent spawn packets built from
  the live entities, not the stale NBT;
- entities are serialized fresh, from their current live state, only when their
  chunk unloads (save_entity);
- add_entity_silent no longer serializes on spawn.

Because the live entity is serialized fresh on unload, any change made to it
while loaded (health, effects, ...) is persisted automatically, without having
to be written back to the chunk data by hand.

* Move UUID int-array NBT helpers into pumpkin-nbt

Review feedback: the UUID read helper doesn't belong in world/mod.rs.
NbtCompound now has put_uuid/get_uuid for the vanilla 4-int-array
layout, used by both Entity::write_nbt and the entity chunk loader.
Serialized bytes are unchanged.
2026-07-11 18:59:37 +02:00
Missing_Love
3d03819411 feat(config): add broadcast-console-to-ops server property (#2285)
Add the `broadcast_console_to_ops` configuration option matching
vanilla's `broadcast-console-to-ops` server property. When set to
`false`, suppresses console and RCON command output from being
broadcast to online operators.

- Add `broadcast_console_to_ops` field to `CommandsConfig` (defaults
  to `true` for vanilla compatibility)
- Track the setting via an `AtomicBool` in the command module
- Replace hardcoded `true` in `should_broadcast_console_to_ops` for
  Console and RCON senders with the configurable value
- Initialize the setting during server startup from advanced config

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2026-07-10 13:29:05 +02:00
Laptop59
b241bbf0bd fix: make SNBT operation bool() return true for all non-zero values (#2358) 2026-07-09 16:00:34 +02:00
Alexander Medvedev
3629f43dcc fix: disable cave carver for now
fixes some issues
2026-05-23 16:36:08 +02:00
Alexander Medvedev
2fcc9bcf4a chore: enforce some more clippy lints
pumpkin contributors will love me :cap:
2026-05-20 22:27:54 +02:00
Demetrius Kanios
81f9f51d39 feat: Implement Bedrock NBT (network variant) (#2148)
* Implement Bedrock (Network) NBT

* Refactor to reduce dup between Java and Bedrock impls.

* Add tests, fuzzers, and benchmarks for Bedrock
2026-05-18 21:46:29 +02:00
Alexander Medvedev
d3d13323b2 fix: don't store empty chunks
should be fixed
2026-05-17 13:47:34 +02:00
Alexander Medvedev
35b91efd38 chore(pumpkin-nbt): add fuzzing & benches 2026-05-17 10:17:52 +02:00
Alexander Medvedev
4f69e2cb7a feat: add fishing rod 2026-05-10 17:53:13 +02:00
Alexander Medvedev
60bfdf62db Revert a55c42c83 2026-05-10 12:13:33 +02:00
Laptop59
04874d4420 feat(command): implement SNBT parser (#2088)
* initial commit

* split snbt into modules

* formatted

* clippy warnings fixed

* added more rules

* applied clippy fixes

* added even more rules

* fixed clippy errors

* made all the required rules

* added some integer tests

* fixed clippy errors part 2

* finish up the last integer tests

* added float tests and some basic string tests

* quoted string literals

* `bool` operation tests done

* operation and maps

* fixed conflicts

# Conflicts:
#	pumpkin-nbt/src/tag.rs

* fixed clippy errors

* added message to `todo!()`

* fixed `indexmap` dependency for `pumpkin-codegen`

* fixed `typos` errors

* removed usage of `peek_byte()` for consistency

* removed useless macro

* moved some parser functions into a trait

* new translation changes
2026-05-05 10:41:27 +02:00
Alexander Medvedev
95df70c448 perf: chunks should be faster now 2026-04-25 15:33:11 +02:00
SomeYellowGuy
513477d1cf fix(codec): replace codec and map codec structs with Encode and Decode traits and their field versions (#2051)
* removed codecs in favor of the `Encode` and `Decode` traits and their derivatives

* placed more exports in the `pumpkin-codecs` lib

* split primitives into their own folder and added some tests

* added `Either` support and added a simple test for it

* fixed linting for tests
2026-04-21 16:38:25 +02:00
Alexander Medvedev
85da55f9b3 fix: ci 2026-04-18 12:40:05 +02:00
Alexander Medvedev
a55c42c835 feat: add pnbt 2026-04-18 12:27:22 +02:00
HairlessVillager
974bdd98a6 chore: add license to Cargo.toml files (#1927) 2026-03-28 15:47:15 +01:00
SomeYellowGuy
24f6e2732d feat: Implement basic codecs and DynamicOps implementations from DataFixerUpper (#1483)
* initial commit

# Conflicts:
#	Cargo.toml

* implemented more `DataResult` methods

* finished data result struct

* fixed clippy errors

* implemented `map_like` and more `dynamic_ops` methods

* finished most other `DynamicOps` methods

* Fixed doc in get_bytes

* added encoder and decoder files

* fixed some stuff and added primitive codecs

* added some primitive codecs (has errors for now)

* changed the "stream" ops methods

* reworked types of the coders and codecs, added list codecs

* added JSON ops

* fixed list codecs, added some doc test examples in `JsonOps`

* added lazy codecs

* added map encoders, decoders and struct builders

* actually added mapdecoder

* added encoder and decoder transformations

* fixed encoder and decoder transformations and added transformation functions and range codecs

* added field encoders and decoders and separated range codecs

* added field encoders and decoders and separated range codecs

* added BaseMapCodec and SimpleMapCodec

* added struct codecs and moved tests

* added `NbtOps`, unsigned number codec types, range codec tests, a struct test, detailed `Codec` documentation

* added optional field map codecs, the validator function and reworked struct builder functions

* added unbounded map and struct codec tests and reworked validated codecs

* did some visibility refactoring

* fixed some stuff and renamed unsigned number codecs

* fixed formatting

* fixed docs to reflect changes on renaming unsigned number codecs

* fixed validated test

* fixed doctest

* moved base_map_codec and fixed docs about codecs

* fixed some mistakes in the code

* fixed some more mistakes in the code and converted some `DataResult::error` calls to `DataResult::partial_error`

* fixed formatting

* fixed some incorrect docs

* removed `OnceLock`s in `MapCodec`s so they can be used more easily

* fixed transformer codec descriptions, added more `NbtOps` tests and fixed some `NbtOps` list methods

* fixed doctest

* added a fourth specific `NbtOps` test for byte buffers (`ByteArray`s in NBT)

* fixed grammar mistake

* log messages for discarded keys in `create_map`

* use the `tracing` crate for logging

* added a method to allow creating a field using a `MapCodec` reference

* bifurcated `MapCodecCodec`s as well

* removed imports only for documentation and replaced them with intra-doc links

* added additional docs to `optional_field_with_default` and `lenient_optional_field_with_default` Codec methods for additional details on encoding

* renamed crate to `pumpkin-codecs` so that data fixing can be placed somewhere else not frequently used

* fixed some more errors and reworked `nbt_ops`'s `ListCollector` to be like 1.21.11, also allows &str in `DataResult`'s creation methods

* fixed invalid nbt tag for test

* reverted wrapping the tags for heterogeneous elements

* renamed function parameter in `DataResult::apply_2`

* removed unnecessary comment

* fixed a few more issues

* fixed formatting

* fixed another mistake for `DataResult::add_message`

* renamed `DataResult` factory methods to be more idiomatic and removed unnecessary `dyn` method

* removed unnecessary `clone()`

* updated Cargo.lock
2026-03-24 09:07:51 +01:00
SomeYellowGuy
2e0224418e feat: added unwrapping and wrapping for NBT lists to and from binary (#1742)
* added wrapping, unwrapping tags during serializing/deserializing NBT to/from bytes and added a serialization test

* fixed wrapping check in `wrap_tag_if_needed`

* added wrapped compound to test and renamed `put_component`

* fixed formatting

* fixed comment in test

* fixed test comments
2026-03-03 19:41:47 +01:00
Richard Marshall
a61238a498 fix: improve level.dat deserialization for imported worlds (#1568)
* fix: improve level.dat deserialization for imported worlds

worlds from different minecraft versions could fail to load due to
strict field requirements and missing nbt type support. this makes
level.dat fields default to vanilla values when missing, handles
both string and compound generator settings, and fixes nbttag
deserialization for lists containing compound elements.

* style: run cargo fmt on world_info module
2026-02-14 15:11:28 +00:00
Alexander Medvedev
835262a85a chore: move chunk gen settings from runtime to compile time parsing
Bin size decreased, Startup time decreased by a lot in debug, lower memory usage
2026-02-03 23:35:31 +01:00
Alexander Medvedev
b58822319d fix: CI 2026-01-28 23:40:48 +01:00
Alexander Medvedev
fb13004b47 fix: apply clippy lints to workspace
also add contributors to /pumpkin command

Co-Authored-By: Fyor <90567841+fyordev@users.noreply.github.com>
Co-Authored-By: MartV0 <34748938+martv0@users.noreply.github.com>
Co-Authored-By: FabseGP <fabsegp@fabseman.space>
2026-01-28 00:52:47 +01:00
Alexander Medvedev
ac4c85192f chore: less ugly code
and less allocations
2026-01-26 22:23:58 +01:00
Alexander Medvedev
5bfa6528da chore: changed block registration
only require block ids, should make bin size smaller and let the compiler better optimize, should also be faster performance wise
2026-01-23 23:32:17 +01:00
FabseGP
a04b7036bc chore: some cargo adjustments (#1306)
* chore: strip binaries & define rust-version in workspace

* fix: don't strip binary when profiling

* chore: clippy lints

* fix: use stable fmt

* fix: don't strip dev builds
2026-01-23 15:58:07 +01:00
Clicks
24fff00425 Make All Dependencies Workspace Dependencies (#1245) 2025-12-30 12:13:51 +01:00
Alexander Medvedev
92fe87e921 smaller structure gen preparations 2025-12-08 20:52:03 +01:00
Hendrik Lind
ed737dd75f Properly implement serialization / deserialization for NBT Arrays (#1213)
* fix: use int array instead of list for chunk entities

* just get the int array and don't fall back for the list

* update deserialization to use proper NbtTag

* dix deserialization of nbt arrays

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-11-27 17:36:02 +01:00
Alexander Medvedev
0ce5471761 Overhaul registry loading
Registry data is now loaded dynamically for automatic future-proofing, ending the need for manual struct updates. Access to specific values now requires explicit data lookups.
2025-11-18 19:00:18 +01:00
Alexander Medvedev
034399aeb5 fix: test 2025-08-15 15:35:30 +02:00
Alexander Medvedev
fbbade23dc Improved chunk deserializing performance
doing `let _ = io::copy(&mut self.reader.by_ref().take(count), &mut io::sink())` was just crazy slow when skipping bytes in NBT, we now instead use `seek`

The Palette was also changed and does not use a HashMap anymore
2025-08-15 14:57:43 +02:00
Liyan Zhao
e75e52cd37 feat: add /data get Command (#1097)
* feat: /data get

* fix: colorize like vanilla

* fix: clippy

* fix: clippy

* fix: clippy

* fix: clippy
2025-08-01 12:17:38 +02:00
unschlagbar
2e2236bf3b Bedrock player joining (#1063)
Co-authored-by: unschlagbar <adrian@kuhlmann@gmx.de>
Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
Co-authored-by: unschlagbar <adrian@kuhlmann@gmx.de>
2025-07-26 17:31:00 +02:00
Liyan Zhao
d34b3eb3f7 Macroize serde (#1029)
* macroize serde

* fix
2025-07-10 10:52:28 +02:00
Alexander Medvedev
b9f2de33f4 Fix dead locks, vanilla chunk loading and packet issues 2025-07-07 19:36:45 +02:00
Alexander Medvedev
a5b066d18f fix rust 1.88 lints 2025-06-26 20:47:15 +02:00
Alexander Medvedev
a31c9ec703 Implement Entity data Saving/Reading 2025-06-25 03:47:05 +02:00
Alexander Medvedev
575f17948f Inline format arguments
Looks much nicer and more readable
2025-05-10 15:22:06 +02:00
4lve
0dd176e8e2 add Block Entities (#737)
* Start implemetnign block entities

* fix

* Move block entites

* bruh wtf

* fix

* Add seralizers for compund

* don't panic on unknown block enity types

* Move block entites to pumpkin-world

* begin implementation

* Chunk packet works

* fix signs

* fix clippy

* merge

* Fix signs

* merge

* fix

* merge

* fix

* remove println

* move folder

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-04-13 16:22:12 +02:00
Alexander Medvedev
4bccba7b20 fix some typos
- also moved tempfile dep to dev-dependencies
- removed the noise crate
- renamed some things
2025-04-10 21:21:43 +02:00
kralverde
91ef79325a Network Serialization Quality of Life and Safety Improvements (#701) 2025-04-07 07:59:00 -10:00
Gabeperson
e03e05ddad Refactor unnecessary unsafe code and add safety comments (#698)
* refactor unsafe code

* fix unwrap in forbidden block
2025-04-04 08:25:36 +02:00
Alexander Medvedev
dda7cac329 Save/Read and broadcast biomes (#678)
* send biomes in packet

* fix single pallet

* complete logical palette container

* refactor codecs

* palette work

* palette work

* fix palettes

* clean up palette logic

* better handling of chunk loading channel errors

* fix encompassing bits

* fix network serialization

* fix typos

---------

Co-authored-by: kralverde <github@email.kralverde.dev>
2025-04-03 19:06:40 +02:00
Hugo Planque
4672f61965 feat(player-data): Support saving and loading player NBT Data (#600)
* feat(player-data): Support saving and loading player NBT Data

* fix(player_data): ensure player data is save before continuing

* fix(player_data): implement NBTStorage for hunger data

* feat(player-data): allow setting world name in config

* fix(player-data): use correct method to retrieve world_name

* feat(player-data): move PlayerDataStorage to pumpkin-world

* fix(player-data): ci not building

* fix(player-data): ci not building

* feat(player-data): support inventory saving + review fix

* fix(player-data): forgot the format

* some fixes

* fix clippy

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-03-24 20:55:41 +01:00
kralverde
b9d9bacf8c Abstract networking to streamline code and avoid creating a new buffer for (de)compression. (#607) 2025-03-20 06:23:25 -10:00
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