0
0
mirror of https://github.com/Pumpkin-MC/Pumpkin synced 2025-04-07 03:34:26 +00:00

96 Commits

Author SHA1 Message Date
4672f61965 feat(player-data): Support saving and loading player NBT Data (#600)
* feat(player-data): Support saving and loading player NBT Data

* fix(player_data): ensure player data is save before continuing

* fix(player_data): implement NBTStorage for hunger data

* feat(player-data): allow setting world name in config

* fix(player-data): use correct method to retrieve world_name

* feat(player-data): move PlayerDataStorage to pumpkin-world

* fix(player-data): ci not building

* fix(player-data): ci not building

* feat(player-data): support inventory saving + review fix

* fix(player-data): forgot the format

* some fixes

* fix clippy

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-03-24 20:55:41 +01:00
93510eecd5 Grammar fixes, terminology change (#633)
* Major grammar sweep

* Remove extra backtick

* Use more specific terminology for chunk data storage

* Forgor to cargofmt

* Fix typo "thier"

* Fix typo "clousures"

* Try new terminology

* Forgor to cargofmt

* Use "Subchunks" instead of "Heterogeneous" for ChunkBlocks variant

* Fix variable name

* Forgor to change comment
2025-03-16 10:40:17 +01:00
eb27cfa16a Generate Blocks and Properties Revamp (#613)
* Add block builder

* Implement loot tables

* chaos snapshot

* LFG

* add oak fence

* lever facing

* Add trait for CardinalDirection

* fix clippy

* fix clippy

* reimplement partial state of loottable

* Implement neighbor block updates

* add oak door

* Fix crash on invalid state

* Fixes

* Add fences

* Add doors

* Refactor how we handle block properties when implemented in many places

* Remove old loot_table, moved to block generation

* Better Block Properties

* Add fence gates

* Update block_grouper and add logs

* Build tags instead and make it easier to define variants of blocks

* Save block states

* Allow nether fences to connect with fence gates

* Move away from hardcoded property names

* Clean up property remaps

* start refactor of blocks

* refactor block compile build

* refactor name map for property groups

* Make it so fences can't connect to the air part of a fence gate

* Use extractor instead of hard coded property names

* to_value and from_value should be stripped of "L" prefix

* Prefix isn't used anymore

* use hashes to verify uniqueness

* Don't declare IntProvider twice and fix typo

* remove some comments that don't apply anymore

* Move loot table so it's shared

* Futureproof Loot Tables

* Implement BlockStateProperty condition for LootTables

* Move experience to pumpkin_utils

* Add is_liquid

---------

Co-authored-by: kralverde <github@email.kralverde.dev>
2025-03-10 18:06:44 +01:00
d518732a76 Fix dupe, double click, and shift click (re-PR) (#591)
* Fix dupe, doubble click and shift click

* Fix inventory desync

* Fix clippy

* refactor magic numbers

* fix clippy

* refactor item logic

* fix inventory

* prefer main inventory over offhand

* Set slot stack to None if empty

* fix container deadlock

* fix linter

* fix lint pt 2

---------

Co-authored-by: 4lve <72332750+4lve@users.noreply.github.com>
Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-03-01 08:09:14 -10:00
1f414f347c Support dropping items out of Inventory 2025-02-20 21:50:59 +01:00
1fb2be46d4 Update to Rust edition 2024 2025-02-20 18:42:20 +01:00
b428fdca1a Proper item stacking (#562)
* Implement item stacking

* Fix clippy issues

* Fix comments

* Some improvements

* Fix item picking bug

* Fully fix pickblock

* Pioritize item held

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-02-20 16:51:48 +01:00
5a77b21d22 Calculate block breaking speed
Also broadcast current held item. The block progress is already correctly displayed and calculated for tools. But for some reason the destruction does not work, looking at vanilla code i have no idea what i'm doing wrong
2025-02-15 22:47:14 +01:00
3d1e0bf35c Check for correct tool when breaking blocks
Also rewrite how we handle tags. Now we can use tags everywhere we want!. I also decided to make the json assets pretty printed which is so much easier to debug, The decision was made because of the reason that we are moving to compile time assets, so pretty printing does not affect performance
2025-02-14 22:47:09 +01:00
8592d095f3 Parse Items at Compile time 2025-02-08 19:23:59 +01:00
2e2fe83720 Add Hunger 2025-02-07 00:22:52 +01:00
466d4380cf Some Refactors 2025-02-01 17:53:41 +01:00
a1f08ebb55 Make item drops work 2025-02-01 14:13:13 +01:00
709d222c23 add basic entity NBT storage 2025-01-19 19:30:32 +01:00
23dbb72bbe rename WorldPosition 2025-01-12 16:45:22 +01:00
1208e67f36 parse screen into enum at compile time 2025-01-10 14:31:43 +01:00
ee485056fb rename pumpkin-core to pumpkin-util
I see that there is an confusion between the pumpkin-core crate,  People often think that this is the most important one
2025-01-09 13:12:57 +01:00
fa07af7308 shorten compile times
but only by a bit :c
2025-01-02 15:47:11 +01:00
6f7433ee68 Added Spawn Egg Functionality (#350)
* Added spawn egg functionality

* Readd changes from before merge

* Added basic attacks on mobs

* Fixed spawn rotation and position

* Updated entities.json

* Fixed entity registry

* Added correct bounding boxes per entity

* Various fixes

* use right data types in entity registry

* fix: clippy

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2024-12-29 22:52:12 +01:00
02cec5873b Add Pick block (Middle Mouse Click) (#418)
* Pick Item Changes

* Changed some logging

* Pick Item working for hotbar slots

* Basic functionality, changes needed to adhere to expected minecraft behaviour

* Clean up code

* Added todo for pick from entity

* Added item swapping

* Swapping and cleanup

* Fix for rebase

* Remove unused function

* Bugfix

* remove todo

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2024-12-29 19:04:57 +01:00
ad2fd3c9a5 Added chest opening and closing animation (#421)
* Added basic chest opening and closing

* Added number tracking

* Added play chest action function
2024-12-28 18:02:32 +01:00
c521ef8bb0 Correct Interactive Block Behavior (#388)
* Added chest and furnace

* Corrected interactive block functionality

* Fixed merge

* Added standard functions and player remove on destroy

* Added unique block standard functions

* Fix clippy

* Fix deadlock in standard function
2024-12-27 16:24:23 +01:00
991ac37eae fix(pumpkin-inventory/src/drag_handler.rs): divide by 0 (#393)
* fix(pumpkin-inventory/src/drag_handler.rs): divide by 0

Please work
Also, commit made on mobile using Built-in GitHub editor 🔥

* fix(pumpkin-inventory/src/drag_handler.rs): syntax errors
2024-12-25 13:59:44 +01:00
f323e78ef5 Fix: https://github.com/Snowiiii/Pumpkin/issues/270 2024-12-17 00:06:49 +01:00
f587cb6748 remove iter_tools
we only used them for collect_vec. I think its worth the "effort" to write Vec type annotations ourself and have one big crate with way too may features we don't need less
2024-12-12 23:40:52 +01:00
ff6f9ca298 Added chest and furnace (#384) 2024-12-12 16:46:37 +01:00
219527dcb2 Remove all wiki.vg mentions
wiki.vg is gone
2024-12-03 23:36:11 +01:00
f29cfbc63d move container to LivingEntity (#355) 2024-11-30 19:51:22 +01:00
796341be05 Extractor: minimize everything
- blocks.json 8.3MB -> 4.1MB
- items.json 988KB -> 548KB
- packets.json 6.9kb -> 4.2kb
- particles.json 3.5kb -> 1.6kb
- recipies.json 376kb -> 264kb
- screens.json 731b -> 315b
- sounds.json 72.2kb -> 42.2kb
- synced_registeries.json 143.3kb -> 87.6kb
- tags.json 335.4kb -> 165.8kb
2024-11-27 00:12:11 +01:00
98e8bba936 Inventory cleanup (#256)
* add pumpkin error handling for commands

* cleanup clear command

* fix so that all Container implementations follow the same order as the trait

* cleanup give command

* remove unnecessary function

* remove unnecessary function

* fix give command

* fix clear command

* fixup item placement logic

* cleanup clear command a little
2024-11-12 19:24:52 +01:00
8cde02e625 Add Shaped and Unshaped crafting support, as well as deserializing the entire recipe format (#165)
* add cleaner registry parsing

* start adding recipes

* add tags, and some crafting things

* Fix echest command

* add partly working crafting interface

* add generated assets

* fix container commands and clippy lints

* fix issues with resolving recursive item tags for crafting

* add flatten3x3 function

* add shapeless crafting

* add tests to and fix recipe flattening function

* refactor recipe system a bit

* add rayon to speed up initial loading of recipes

* almost working after rebase

* add deserialization for new crafting type "transmute"

* make crafting work again

* make shapeless recipes not require all permutations

* fixed visual bug with when taking out ingredients for crafting

* add support for new tags system
2024-11-12 12:57:14 +01:00
65cb0b52b4 Decrease Block count when Placed 2024-11-09 11:33:14 +01:00
16dabf1826 Add /give Command (#234)
* add prototype for /give command

* fix /give namespace

* fix accidentally replaced text

* remove dbg! statements

* replace block_registry with item_registry

* sync added items with client

* warn!(..) => log::warn!(..)

---------

Co-authored-by: user622628252416 <nnew8715@gmail.com>
2024-11-07 20:34:56 +01:00
17f1984699 Remove some ToPrimitive 2024-11-05 23:32:56 +01:00
8db277f63e Minior Changes 2024-11-03 22:36:00 +01:00
8f90b29cfe Extractor: Parse and use screens.json 2024-11-03 11:25:15 +01:00
acf2fab100 Fix: Block still placed when empty slot 2024-10-31 18:35:03 +01:00
b17ade7b06 Add own Extractor (#201)
* Add custom extractor

* Add namespaces to blocks

* Fix: Errors
2024-10-27 12:21:55 +01:00
e396399e66 Port to 1.21.2 (#171)
* Update JSON Files to 1.21.2

* Update constants to 1.21.2

* Port c_login_success to 1.21.2

* Fix: damage type

* Overhaul Packet ID system

We now use Packet IDS from enums.

1. This is very very nice for seeing which Packets are already implemented and which not.
2. This lets us easly port to newer Minecraft version, In vanilla there are no Packet ids hardcoded, Packet IDs will be parsed from a enum like this

* Port all Packets to 1.20.2

* Update README badge to 1.20.2

* Change doc for the new packet id system
2024-10-23 14:31:23 +02:00
112110272b Better logging (#167)
* feat: logs for when a player interacts with a block out of reach

* cleanup: used self.gameprofile instead of getting it from the client

* cleanup: better logging

* fix: added logging library

* cleanup:removed unused namespace

* cleanup: capitalisation and log levels

* fix: removed simple logging

* fix: removed todo! where not needed

* cleanup: removed duplicate dbg!

* Fix mistake in merging

* Fix my bad

* Merge repeated match arms
2024-10-21 18:36:19 +02:00
f74f77a1f0 Add tokio 2024-10-17 18:59:51 +02:00
dfd4f9bc76 Merge branch 'master' into pumpkinerror-trait 2024-10-13 16:59:23 +01:00
2e99877a6c fix warnings 2024-09-11 23:01:09 +02:00
d176fbd37e fix fmt 2024-09-11 22:56:03 +02:00
c6043189d3 Improved synchronization primitives
- Replaced all `std::sync::Mutex` by `parking_lot::Mutex` and refactored implementation accordingly
- Replaced all `Mutex<T> where T: Copy` by `crossbeam::AtomicCell<T>` and refactored implementation accordingly
2024-09-11 22:39:53 +02:00
c8fee9b23c Try to solve Pumpkin's locking problem 2024-09-09 21:12:49 +02:00
b0f1e60e46 Add a PumpkinError trait, and implement it for InventoryError and DeserializerError 2024-09-09 12:51:55 +02:00
fa114e7e23 Cleanup Server struct
This cleanup's goal is to make all `Server` functions only require &self. This means that `Server` can now be a `Arc<Server>` instead of `Arc<Mutex<Server>>`, which solves a lot of deadlock problems.
2024-09-08 17:44:09 +02:00
59a950c606 a bit of refactor, and actually enforce player inventory condition rules on handle_item_change 2024-09-07 18:13:38 +02:00
3b6fc48a0f add error handling to Click functions 2024-09-07 16:31:24 +02:00