Commit Graph

2040 Commits

Author SHA1 Message Date
kedor
a11f40a403 chore: move ItemStack from pumpkin_world to pumpkin_data (#1944) 2026-03-31 10:08:41 +02:00
Alexander Medvedev
a111cf3f20 fix: < 26.1 Support 2026-03-31 09:44:08 +02:00
RB007
3c43f9715e fix: end portal crash and island setup (#1945)
* fix: use noise_sampler

* fix: end portal teleportation and generation

* feature: dragon fight start (improved main end island)
2026-03-31 09:21:11 +02:00
Laptop59
5a0db0f50d chore(command): reimplemented /difficulty (#1924) 2026-03-30 20:51:05 +02:00
Exteron
637019dec8 chore: Skip deactivated plugins during server startup (#1929) (#1937)
When plugins are disabled via smashed pumpkin, they receive a
.deactivated suffix. The server was not recognizing this convention
and logged errors for each disabled plugin on startup. Skip files
with the .deactivated extension in load_plugins() so disabled
plugins are silently ignored.
2026-03-30 19:31:49 +02:00
ChocoDev
bb5033046b fix: offline player support for some command with usercache (#1793)
* add gameprofile that support offline player

* clippy

* bigass refactor select_players() and select_entities() + usercache.json

* formating

* enhance usercache.json

* better cursor on dispatch

* Update dependencies in Cargo.lock

Signed-off-by: ChocoDev <100467857+chocodev11@users.noreply.github.com>

* using chrono instead self-write

* remove unnecessary parse

* clippy

---------

Signed-off-by: ChocoDev <100467857+chocodev11@users.noreply.github.com>
Co-authored-by: chocodev11 <chocodev11@users.noreply.github.com>
2026-03-30 19:25:45 +02:00
Musawer
3613440515 fix: Preserve lit state when adding candles to an already lit candle (#1853) (#1936)
* Fix: Preserve lit state when adding candles to an already lit candle (#1853)

Fix candle blocks losing their lit state when adding another candle.

Signed-off-by: Musawer <118316797+TheRealMusawer@users.noreply.github.com>

* remove unused line

Signed-off-by: Musawer <118316797+TheRealMusawer@users.noreply.github.com>

---------

Signed-off-by: Musawer <118316797+TheRealMusawer@users.noreply.github.com>
2026-03-30 18:50:01 +02:00
SomeYellowGuy
ecd0a4c8f2 feat(command): add time argument (#1941)
* implemented time argument type

* fixed formatting and used clippy

* fixed translation for `TICK_COUNT_TOO_LOW_ERROR_TYPE` error type
2026-03-30 18:45:00 +02:00
Alexander Medvedev
d7a0d081a7 fix: Ci 2
https://tenor.com/view/dog-meme-relaxed-tsgotmedemuring-cruz-gif-3966539869708480474
2026-03-30 18:29:07 +02:00
Alexander Medvedev
57dddb1dbc fix: CI
atleast for now
2026-03-30 18:22:29 +02:00
Mrpupsik228
04deac6c5c fix(entity): You can now land while flying on elytra (#1928) 2026-03-30 16:56:55 +02:00
Greened
b06c6b13b0 feat: Weeping Vines block implementation (#1892)
* feat: Weeping Vines block

* chore: fix clippy warning

---------

Signed-off-by: Greened <108997309+GreenedDev@users.noreply.github.com>
2026-03-30 16:54:33 +02:00
SomeYellowGuy
6ac9b31f78 feat(codec): add either codecs (#1900)
* initial commit

# Conflicts:
#	Cargo.toml

# 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 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 invalid nbt tag for test

* reverted wrapping the tags for heterogeneous elements

* fixed a few more issues

* initial commit

# Conflicts:
#	Cargo.toml

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

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

* added either codecs and either map codecs

* added a test and extra either methods

* added extra assertion

* removed this crate's `either` module in favor of the `either` crate

* fixed rebase

* fixed Cargo.lock

* removed old folder

* removed `DataResult` change
2026-03-30 16:52:57 +02:00
Daniel Wang
7c4f3b7550 feat(wasm-api): expand player WIT API (#1921)
* feat(wasm-api): port i18n module for plugin and host use

* feat(wasm-api): expand player WIT API

* feat(wit): make player APIs fallible and propagate errors

* feat(wit): add player info, inventory, and status queries

* feat(wit): add player permission and display name APIs
2026-03-30 16:51:48 +02:00
Alexander Medvedev
0635b048b5 Port to 26.1 2026-03-30 16:43:15 +02:00
HairlessVillager
974bdd98a6 chore: add license to Cargo.toml files (#1927) 2026-03-28 15:47:15 +01:00
Batuhan
49b3d251ce fix: use translation constants instead of string literals (#1912) 2026-03-27 12:43:45 +01:00
ChocoDev
8f05c59c3b chore: add PR instruction for ai (#1915)
Co-authored-by: chocodev11 <chocodev11@users.noreply.github.com>
2026-03-27 12:41:07 +01:00
SomeYellowGuy
d91076380e feat(command): reimplement /stop (#1918)
* reimplemented /stop

# Conflicts:
#	pumpkin/src/command/commands/mod.rs

* fixed formatting

* updated command to use `send_feedback`

* fixed formatting

* optimized imports

* fixed formatting
2026-03-27 12:39:28 +01:00
yunuservices
0855dbd163 feat(wasm-api): port player egg throw event (#1899) 2026-03-27 12:06:20 +01:00
SomeYellowGuy
a6efe7ec7a feat(command): reimplement /seed (#1919)
* reimplemented /seed

* used `send_feedback` instead
2026-03-26 22:45:33 +01:00
Alexander Medvedev
f8596dcaf8 Revert "feat: Add support for multiple CPU targets in Rust workflow (#1707)"
This reverts commit 83199db6a1.
2026-03-25 15:38:12 +01:00
Illyrius
308cc943c1 feat(api): added missing wit defined events (#1913)
* init

Signed-off-by: illyrius666 <28700752+illyrius666@users.noreply.github.com>

* Clean up comments in events.rs

Removed commented sections for player and server events.

Signed-off-by: Illyrius <28700752+illyrius666@users.noreply.github.com>

* fmt

Signed-off-by: illyrius666 <28700752+illyrius666@users.noreply.github.com>

* seperated the events into their own files and added docs for each

Signed-off-by: illyrius666 <28700752+illyrius666@users.noreply.github.com>

* added/improved missing docs in the other files in the api

Signed-off-by: illyrius666 <28700752+illyrius666@users.noreply.github.com>

* Update pumpkin-plugin-api/Cargo.toml

Signed-off-by: Illyrius <28700752+illyrius666@users.noreply.github.com>

---------

Signed-off-by: illyrius666 <28700752+illyrius666@users.noreply.github.com>
Signed-off-by: Illyrius <28700752+illyrius666@users.noreply.github.com>
2026-03-25 15:25:36 +01:00
Daniel Wang
7a57b026a0 feat(wasm-api): port i18n module for plugin and host use (#1898) 2026-03-25 15:20:26 +01:00
Missing_Love
83199db6a1 feat: Add support for multiple CPU targets in Rust workflow (#1707)
* Enhance CI with x86-64-v2 build and release notes

Add build job for x86-64-v2 architecture and update release process.

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

* Enhance CI workflow for x86-64 architecture support

Updated CI workflow to support additional x86-64 architectures and removed deprecated build job for x86-64-v2.

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

* Refactor Rust CI workflow with new build steps

Refactor CI workflow to simplify architecture and improve clarity. Added new build steps for standard, x86-64-v2, and x86-64-v3 releases.

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

* add macOS Intel x86-64-v3

* Add x86-64-v4

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

* treatment for OCD

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

* 0

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

* rollback

Removed x86-64-v4 architecture from the workflow and adjusted related steps for x86-64-v2 and x86-64-v3. Updated comments and artifact names accordingly.

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

* Refactor CI workflow for Rust project

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

* Refactor CI workflow for Rust with additional checks

Updated CI workflow for Rust project to include formatting checks, unused dependency detection, and enhanced build and test steps across multiple platforms and architectures.

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

* Update GitHub Actions workflow for Rust project

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

* Upgrade checkout action from v4 to v6

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

* Update rust.yml

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

* Update GitHub Actions workflow for Rust

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

* Update install-action version in rust.yml

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

* Update rust.yml

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

---------

Signed-off-by: Missing_Love <42416195+Q2297045667@users.noreply.github.com>
2026-03-25 14:39:24 +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
Grooble
c6bf417773 fix: make some gamerules take effect, feat: ItemModel data components (#1849)
* feat: add ItemModel data component

* fix: advance_time gamerule now stops sun moving clientside

* fix(mob spawning): respect gamerules & difficulty

* feat(ItemModel): read from nbt

* feat: add Consumable data component, doesn't support consume effects yet

* feat(DataComponents): add Consumable consume effects & add Equippable

* fix: SoundEvent deserialization

* fix: duplicate import

* fix: rebase issues

* fix: SoundEvent deserialization

* fix: format and spelling
2026-03-24 08:56:49 +01:00
Jonas
00a496ddb7 feat: Added BellBlock and BellBlockEntity (#1542)
* Added BellBlock and BellBlockEntity

Plays sound, works with redstone (update_neighbours) and placement is
correct. Animation still missing (emit for game event/block update
packet not sent?)

* Added raiders_hear_bell function

Currently only returns dummy value

* Fix clippy errors

* cargo fmt

* Added placement validation and more

- Added placement validation
- removed reverse_horizontal_facing (now using .opposite())
- now removing block entity on block break

* Add Block Entity to mod.rs

* cargo fmt

* Small improvements

* fix cargo fmt

---------

Signed-off-by: Jonas <158217095+R40fendt@users.noreply.github.com>
2026-03-23 18:48:25 +01:00
Greened
c76914b46c fix: Seagrass blocks disappearing (#1857)
* fix: wrong seagrass block checks

* chore: split seagrasses into separate files.

* chore: make clippy happy

---------

Signed-off-by: Greened <108997309+GreenedDev@users.noreply.github.com>
2026-03-23 18:45:19 +01:00
yunuservices
5805eecd94 feat(wasm-api): port block grow event (#1895) 2026-03-23 18:43:15 +01:00
Andrei Șugubete
0355d00897 perf(network): migrate world broadcasts to O(V) chunk-based subscriptions (#1883)
* perf(network): migrate world broadcasts to O(V) chunk-based subscriptions

* Introduced `broadcast_to_chunk` and `broadcast_to_chunk_except` in `World` to utilize Chebyshev distance math for O(V) packet routing.
* Migrated block updates, block entity data, and synced block events to strictly broadcast to players with the target chunk loaded.
* Optimized entity network overhead by chunk-filtering movement, rotation, metadata, spawning, and equipment packets.
* Refactored sound events to use volume-aware, chunk-filtered loops instead of global server iterations.
* Ensured all edge cases, including passenger mounting/dismounting, player bed animations, and teleportation, utilize localized broadcasts.

* perf(network): optimize chunk broadcasts and fix bedrock exclusions

- Extracted Chebyshev distance math into `is_within_view_distance` helper
- Added `#[inline]` and `#[must_use]` attributes to the distance helper
- Fixed Bedrock packet echo bug by standardizing exclusions to use `entity_uuid` instead of `gameprofile.id`
- Removed dead metadata serialization code in `send_meta_data`
- Standardized sound attenuation math across audio events
- Cleaned up leftover developer TODO comments

* fix(world): leftover dev comment + leftover unmigrated bedrock exclusion
2026-03-23 18:40:23 +01:00
Erkilana
9339c1c94c fix: Update server port in egg-pumpkin configuration (#1891)
{{server.build.default.port}} works more stable than {{server.allocations.default.port}}

Signed-off-by: Erkilana <199792062+Erkilana@users.noreply.github.com>
2026-03-22 10:44:32 +01:00
yunuservices
4f1279810e feat(wasm-api): port block place event (#1896) 2026-03-21 22:42:56 +01:00
yunuservices
2efa81451a feat(wasm-api): port block redstone event (#1881)
* feat(wasm-api): port block redstone event

* fix(wasm-api): satisfy clippy for block redstone batch

* style(wasm-api): format block redstone batch
2026-03-21 15:36:48 +01:00
ChocoDev
70986fced4 fix: unload chunk check for command has pos agrument (#1740)
* more pos argument check for command

* allow local offset and rotate

* clippy

* format

* duplicate import

---------

Signed-off-by: ChocoDev <100467857+chocodev11@users.noreply.github.com>
Co-authored-by: chocodev11 <chocodev11@users.noreply.github.com>
2026-03-20 15:32:15 +01:00
RB007
655e69fc66 feat: vegetation patch features (#1708)
* feat: vegetation features

* refactor: surface_direction helpers

* fix: several issues

* refactor: add with_waterlogged helper to Block/BlockState

* refactor: small changes and added helpful comments
2026-03-20 09:43:28 +01:00
ChocoDev
f2d7a1a332 perf: skip random tick on none ticking block (#1856)
* skip random tick

* skip tick out of loop and better randomness

* min y

* formating

* properly ticking block and fluid check

* clippy

* fix malformed NBT and i64 overflow

* formating

---------

Co-authored-by: chocodev11 <chocodev11@users.noreply.github.com>
2026-03-20 09:42:47 +01:00
yunuservices
babb191e66 feat(wasm-api): port basic block events (#1889)
* feat(wasm-api): port basic block events

* fix(wasm-api): align stacked event ports with clippy

* style(wasm-api): format basic block event batch
2026-03-20 09:37:56 +01:00
RB007
b1e25f0db9 feat: potion use and brewing (#1670)
* feat: potions and brewing

* fix: splash water puts out fire

* fix: saving

* fix: brew sound

* chore: fixes, formatting, and clippy
2026-03-19 17:40:09 +01:00
Laptop59
0b15f29f90 feat: integrate command dispatchers + reimplement /help (#1700)
* initial commit

* added more functions

* ported /help command to new dispatcher

* /? shows similar usage to /help instead of `-> help`

* fixed /help bugs

* change min limit in `read_boxed_slice` to 0 so that empty command (`/`) doesn't cause an error

* fixed clippy errors

* formatted

* added convenience for fetching world and server from context

* fixed `min` mistakes to `max` instead

* changed node to now store a list of predicates as its requirement (permission included)

* added easier way to register aliases

* prevent unauthorized usage of command when aliased

* added `TextComponent::empty()` to create empty text only for the purpose of adding children to it

* added more documentation

* make argument more obvious

* fixed some issues (not done yet)

* added more clarification in comments & docs

* fixed fn docs

* fixed order of arguments in translated error

---------

Signed-off-by: Alexander Medvedev <lilalexmed@proton.me>
Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2026-03-19 17:17:57 +01:00
yunuservices
a5908c04fd feat(wasm-api): port world core events (#1880)
* feat(wasm-api): port world core events

# Conflicts:
#	pumpkin/src/plugin/loader/wasm/wasm_host/wit/v0_1_0/context.rs

* fix(wasm-api): satisfy clippy for world event batch

* style(wasm-api): format world event registration
2026-03-18 20:29:32 +01:00
yunuservices
581430aeff feat(wasm-api): port player and server core events (#1860)
* feat(wasm-api): port player and server core events

* fix(wasm-api): satisfy clippy for player event batch
2026-03-18 12:32:16 +01:00
Andrei Șugubete
4e4b5202b4 fix: packet spam and mob leaks (#1865)
* feat: add mob ai throttling

* chore: formating

* fix: prevent entity leak and server timeout during death animation

* fix: vanilla parity + optimize entity position and rotation updates to reduce unnecessary broadcasts

* chore: formatting
2026-03-18 12:31:26 +01:00
RB007
feff36e488 fix: fungus and sprout placement (#1877) 2026-03-18 08:12:02 +01:00
RB007
76e62cd739 feat: glowstone feature (#1878) 2026-03-18 08:10:52 +01:00
Andrei Șugubete
dc802d374e fix(enderman): remove server-side ambient portal particle generation (#1863) 2026-03-17 01:45:52 -04:00
Illyrius
5dda697c15 docs: docs/pumpkin-codegen (#1826)
* added docs

* some small corrections

* woopsie

* revert back lock changes

Signed-off-by: Illyrius <28700752+illyrius666@users.noreply.github.com>

---------

Signed-off-by: Illyrius <28700752+illyrius666@users.noreply.github.com>
Co-authored-by: Illyrius <FitimQ@live.nl>
2026-03-15 20:48:50 +01:00
Greened
a54728f2be fix: add Kelp block placement/break rules (#1805)
* fix: wrong piston break check

* feat: kelp placement rules and break/place behaviour

* chore: make clippy happy

* fix: breaking kelp now places water instead of air

* chore: make clippy happy

* fix: vanilla parity
2026-03-15 14:19:25 +01:00
Greened
554b3daad9 feat: Implement Stalagmites, Stalactites and Dripstone block (#1824)
* feat: implement Dripstone block, Stalagmites and Stalactites

* feat: implement tip_merge thickness allowing stalagmites and stalactites to be connected. fix: correct placing

* chore: make clippy happy
2026-03-15 14:18:16 +01:00
Andrei Șugubete
a0ff7f46dc feat: Durability Overhaul (#1848)
* feat: broadcast EntityStatus when equipment breaks

Pumpkin did not play any sound or show break particles when a tool or
piece of armour reached zero durability. Vanilla sends a per-slot
EntityStatus packet (47-52, 65, 68) that every nearby client uses to
play the break sound and spawn break particles textured with the item
that just broke.

Changes
-------

player.rs – new damage_item_in_slot(slot, amount) method:
- Generalises the old damage_held_item to cover all EquipmentSlots:
  MainHand, OffHand, Head, Chest, Legs, Feet.
- Resolves the correct PlayerInventory slot index per slot (36-39 for
  armour, 40 for off-hand) consistent with build_equipment_slots().
- Sends the EntityStatus break packet BEFORE clearing the slot so
  clients can use the item texture for break particles.
- Bypasses sync_hand_slot (which only broadcast for hand slots) and
  instead calls enqueue_slot_set_packet + send_equipment_changes
  directly, ensuring armour equipment changes also propagate.
- damage_held_item is kept as a thin convenience wrapper.

apply_mending_from_xp – DRY refactor:
- Replaces three separate candidate-gathering blocks (main hand, off
  hand, armour loop) with a single unified slot_pairs list iterated
  once. Behaviour is identical.

living.rs – damage_armor_items:
- When a player takes hit damage, armour durability is reduced through
  LivingEntity::damage_armor_items, a separate code path from the
  player item-damage methods. This path now also broadcasts the
  EntityStatus break packet when an armour piece's durability hits zero.

entity/mod.rs – shared helper:
- Add equipment_break_status(slot) -> EntityStatus as a #[must_use]
  pub const fn. Eliminates the duplicated slot→status match that would
  otherwise exist in both call sites (player.rs and living.rs).

Tests (16 new)
--------------
- entity::tests::equipment_break_status_maps_all_slots – asserts every
  EquipmentSlot variant (including Body and Saddle) maps to its
  expected EntityStatus break variant.
- item::tests (15 tests) – first unit tests for ItemStack durability
  logic, covering damage_item_with_context (zero/negative amount,
  non-damageable item, unbreakable item, accumulation, stack break at
  max damage, over-damage) and repair_item (zero/negative amount,
  undamaged item, partial repair, cap at current damage, full repair
  clears the Damage component patch entry) and set_damage (negative
  value clamps to zero).

* refactor: use table-driven cases in damage_increases_damage_value test

* chore: make clippy happy

* refactor: the rest of damage and repair tests to use table-driven cases

* feat: broadcast EntityStatus when equipment breaks

- Implement strict packet ordering (EntityStatus before slot sync)
- Add break broadcast in play.rs use_on_block for all tools
- Generalize damage_item_in_slot to support all equipped slots
- Trim PR comments to 1-2 professional lines
- Convert equipment_break_status test to table-driven format
- Ensure vanilla parity per decompiled 1.21.11 EntityEvent mappings

* feat(item): durability overhaul — DamageResult, armor/weapon parity, elytra fix

pumpkin-world
- Add DamageResult enum (Untouched/Damaged/Broken) replacing bool return on
  damage_item_with_context and damage_item
- Elytra clamped at max_damage-1; never deleted from inventory
- Stacked item break correctly returns Broken regardless of remaining count
- Add is_axe/is_pickaxe/is_shovel/is_hoe tag-based predicates to ItemStack
- 21 new unit tests covering all cases (elytra, stacks, Unbreaking, categories)

pumpkin
- Armor damage type filter: bypasses_armor_durability() driven by the
  vanilla minecraft:bypasses_armor data tag (1.21.11); id-based u8 lookup
- Elytra worn in armor slot skipped from hit damage
- Thorns: extra +2 durability cost + 1-4 magic retaliation damage
- Weapon 2-durability cost: axes/pickaxes/shovels/hoes in combat
- Fix armor slot Unbreaking formula (is_armor_slot() gate)
- Fix stacked-item break broadcast (Broken not is_empty())
- Extract combat_weapon_durability_cost as sync fn; reuse existing lock
- 5 forward-compatible TODO one-liners for shield/trident/crossbow/fishing rod/brush

* fix(item): resolve vanilla parity issues in durability and combat tracking

- Move armor durability calculation to pre-absorption damage
- Fix Thorns damage range to uniform float [1.0, 5.0) and correct execution order
- Attribute Thorns damage to victim for correct combat tracking
- Refactor `damage_item` to auto-infer armor via `#minecraft:enchantable/armor`
- Decouple Elytra clamping from generic item damage loop into dedicated methods
- Add TODOs for DAMAGE_RESISTANT, post-attack effects, and data-driven bypasses

Also reformatted long comments to be concise and techincal

* chore: trigger CI rerun

* fix: shears no longer take durability damage when attacking mobs (refactor + codegen to standardize)

Replace hardcoded item-category checks in combat_weapon_durability_cost
with a data-driven lookup of the minecraft:weapon component.

- Add item_damage_per_attack field to WeaponImpl with DataComponentImpl
- Wire WeaponComponent deserialization into pumpkin-codegen item builder
- Regenerate item data so weapon durability values come from items.json
- Items without the Weapon component (e.g. shears) return 0 cost

* chore: retrigger CI

* refactor: Remove Thorns retaliation and trigger mechanics

- Remove Thorns enchantment trigger check and probability
- Remove Thorns extra +2 durability cost on armor
- Remove Thorns retaliation damage to attacker (1-5 magic damage)
- Remove Thorns combat attribution via damage_with_context
- Remove related imports and TODO comments
- Keep source parameter for future compatibility

* fix: glaring issues

- Fix WeaponImpl::read_data to actually read item_damage_per_attack from NBT
  instead of hardcoding 1; custom weapons now load correctly
- Remove unused _source parameter from damage_armor_items signature
- Move is_axe/is_pickaxe/is_shovel/is_hoe behind #[cfg(test)] since they're
  test-only helpers, keeping public API clean

* fix: elytra unbreaking and Pre-absorption Armor Test
Also a comment for clarity

* refactor: remove elytra scope creep: damage handling and related tests

* adjustment: tighten unbreaking test, update comments to be correct

* fix: clamp negative NBT, widen Unbreaking test, document elytra and shield-disable TODOs

* refactor: armor bypass logic: use bitmask, hoist lookups, optimize durability loop

* feat: Remove hardcoded Elytra armor check; use EquippableImpl::damage_on_hurt for data-driven durability logic.

* fix: add bitmask compile-time assert, clarify NBT clamping, document damage_on_hurt logic, rename slot_result, add #[must_use] to damage_item, and fix all unused result warnings.

* fix: clarify stacked item break edge, strengthen bitmask asserts, document NBT error handling, add TODOs for tool break handling and loop short-circuit, remove dead code and trident stub, note TOCTOU, and document test determinism. All tests passing.

* fix: Various

CRITICAL ITEMS:
  * bypasses_armor_durability correctness: Verified by existing test suite
    (validates all 19 bypass types return true, 12 physical types return false).
  * TOCTOU race in attack(): Enhanced documentation with 3 specific mitigation
    options and justification for single-player safety.
  * must_use suppressions: Removed #[must_use] from damage_item; added TODO to
    restore once all DamageResult::Broken handlers implement proper semantics.

SIGNIFICANT ITEMS:
  * DamageResult::Broken semantics: Updated doc comment to clarify that breaking
    always broadcasts correctly—whether consuming a single item or decrementing
    a stack. Callers need not split the enum.
  * Stacked item multi-break behavior: Verified matches vanilla (one break per
    call, never chains). Updated comment to document this as correct behavior,
    not a regression.
  * should_apply_durability_damage_with visibility: Made private to prevent
    incorrect unbreaking formula usage outside durability context.
  * Elytra exemption caching optimization: Added PERF comment noting O(1)
    component lookup is already efficient (max 4/hit). Deferred to dedicated
    caching architecture pass.

MINOR ITEMS:
  * Unbreaking test windows: Tightened from (500–1500) to (865–1135) for ±5σ
    confidence—catches actual formula regressions while remaining statistically
    sound. Updated both tool and armor tests.
  * WeaponImpl NBT error handling: Documented conservative fallback behavior
    (clamp negatives, default missing keys). Added TODO for tracing::warn! at
    higher-level call site.
  * default_item_damage naming: Renamed return_1u32 for consistency and clarity
    in weapon damage context.
  * WeaponImpl Hash collision prevention: Added struct-level NOTE reminding
    developers to update get_hash() if fields are added. Deferred until
    multi-field scenario (currently impossible with one field).

* fix: Resolve duplicate `return_1f32` and restore `#[must_use]` on `damage_item`

- Removed duplicate `return_1f32` function in `pumpkin-codegen/src/item.rs` to fix a compile blocker.
- Restored `#[must_use]` attribute on `damage_item` in `pumpkin-world/src/item/mod.rs` to enforce proper handling of `DamageResult`.
2026-03-15 14:17:18 +01:00