Commit Graph

2562 Commits

Author SHA1 Message Date
Alexander Medvedev
5e01d67579 feat(command): add team command 2026-07-14 12:36:47 +02:00
Alexander Medvedev
02c8c84789 feat(command): add spectate command 2026-07-14 11:15:18 +02:00
Alexander Medvedev
92835d5523 feat(command): add item command 2026-07-14 09:21:20 +02:00
Alexander Medvedev
edd9ed88e7 fix: ci 2026-07-13 19:23:30 +02:00
Alexander Medvedev
486f8d2cfe feat(command): add attributes 2026-07-13 18:43:45 +02:00
Alexander Medvedev
ce05798fac feat(command): add clone 2026-07-13 18:17:42 +02:00
Alexander Medvedev
dab8474e71 feat(command): add scoreboard/trigger command 2026-07-13 18:09:03 +02:00
yhypno
6219d36c64 fix(item): consume armor stand on placement (#2392) 2026-07-13 17:43:53 +02:00
Mcxiaocaibug
f0374c30d4 feat(pumpkin): add /tag command with entity scoreboard tags (#2395)
Implements the vanilla /tag command (tracked in #15) along with the
entity-side storage it needs:

- Adds a scoreboard_tags: Mutex<HashSet<String>> field to Entity, with
  add_scoreboard_tag / remove_scoreboard_tag helpers that enforce the
  vanilla 1024-tag cap and report whether they changed anything.
- Serializes tags to/from the entity's "Tags" NBT list, matching the
  vanilla format so tags round-trip through world saves.
- /tag <targets> add|remove <name> and /tag <targets> list, with the
  existing commands.tag.* translation keys and single/multiple wording.
2026-07-13 17:43:23 +02:00
Mcxiaocaibug
1f38ba8054 feat(pumpkin): add /save-all, /save-off and /save-on commands (#2394)
Implements the three vanilla save-control commands (tracked in #15):

- /save-all saves all online players' data and advancements, then
  requests a chunk save from every world's chunk scheduler. It works
  even while autosaving is disabled, matching Vanilla.
- /save-off disables periodic autosaving via a new save_enabled flag
  on Level; running it again fails with commands.save.alreadyOff.
- /save-on re-enables autosaving; running it again fails with
  commands.save.alreadyOn.
2026-07-13 17:40:23 +02:00
Mcxiaocaibug
4929c590ab feat(pumpkin): add /random command (#2396)
Implements the vanilla /random command (tracked in #15):

- /random value <range> draws a value and shows it to the source only.
- /random roll <range> draws a value and announces it to every player.
- Range validation matches Vanilla: spans of 0 fail with
  commands.random.error.range_too_small, spans of i32::MAX - 1 or wider
  (including open-ended ranges) fail with range_too_large.

Random sequences (/random reset and the [sequence] argument) are not
part of this change since named sequence storage does not exist yet.
2026-07-13 17:38:43 +02:00
Mcxiaocaibug
650c614db9 feat(pumpkin): add /spreadplayers command (#2397)
Implements the vanilla /spreadplayers command (tracked in #15):

- Places targets at random surface locations within maxRange of a
  center column, spread at least spreadDistance apart, using Vanilla's
  iterative force-based relaxation followed by a surface-grounding pass.
- Rejects unsafe locations (liquid surfaces) and retries, matching
  Vanilla's refusal to place entities on water.
- On failure reports commands.spreadplayers.failed.{entities,teams} with
  the Vanilla suggested maximum spread; on success reports
  commands.spreadplayers.success.* with the average pairwise distance.

respectTeams currently collapses all (teamless) targets onto a single
pile, since teams are not implemented yet; this matches Vanilla's
handling of teamless entities under respectTeams=true.
2026-07-13 17:32:51 +02:00
Alexander Medvedev
ea7ee250fe fix: clippy 2026-07-13 13:14:00 +02:00
Alexander Medvedev
6422a13498 chore: Update README video (#2398)
* fix: readme video

* seems github only accepts webp

this platform is just awesome

* Update pumpkin_chunk_loading.webp
2026-07-13 13:10:40 +02:00
Alexander Medvedev
b1b2a31c49 fix: vanilla level.dat loading 2026-07-13 12:53:33 +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
TheDarkSword
1ca089df17 perf(generation): speed up chunk generation(#2335)
* perf(generation): cache computed structure starts

set_structure_references runs for every chunk and, for each nearby structure
candidate, recomputed the structure's placement from scratch. For jigsaw
structures (villages, ancient cities, ...) that means re-running the full
jigsaw expansion for every chunk whose references overlap the structure -- the
same start recomputed many times over.

A structure's placement depends only on its start chunk and the world seed (the
surface-height estimate it uses is position-independent and min_y is constant
per dimension), so memoize it in GlobalStructureCache and reuse it. In the
bench, structure references drop from ~342us to ~105us.

* perf(lighting): use a fast hasher in the generation light engine

The BFS light propagator's visited/shadow_cache/pending_updates maps were
aliased to std HashSet/HashMap (SipHash) despite being named "Fast". They are
probed on every neighbour of every propagated block, so the hash function
dominates. Point the aliases at rustc-hash's FxHash (already a dependency).

Lighting generation drops from ~65ms to ~36ms and full chunk generation from
~103ms to ~68ms in the bench, with identical output.

* perf(lighting): propagate light through storage, not a shadow cache

The BFS light propagator kept a hashed shadow cache of in-flight light values
plus a per-chunk batched write buffer, layered on top of the light storage. The
storage is itself a fast array lookup, so the extra hashing and buffering cost
more than they saved. Read and write it directly and treat it as the single
source of truth.

Lighting generation drops from ~36ms to ~22ms and full chunk generation from
~68ms to ~52ms, output unchanged (all pumpkin-world tests, including the
fixed-seed ancient-city parity test, still pass).

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2026-07-11 18:46:29 +02:00
dongzh1
5c1558788a fix(net): avoid panics on malformed encryption/velocity login responses (#2310)
`handle_encryption_response` unwrapped the RSA decrypt of the
client-supplied shared secret, panicking the connection task on a
malformed value; kick the client instead, mirroring the adjacent
`set_encryption` error handling.

`receive_velocity_plugin_response` called `data.split_at(32)` without a
length check, panicking on a velocity response shorter than 32 bytes;
guard the length and return `FailedVerifyIntegrity`.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 18:34:24 +02:00
BitForge
f13736def9 fix(loot): animals drop cooked food without fire or Fire Aspect (#2391)
* fix(loot): animals drop cooked food without fire or Fire Aspect

Fix issue #2366 where farm animals dropped cooked meat instead of raw
when killed, regardless of fire state or weapon enchantments.

Root cause: LootCondition::EntityProperties lacked predicate fields for
is_on_fire and equipment enchantments, codegen discarded predicate data,
and the evaluator did not resolve 'direct_attacker'.

- Add is_on_fire and mainhand_enchantment_tag to EntityProperties
- Add predicate structs to codegen with correct serde renames
- Fix evaluator to resolve direct_attacker and check fire/enchantments
- Fix pre-existing v[0] panic on empty StringOrVec arrays
- Add 18 unit tests

* fix(loot): add backticks to doc comment for clippy

* fix(data): update block.rs generated loot tables with new EntityProperties fields

* fix(loot): merge match arms and collapse if for clippy
2026-07-11 18:17:19 +02:00
Alexander Medvedev
43e3581e70 chore: more redstone implemented 2026-07-11 17:45:52 +02:00
yhypno
1f4030a28d fix(inventory): prevent anvil rename stack duplication (#2373) 2026-07-11 12:46:34 +02:00
Missing_Love
406878e6c1 chore: update README with Java/Bedrock and W.I.P status (#2361)
* Update README with Java/Bedrock and W.I.P status

Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com>

* Update README.md

Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com>

---------

Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com>
2026-07-11 12:46:02 +02:00
Alexander Medvedev
af3376e68e feat: Implement missing data components 2026-07-11 11:04:51 +02:00
Alexander Medvedev
3c6557d6db feat: Implement all missing block entites 2026-07-11 09:35:26 +02:00
Alexander Medvedev
9eab7581fd feat: Implement Profile data component 2026-07-10 18:16:30 +02:00
Laptop59
b4e3670a86 feat(command): team color and hex color argument types (#2357)
* feat: implement the argument types for color

* fix: clippy warnings & format code
2026-07-10 16:00:32 +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
yhypno
7829f0bca0 fix: preserve stacked buckets when collecting fluids (#2371) 2026-07-10 11:15:46 +02:00
Alexander Medvedev
7ccb0c237f fix: https://github.com/Pumpkin-MC/Pumpkin/issues/2219 2026-07-09 22:02:15 +02:00
nobuildersnotools
8cf50cb393 perf(entity): swap std hashmap for fxhashmap in pathfind (#2360) 2026-07-09 21:13:26 +02:00
TheDarkSword
a4af4269fb fix: sky light propagation hanging on unloaded chunks (#2334)
* fix(lighting): stop sky light updates from looping on unloaded chunks

The sky light propagation could spin forever when a light update happened
next to a chunk that wasn't loaded. Writes to an unloaded chunk are dropped
silently and reads come back as 0, so the "this neighbor is darker than us"
check stayed true on every pass and the same position kept getting queued
again. In practice this hangs a tick thread when a block is broken near the
edge of the loaded area.

Skip neighbors whose chunk isn't loaded in both the increase and decrease
passes, matching how the border of loaded chunks already behaves: light
doesn't bleed into chunks that aren't there yet.

* Use Level::is_chunk_loaded for the unloaded-chunk guard
2026-07-09 20:59:38 +02:00
Alexander Medvedev
1af05a4530 ci: only sign on master 2026-07-09 20:46:22 +02:00
Alexander Medvedev
47fe060665 fix: rust 1.97 lints 2026-07-09 20:39:01 +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
1196d9226f ci; add Windows signing 2026-07-08 18:29:44 +02:00
Alexander Medvedev
339d9dde5b feat: add bedrock biome mappings 2026-07-08 17:30:55 +02:00
TheDarkSword
c82bf52aec perf(pumpkin): tick block entities per active chunk instead of scanning all (#2340)
Block entities lived in one flat DashMap keyed by BlockPos, and every world
tick rebuilt the tick list by iterating the entire map and filtering it down
to the active chunks. That is O(all loaded block entities): the more of the
world that has been explored (chests, signs, hoppers... all count), the
longer every tick spends walking block entities it is not going to tick, so
TPS slowly bleeds away on long-running worlds.

Key the map by chunk instead (chunk -> its block entities). Ticking now walks
only the handful of active chunks and their entries, inserts/removals/lookups
compute the chunk key up front, and unloading a chunk drops its whole bucket.
Behaviour is unchanged - the same block entities get ticked - it just stops
scanning the ones that are loaded but nowhere near a player.
2026-07-07 16:00:27 +02:00
TheDarkSword
984e0098e2 perf(pumpkin): only tick entities in active chunks (#2341)
The world tick iterated every entity in the world and ticked all of them,
regardless of where they were - so entities sitting in loaded-but-not-active
chunks kept running their AI, movement and player-collision checks every tick.
That is O(all loaded entities) and grows as a world is explored, bleeding TPS
on long-running servers.

Skip entities whose chunk isn't in the active (ticking) set - the same set
block-entity ticking and mob spawning already use, and matching vanilla, which
only ticks entities within the simulation distance. The check uses the live
position rather than the cached chunk_pos, since fast movers (minecarts,
projectiles) update pos directly and leave chunk_pos stale.

Players are ticked separately and aren't in this list, so they're unaffected.
2026-07-07 15:59:41 +02:00
BitForge
adbc8e2b6a fix: prevent capacity overflow crash (#2348)
* fix: prevent capacity overflow crash when flying with elytra or in creative mode

The NoiseBasedCountPlacementModifier::get_count() can return negative i32
values when foliage noise sampling produces negative results at certain
world coordinates. The previous code cast this negative i32 directly to
usize, causing an integer wrap to ~18 quintillion, which triggered a
capacity overflow panic in Vec allocation during chunk feature generation.

This aligns with vanilla Minecraft behavior which also clamps the count
to a minimum of 0 before using it.

Closes #2345

* Hi
2026-07-07 15:53:11 +02:00
Red
0de72cbf18 feat(plugin-api): Forced use of setters (#2333) 2026-07-07 15:26:30 +02:00
ZlordHUN
cc2b537371 fix: set client player before spawn to prevent invisible chunks on first join (#2307)
* Fix First Join Invisible Chunk

* downgrade warn! to debug! in send_chunks drop path
2026-07-07 14:20:18 +02:00
Alexander Medvedev
44fd621294 fix: bedrock block mappings 2026-07-06 21:49:42 +02:00
yunuservices
5d27ab34d3 feat(plugin-api) Add ServerLoadEvent (#2302)
* feat: add ServerLoadEvent

* fix: address ServerLoadEvent review feedback
2026-07-06 20:01:54 +02:00
dependabot[bot]
8c1064908b build(deps): bump crate-ci/typos from 1.47.2 to 1.48.0 (#2349)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.47.2 to 1.48.0.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.47.2...v1.48.0)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-version: 1.48.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-06 09:02:38 +02:00
Alexander Medvedev
4ec2315aef chore: implement all missing raknet packets 2026-07-05 20:26:32 +02:00
kedor
560a0ed77d feat(config): add Configuration for advancement saving (#2259)
* implementing the advancement configuration for saving or not the advancements

* adding a test for not loading files when save is disabled

* cargo fmt

* fix merge

* Fix variable name for players directory
2026-07-05 16:36:36 +02:00
ChocoDev
da2401d07d feat: aquifer sample and top material in cave carver (#2242)
* sin/cos util

* 4 nieghbor check

* formating

* air helper

* carver wrapper

* fmt

* clippy

* clipp2

* remove local y

* out of bound guard

* fluid tick

* surface rule

* wire up

* math correct

* start fix

* bring back xoroshiro oops

* scheduler guard

* simplify test

* clean test

* comment

* crash fix

* clippy

* clippy

* i hate you codex

* sin cos

* im stupid f32
2026-07-05 15:55:43 +02:00
Alexander Medvedev
3aea5ee720 fix: ci 2026-07-04 15:14:55 +02:00
Alexander Medvedev
c60fa90ed8 feat(bedrock): Add Protocol encryption 2026-07-04 15:01:42 +02:00
Aalivexy
52838d945b fix: trigger PlayerChangeWorldEvent on cross-dimension respawn (#2228) (#2250)
Rebased onto current master after #2296 (PlayerRespawnEvent).

- Fire PlayerChangeWorldEvent (cancellable) before the cross-dimension
  transfer in World::respawn_player; a plugin may redirect new_world,
  override position/yaw/pitch, or cancel to keep the player in the
  current world.
- Use the safe transfer ordering (remove_player -> unload_watched_chunks
  -> change_world -> set_world -> publish) so no observer sees the player
  in a world whose chunk manager doesn't match, and update the entity's
  world reference (set_world) to fix the latent stale-world bug.
- When cancelled or the target world can't be resolved, fall back to the
  current world's spawn.
- The non-cancellable PlayerRespawnEvent (#2296) now fires after this
  event and observes the resolved world automatically; document the
  ordering and mutation-vs-cancellation semantics on both events.
2026-07-04 12:21:46 +02:00