* 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
* 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
* 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
* 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.
* 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.
* 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
* 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
* 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
* 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
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.
* 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>
* 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>