Commit Graph

171 Commits

Author SHA1 Message Date
Mcxiaocaibug
bff591e424 feat: emit lectern redstone signals and add the lectern screen (#2759)
Implements the missing redstone half of the lectern:
- page turns pulse the powered state for 2 game ticks (vanilla parity),
  strongly powering the block below and playing the page-turn event
- placing/taking a book resets the pulse and notifies neighbors
- comparator output now uses the vanilla formula
  floor(page / (pageCount - 1) * 14) + 1 instead of a scaled variant
- adds the lectern screen handler (page buttons, jump-to-page and
  take-book) so the pulse can actually be triggered by players; the
  current page is synced as container property 0
- using a lectern with a book now opens the reading screen instead of
  silently deleting the book

Co-authored-by: Mcxiaocaibug <Mcxiaocaibug@users.noreply.github.com>
2026-08-05 08:56:31 +02:00
yhypno
bd7a1a2126 fix(inventory): enchanting table offers and lapis validation (#2374)
* fix(inventory): match applied enchantments with table preview

* fix(inventory): require lapis for enchanting purchases
2026-07-30 23:08:38 -04: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
dongzh1
ae1813735b fix(inventory): guard Swap slot click against negative slot index (#2313)
The `Swap` branch of `internal_on_slot_click` indexed
`self.get_behaviour().slots[slot_index as usize]` without first checking
`slot_index >= 0`, unlike every sibling branch (Pickup, QuickMove, Throw,
Clone, QuickCraft) which all guard with `if slot_index < 0 { return; }`.

`slot_index` originates from the client `SClickSlot` packet (`i16` slot
field, widened to `i32`). The upstream validation in `Player::on_slot_click`
relies on `ScreenHandler::is_slot_valid`, whose check
`slot == -1 || slot == -999 || slot < slots.len() as i32` returns `true`
for ANY negative slot (a negative value is always `< slots.len()`), so
negative indices are not filtered out before reaching the handler. A
crafted Swap packet with a negative slot (e.g. -5) and a hotbar button in
`0..9` (or 40) therefore evaluated `slots[(-5) as usize]`, an enormous
index, causing an out-of-bounds Vec panic and crashing the server.

Add the same `if slot_index < 0 { return; }` guard at the top of the Swap
branch, matching the sibling branches exactly. Minimal, low-risk: legitimate
Swap clicks always carry a non-negative container slot, so behaviour is
unchanged for valid input.
2026-07-01 13:43:54 +02:00
BitForge
785de6d644 fix(inventory): prevent shield self-deadlock in prepare_hand_item_for_use (#2295)
When a player right-clicks with a shield already in the off-hand,
`prepare_hand_item_for_use` locks the ItemStack Mutex via `held`,
then tries to lock the same Mutex again through `get_or_insert`.
Tokio's Mutex is not reentrant, causing a permanent deadlock that
crashes the server 5 seconds later when the tick loop times out.

Add `PlayerInventory::is_already_equipped()` which uses Arc::ptr_eq
to detect when the item is already in the target slot, and skip the
redundant equip logic before any lock is attempted.

Closes #2288
2026-06-25 19:36:30 +02:00
Alexander Medvedev
5f60d23804 feat: villager Professions 2026-06-21 21:54:10 +02:00
Alexander Medvedev
68bae5899e feat: add stats 2026-06-12 20:55:29 +02:00
Alexander Medvedev
bd544271e2 feat: more loot table work 2026-05-22 22:23:47 +02:00
Alexander Medvedev
e707b31752 ci: remove unused dep 2026-05-16 21:38:37 +02:00
Alexander Medvedev
e2ff17d6f0 feat(plugin-api): allow to register custom recipies 2026-05-16 20:56:29 +02:00
Alexander Medvedev
4e3268b140 feat: add stonecutter 2026-05-07 22:02:52 +02:00
Alexander Medvedev
5c90387b02 refactor: move block entities from pumpkin-world -> pumpkin 2026-05-07 19:35:17 +02:00
Alexander Medvedev
63d39f46d4 feat: add enchanting table 2026-05-06 22:29:29 +02:00
Alexander Medvedev
8060283970 feat: add Anvil 2026-05-01 16:30:14 +02:00
Alexander Medvedev
fdd2684432 feat: add Villager trading
currently job selection is missing
2026-05-01 14:34:05 +02:00
Alexander Medvedev
6ea869c4a0 fix: entity spawn height 2026-04-26 15:59:52 +02:00
Alexander Medvedev
7f21c3cfe2 feat(plugin-api): add some more events 2026-04-26 13:49:13 +02:00
Illyrius
2751c42bb7 docs: pumpkin-inventory (#1993)
* init

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

* fixed linting

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

* fix clippy

Signed-off-by: Illyrius <FitimQ@live.nl>

---------

Signed-off-by: illyrius666 <28700752+illyrius666@users.noreply.github.com>
Signed-off-by: Illyrius <FitimQ@live.nl>
Co-authored-by: Illyrius <FitimQ@live.nl>
2026-04-09 20:48:19 +02:00
Alexander Medvedev
8a6698cd21 fix: 26.1 attack packet 2026-04-02 20:55:03 +02:00
kedor
a11f40a403 chore: move ItemStack from pumpkin_world to pumpkin_data (#1944) 2026-03-31 10:08:41 +02:00
HairlessVillager
974bdd98a6 chore: add license to Cargo.toml files (#1927) 2026-03-28 15:47:15 +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
Rotstein
bf52dabd77 feat: add Vanilla powder snow behaviour (#1743)
* Powder snow now has vanilla behavior

* Fix rustfmt in player freeze tick update

* Fix right click armor equip slot; powder snow vanilla

* Apply rustfmt to powder snow changes

* Fix clippy warnings in powder snow changes

* Fix clippy pedantic warnings
2026-03-03 19:16:04 +01:00
AnthonyDuong1
e75e63a3de fix: double-click behavior on empty slot after placing or dragging items in chests (#1595) 2026-02-18 13:12:28 +00:00
AnthonyDuong1
854d9cebf7 fix: creative drag of items and middle click in chests (#1585)
* fix: creative drag of items and middle click in chests should match vanilla now

* fix formatting check

* readded the min function
2026-02-17 01:31:10 +00:00
FabseGP
24ea53b2e9 feat: replace log with tracing (#1460)
* feat: replace log with tracing

* chore: clippy

* fix: revert replacing println!-calls

* fix: await async construct

* fix: lints + incorrect await

* fix: each plugin spawns their own tracing-subscriber

* fix: replace info! with println for commands

* chore: remove env_logger

* fix: added TODO about structured logging
2026-02-13 21:10:13 +00:00
Purdze
6649d80ca7 feat: add furnace xp system (#1436)
* fix: award xp when taking items from furnace output slot

adds experience tracking to all furnace-like block entities (furnace,
blast furnace, smoker). experience is accumulated when items are smelted
and awarded to the player when they extract items from the output slot.

- add ExperienceContainer trait for dyn-compatible xp extraction
- add experience_held field to furnace block entities (fixed-point)
- add FurnaceOutputSlot that awards xp on item take
- add award_experience method to InventoryPlayer trait
- add to_experience_container method to BlockEntity trait

closes #1432

* fix: use recipesused nbt format for furnace xp

- add recipe_id field to CookingRecipe struct
- track recipes used instead of raw xp
- spawn xp orbs on furnace break and hopper extraction
- add get_recipe_experience function to look up xp by recipe id

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2026-02-04 18:07:13 +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
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
Zimbobub
e4cb225df9 fix: Client desync on container close (#1295)
* Fix incorrect cliend update packet on container close

* formatting
2026-01-14 18:26:02 +01:00
Clicks
70b3132396 chore: Remove Redundant Clippy Allows (#1247)
* switch to btreemap to comply with lint

* amplifier i32 -> u8

* switch allow to expect lint

* remove many many unnecessary clippy lints

* dont use expect inside quotes
2025-12-30 12:16:31 +01:00
Clicks
24fff00425 Make All Dependencies Workspace Dependencies (#1245) 2025-12-30 12:13:51 +01:00
AyaSanae
10f19a93da feat: Implement blast furnace and smoker (#1253)
* implment blasting_furnace

* add smoker block entity

* add smoker block

* refactor furnace_block_entity using macros

* fix fmt
2025-12-30 12:10:32 +01:00
Alexander Medvedev
92fe87e921 smaller structure gen preparations 2025-12-08 20:52:03 +01:00
Alexander Medvedev
3829850607 removed some clones
fix: https://github.com/Pumpkin-MC/Pumpkin/issues/1226
2025-12-07 22:43:26 +01:00
Alexander Medvedev
70b75a0ac5 remove async-trait entirely 2025-12-04 23:50:00 +01:00
Alexander Medvedev
ae751f3a83 remove #[async_trait] from many many places
Compile time got improved by 77% (including last commit)
2025-12-04 13:57:03 +01:00
unschlagbar
e154b394af update to bedrock 1.21.111 (#1193) 2025-10-15 09:52:30 +02:00
Rafael
cc076f098d feat: Implement EnderChest (#1163)
* feat: Implement ender chest

* fix: Register block entity

* fix: Fix formatting
2025-10-10 21:54:03 +02:00
C0j23T
09f96cc705 Implement equipping armor and resolve difficulty deadlock (#1170)
* feat: implement equipping armour for players

* fix: resolve deadlock when updating world difficulty

* fix: typo && forgot to clippy

* fix: fmt
2025-09-14 09:56:08 +02:00
Alexander Medvedev
94bdae9684 feat: make totems work 2025-08-21 16:43:13 +02:00
Rafael
a2289992a1 feat: Implement ViewerCountManager for block entities (#1092)
* feat: Add simple viewer counter

* feat: More work on the viewer counter

* feat: Add barrel visuals

* fix: Sound

* feat: Implement chest screen handler

* fix: Inventory ordering

* feat: Implement chest animation

* feat: Implement shulker animation

* fix: Only send updates if the viewer count changes
2025-08-01 10:35:11 +02:00
Liyan Zhao
43534cbffd Add EquippableComponent; Handle armour items more elegantly (#1052)
* Partially revert #1008

commit a378e48a04

* feat: equippable component

* chore

* chore

* fix

* fix

* fix: slot & equip_sound

* fix: reg
2025-07-30 22:31:13 +02:00
spr-equinox
8ce65cc42d Refactor ItemStack to Support Vanilla-Like Data Components (#1059)
* improve tag v1

* improve tag v2

* fix typo and make BlockPredicate better

* improve get state from state id

* impl DataComponent

* make tag pub

* make component work

* apply clippy

* apply clippy

* remove unused crate

* apply to itemstack and no lifetime mark anymore

* Update tag.rs

* use Cow

* remove unnecessary lazy_static and Cow

* Update mod.rs

* Update mod.rs

* make DataComponent dyn

* remove unused crate

* fix error

* Update Cargo.toml

* Update Cargo.lock

* fix

* Update composter.rs

* update rust-version, remove unused crate, and merge

* Update furnace.rs
2025-07-28 12:24:40 +02:00
AyaSanae
f80650c36c Implement Furnace (#1058)
* fix: the fields of the struct CookingRecipe should be pub.

* Add furnace screen handler and slot

* Add furnace block entity

* Add furnace block

* fix bug

* add client-side sync

* fix furnace facing

* remove unused statements

* fix spelling error

* Listening for property changes and syncing them to the client-side.

* fix furnace lit state

* fix fuel should be placed at fuel slot in quick_move()

* fix spelling error

* remove unused comment

* fix: only one listener is needed.

* pumpkin-data: add recipe_remainder

* Set the bottom item as the remainder if it has one

* pumpkin-data && furnace:fix spelling error

* fix building error

* use_with_item is the same as normal_use

* fix quick_move()

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-07-28 10:10:17 +02:00
spr-equinox
15c9aa4ac8 Improve tags (#1057)
* improve tag v1

* improve tag v2

* fix typo and make BlockPredicate better

* improve get state from state id

* make tag pub

* Update tag.rs

* fix error

* Update hopper.rs

* Update hopper.rs
2025-07-27 21:34:18 +02:00
spr-equinox
8495a009b5 support Hopper, remove dropper todo, and support shulker box basically (#1064)
* support Hopper, remove dropper todo, and support shulker box basically

* typo

* fix dead lock

* Update hopper.rs

* Update mod.rs

* Update hopper.rs

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-07-27 11:40:25 +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