Commit Graph

314 Commits

Author SHA1 Message Date
TNXWasTaken
060c10dfa2 refactor: enchant command code refactor (#2768)
* refactor: enchant command

Removes the only_one var and nested logic

* chore: removed TODO since it is now patched

In commit 938a627 (fix(item): prevent stacking items with different components (#2624)) this is patched since if a item is enchanted it will always have a extra data component which will now be detected and synced
2026-08-05 08:37:15 +02:00
Alexander Medvedev
7c3177b404 feat: some more plugin api functions 2026-08-04 20:54:55 +02:00
Alexander Medvedev
9ececd9eca chore: add more chunk tests 2026-08-04 10:38:27 +02:00
Eshan I.
0b2ed1af38 fix(projectile): preserve arrow payloads (#2710) 2026-08-02 20:08:10 +02:00
Alexander Medvedev
98d4451fc9 chore: some fixes 2026-08-02 10:49:37 +02:00
necko
038d467bfa fix: restore main hand and skin customization metadata across versions (#2630)
* fix(data): map missing main arm and skin tracked IDs for 1.21-1.21.6

* fix(player): send main hand and skin customisation metadata across versions

* fix(data): map missing main arm and skin tracked IDs in source JSON
2026-08-01 23:07:26 -04:00
Jamie Little
75994f3302 feat: /place command (#2473)
* Add /place template command with BlockPlacer trait and tab-completion support

- Add BlockPlacer trait to abstract block placement over ProtoChunk (worldgen)
  and WorldBlockPlacer (live command), used by place_template()
- Implement BlockPlacer for ProtoChunk (pumpkin-world) and WorldBlockPlacer
  (pumpkin crate)
- Add World::queue_block_updates() to insert into unsent_block_changes
  without triggering full set_block_state callbacks
- Generate _generated_all_template_names() at build time from structure
  assets for use in tab-completion suggestions
- Add TemplateNameArgumentType for the new command system with
  list_suggestions() using all_template_names()
- Implement /place template <template> [pos] in the new command system
  (CommandDispatcher, CommandExecutor, ArgumentBuilder)
- Fix borrow-across-await: clone template name to owned String early

* feat: add /place structure and /place jigsaw commands

Adds /place structure <id> [pos] for all structure types with two placement paths:
- Jigsaw structures (ancient_city, bastion_remnant, etc.): fast path using
  JigsawPlacement::add_pieces directly at the target position
- Non-jigsaw structures (desert_pyramid, end_city, etc.): generate pieces
  via dispatch, place into synthetic ProtoChunks with pre-seeded heightmaps
  and a stone floor so pieces can detect terrain, then delta-apply only
  changed blocks to the world via WorldBlockPlacer

Also adds /place jigsaw <pool> <target> <depth> [pos] for manual jigsaw
template placement.

Architecture:
- generate_structure_position() extracts the shared generator dispatch
  from try_generate_structure / lazily_generate_structure (both now
  delegate to it, eliminating ~150 lines of duplicated match arms)
- place_pool_element_templates() extracted from PoolElementStructurePiece
  for reuse by the command with WorldBlockPlacer
- StructureKeys gains from_name()/to_name()/all_names() via codegen
- StructureNameArgumentType and PoolNameArgumentType for tab-completion
- flat_ocean_floor_height_map made pub in ProtoChunk for heightmap seeding

* feat: add /place feature command

Adds /place feature <feature> [pos] for placing configured features
at a specific position. Resolves the PlacedFeature name via from_name(),
resolves the inner ConfiguredFeature from PLACED_FEATURES /
CONFIGURED_FEATURES, then calls ConfiguredFeature::generate() directly
at the target position -- skipping placement modifiers so the feature
appears exactly where specified.

Also adds /place structure improvements:
- Synthetic chunk terrain fill: stone below surface + grass on top, so
  pieces that carve through solid terrain (stronghold corridors, etc.)
  find material to work with. Snapshot/delta ensures only structure
  blocks reach the world.
- Shared snapshot_blocks() and apply_delta() helpers eliminate ~30 lines
  of duplicated diff logic between structure and feature paths.
- ground_y() and chunk_population_seed() helpers replace magic numbers.
- Structure success message now reports the structure name instead of
  the piece count.

Infrastructure:
- PlacedFeature::all_names() generated via pumpkin-codegen for
  tab-completion suggestions in PlacedFeatureNameArgumentType.
- GenerationCache trait implemented for ProtoChunk (single-chunk
  delegation) so ConfiguredFeature::generate() works without the full
  chunk-generation cache system.
- flat_ocean_floor_height_map made pub in ProtoChunk for heightmap
  seeding.
- configured_features and feature modules made pub for access from
  the command crate.

* fix(command): use world settings for place

* docs(place): clarify synthetic terrain delta behavior
2026-07-31 11:45:23 +02:00
Colin
938a627218 fix(item): prevent stacking items with different components (#2624) 2026-07-31 01:22:31 -04:00
Roman Chebykin
4c0a40499e fix: use wolf-specific entity metadata tracker id (#2407) 2026-07-30 23:53:17 -04:00
TheDarkSword
2d7cf40761 feat: persist item components that were only set at runtime (#2426)
* feat: persist runtime-set item components

They serialized to nothing before; give the remaining ones a read/write so
their data survives a save/load. Predicate-based ones keep raw NBT for now.

* refactor: remove Cow where unnecessary

Copied it over from ItemModelImpl, but it makes no sense for base_color,
note_block_sound and tooltip_style: they're only ever built at runtime, so a
plain String is enough.
2026-07-25 09:29:46 +02:00
Megalith
f676bdd222 fix(protocol): remap particle IDs for older clients (#2451)
* feat(protocol): generate particle ID remap tables

Generate version-specific particle registry mappings from the existing ViaBackwards data for every supported Java protocol version.\n\nExpose the generated remapper through pumpkin-data and enable it for pumpkin-protocol so packet serializers can translate current registry IDs for older clients.

* fix(protocol): remap explosion particles for older clients

Translate the explosion particle registry ID for each client's negotiated Java version before serializing the explode packet.\n\nWithout this remap, 1.21.11 interpreted the 26.2 explosion-emitter ID as falling dust, consumed the following bytes as particle data, and disconnected with a decoder exception. Add packet-level coverage for both 1.21.11 and 26.2 encodings.

* fix(protocol): remap particle IDs for older clients

Level-particle packets and particle entity metadata still encoded raw 26.2 registry IDs, causing older clients to decode the wrong particle schema and disconnect. Route every active outbound particle path through the version remapper, preserve metadata payloads, and cover 1.21.11 and 26.2 encodings with regression tests.
2026-07-24 18:14:18 +02:00
Alexander Medvedev
37bed1c8b5 feat(command): add fillbiome command 2026-07-14 19:19:03 +02:00
Alexander Medvedev
486f8d2cfe feat(command): add attributes 2026-07-13 18:43:45 +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
af3376e68e feat: Implement missing data components 2026-07-11 11:04:51 +02:00
Alexander Medvedev
9eab7581fd feat: Implement Profile data component 2026-07-10 18:16:30 +02:00
Alexander Medvedev
47fe060665 fix: rust 1.97 lints 2026-07-09 20:39:01 +02:00
Alexander Medvedev
339d9dde5b feat: add bedrock biome mappings 2026-07-08 17:30:55 +02:00
Alexander Medvedev
44fd621294 fix: bedrock block mappings 2026-07-06 21:49:42 +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
Red
28d6450426 fix: Made (CUSTOM_)NAME_VISIBLE work across versions (#2332) 2026-07-04 12:14:29 +02:00
Niclas
0800ed8878 feat(plugin-api): add namespaced custom item data (#2324)
* feat(plugin-api): add namespaced custom item data

* modified: pumpkin-plugin-wit

* feat(plugin-api): add NBT custom item data

* fix(plugin-api): satisfy clippy for NBT tree conversion

* feat(plugin-api): add NBT custom item data

* test(plugin-api): use neutral custom data fixtures

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2026-07-04 09:50:06 +02:00
Alexander Medvedev
a9f69fea01 chore: enforce clippy lints in pumpkin-world 2026-07-03 18:51:47 +02:00
PigTurtle
7bfc6a6737 refactor(data) BlockId and BlockStateId wrapper types (#2328)
* refactor: less manual BlockMetadata impls

* refactor: added BlockId type

BlockId is a wrapper for u16: it is valid for any u16 that is the id of a Block.
- Changed the Block.id field type to BlockId
- added named BlockId constants
- BlockMetadata::ids() now returns Box<[BlockId]>
- adjusted pumpkin-macros to use BlockId constants
- fixed some methods that were comparing blockstate ids or item ids (u16) against block ids (previously u16)

TODO: check if unsafe blocks can be removed; The compiler might understand that BlockId is always a valid index into mappings::TYPE_FROM_RAW_ID

* refactor: added BlockStateId type

A BlockStateId is a safe wrapper around the numerical index of a BlockState in pumpkin-data. They help avoiding validity checks (outside of IO and, currently, plugins), and make it easier for other contributors to reason about what they're comparing; BlockStateIds, BlockIds or Item ids (still u16).
pumpkin-data::BlockStateId replaces RawBlockState and BlockStateId from pumpkin-world.

- added the BlockStateId wrapper type
- made (almost; plugins) every function interacting with block states or block state ids use the wrapper type
- changed codegen logic to create/work with BlockStateIds
- made ChunkPalette parsing check BlockStateId validity (pumpkin-world::chunk::format::ChunkSectionBlockStates)

TODO: check if unsafe blocks can be removed; The compiler might understand that BlockStateId is always a valid index into mappings::BLOCK_ID_FROM_STATE_ID and mappings::STATE_FROM_STATE_ID

* refactor: imports
changed every use pumpkin_world::BlockStateId to pumpkin_data::BlockStateId

* refactor: Block- & BlockStateId

finishing touches;
- rebased on latest mater
- ensure there are no bound checks on Block(State)Id conversions, making them extremely cheap
  - this required unsafe std::hint::assert_unchecked annotations because the compiler is (occasionally) stupid
  - on debug builds the bound checks still exist because of ub_checks (see rust unstable book for the feature of the same name)
- added Safety notes to hopefully prevent anyone from enabling the creation of invalid Block(State)Ids in the future

- fixed a benchmark
2026-07-01 18:05:05 +02:00
ZlordHUN
395c4aa36b feat(generation): implement ancient city jigsaw structures (#2329) 2026-07-01 09:11:47 +02:00
ZlordHUN
5eb7cc0e81 feat: Add Overworld Fossil Generation (#2319) 2026-06-30 19:08:44 +02:00
Alexander Medvedev
efa97ad174 fix: https://github.com/Pumpkin-MC/Pumpkin/issues/2283 2026-06-28 16:18:49 +02:00
kedor
0eb7cb1a79 fix(advancement): Fix advancement tree and visibility (#2304)
* fix visibility evaluator

* fix a small issue with the placement of advancement
2026-06-27 20:42:35 +02:00
Alexander Medvedev
03a90a40b1 chore: expand loot table 2026-06-27 10:35:46 +02:00
Alexander Medvedev
322b7af6ae chore: made tnt explosion bit faster 2026-06-26 21:43:00 +02:00
kedor
39596c1b9f feat: Advancement command (#2282)
* starting implementing the advancement command

* implementing globally of the advancement command

* fixing lib.rs

* implementing the new Advancement argument and updating the AdvancementArgs lifetime

* updating wit by adding advancement as command arg

* cargo fmt

* fixing the advancement
hooking the saving
spawn blocking task for IO task

* fixing the update of load to be async

* adding await to load for a test

* fix when save is disable

* making save_enable check first

* fix conflict

* update hash

* fix wit change

* fix column_pos

* adding rust documentation

* typos fix

* removing example

* invalid advancement packet

* fix itemstack parsing to use ItemStack Template ones

* changing enum type from i32 to VarInt

* fix packet by switching up the frame type and flags

* fixing packet and loading of the advancement

* cargo clippy

* update wit
2026-06-26 09:23:54 +02:00
Niclas
2fa7a1829b fix(protocol): encode and decode renamed item names (#2301) 2026-06-25 17:44:11 +02:00
kedor
ed0bf820f7 feat: Add the display position calculation of the advancements (#2256)
* generate the placement of the advancements to be display rightfully for the client

* fix typos with appropriate naming
2026-06-24 18:20:12 +02:00
PigTurtle
eaf1bf3cbe fix(compile-times) replaced const arrays with statics (#2281)
the const [&T; 29873]s for block(state) mapping were being inlined ~300 times just to be deduplicated by LLVM.
They are now statics but are accessed via const fns.
This improves compile times by roughly 12 minutes.
2026-06-24 18:11:37 +02:00
Alexander Medvedev
d0d760de6a fix: bedrock 26.30 2026-06-24 18:03:08 +02:00
Alexander Medvedev
5f60d23804 feat: villager Professions 2026-06-21 21:54:10 +02:00
Alexander Medvedev
23e7992b2d Port to 26.2 2026-06-20 20:07:31 +02:00
Alexander Medvedev
8ce76261ac feat(bedrock): add creative content 2026-06-19 18:52:50 +02:00
kedor
fb3b146fdd feat: add advancement progress (#2261)
* implementing the advancement progress so each advancement has certain requirements to be mark has complete

* cargo fmt

* fix test

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2026-06-15 14:50:12 +02:00
Alexander Medvedev
68bae5899e feat: add stats 2026-06-12 20:55:29 +02:00
kedor
fda79cbc41 feat: adding barebone advancement codegen (#2251)
* implementing the barebone generation of

* cargo fmt

* fixing CI

* fixing unused import

* updating advancements.json file

* remove useless modification for identifier.rs

* fixing CI and typos

* remove bad modification

* update pumkin-plugin-wit
2026-06-12 07:07:10 +02:00
Alexander Medvedev
5b8eab0f56 feat: initial village support 2026-06-10 23:07:10 +02:00
Alexander Medvedev
dd524b6ef9 Revert "feat: implementing the base generation of advancement (#2236)"
This reverts commit decfc460b2.
2026-06-09 16:49:14 +02:00
kedor
decfc460b2 feat: implementing the base generation of advancement (#2236)
* implementing the barebone generation of

* cargo fmt

* fixing CI

* fixing unused import

* updating advancements.json file
2026-06-09 16:00:37 +02:00
Demetrius Kanios
2283048b9b feat(bedrock): Initial inventory setup (#2215)
* Initial asset prep, and `CItemRegistry` packet (vanilla; no Java fixes).

* Fix definition component NBTs.

* Packet fixes and dummy stick.

* Map actual player inventory & add stack UIDs

* Cleanup

* Update assets README
2026-06-07 07:59:06 +02:00
Nicolai Van der Storm
42f6b9ce3f fix(protocol): remap item/block state IDs and entity metadata for older Java clients (#2185)
* fix(protocol): remap item/block state IDs and entity metadata for older Java clients

The server was using reversed ViaVersion mappings (designed for old→new)
to downgrade packets for older clients, which produced ID collisions and
incorrect fallbacks for 26.1-exclusive items and block states.

Changes:
- Replace ViaVersion with ViaBackwards mapping files for item ID and
  block state remapping, which provide the correct new→old direction
  with proper closest-item fallbacks for 26.1-exclusive content
- Fix CSetEntityMetadata to remap ItemStack item IDs per client version,
  matching the version-aware handling already done for inventory packets
  and block state metadata
- Fix TrackedData codegen to resolve Java JSON keys correctly by trying
  both bare names and DATA_-prefixed names, and iterate the union of all
  version keys instead of only the latest (Bedrock) version
- Fix LootCondition::MatchTool to default to false instead of true,
  preventing silk-touch loot table branches from always winning and
  causing ores to drop themselves instead of their correct items

Fixes: block drops invisible on older Java clients
Fixes: leather showing as milk bucket on 1.21.11
Fixes: coal ore dropping coal ore instead of coal
Fixes: 26.1-exclusive blocks showing as wrong blocks on older clients

* fix(codegen): remove #[must_use] from trait impl methods in generated code

* fix(codegen): switch entity, sound and block state remapping to ViaBackwards mappings

---------

Co-authored-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com>
2026-05-27 15:22:17 +02:00
Alexander Medvedev
bd544271e2 feat: more loot table work 2026-05-22 22:23:47 +02:00
Laptop59
fd0539c2a7 feat(command): slot argument types (#2170)
* argument types implemented

* tested parsing in-game and on the terminal

* fixed doc comment
2026-05-22 16:30:26 +02:00
Alexander Medvedev
d47ac2cd51 feat(loot-table): add luck 2026-05-21 22:20:00 +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