Commit Graph

74 Commits

Author SHA1 Message Date
4lve
9e36cdf683 Full inventory refactor + barrels (#691)
* replace slot with ItemStackSeralizer

* Dismantle current inv logic

* Disassemble even more, items need fixing markd with TODO: Inv

* Player inventory methods implmented

* make some fields private

* remove invalid comment

* Partial screen handler and slot

* Add armorslot

* prepare for crafting

* implement some more crafting traits

* Fix ItemStack

* Fix pickup and remove faulty crafting (getting reworked in inv revamp)

* fix

* fix error

* add readme

* move readme file

* asd

* remove readme

* add uppsercase readme

* Some more work

* merge

* Move from generics to dynamics

* fix

* move to same impl

* Some changes

* add player open logic

* Basic impl of sync and listeners

* Why did mojang complicate it so much

* bruh

* Simplify things with DefaultScreenHandlerBehaviour

* Implement partial slot clicks

* add

* itemhashes are broken

* Start implementing packets

* fix deadlock

* new vanilla update

* Use static item refs and use Arc Mutex on invs

* working normal click

* fix deadlock

* implement sync handler

* small patch

* Implement quick_move

* Implement Swap click type

* pickup, update bug

* start fixing updates

* fix pickup desync

* Make Inventories non mutexes

* Implement some finishing stuff

* close screen on player leave

* fix pick item

* Move to item hashes

* remove some logs

* begin implementing barrels

* Begin implementing barrel

* implement barrels

* fix clippy + typos

* Fix merge conflicts

* Fix lint error

* don't use unwrap when getting equipment slot

* Fix typo and single threaded

* Accidentally removed tokio completley

* Fix crash when opening barrel holding item

* Add support for marking block entities dirty

* Player Equipment changes

* Make ScreenHandlerFactory own inventory instead of passing in optional

* remove log

* replace todo's

* fix clippy

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-05-09 16:28:15 +02:00
azom
488e4de586 the fix (#772) 2025-04-26 20:33:14 -10:00
Liyan Zhao
360b834bcf Revert packet name change from #742 (#768)
* revert: Revert packet name change from 48e2cf6b42

* fix: add comments
2025-04-26 20:31:21 -10:00
unschlagbar
b997687e8b implement Door placement & pumpkin_data changes (#713)
* fix: view distance goes no above 16

* fix: cargo fmt

* removed the floating point conversation

* fixed spelling

* renamed the test for the capacity estimation

* edit: replaced division with bitshifting

* added more ()

* extendet test and fixed missing chunks when the view distance is very low

* added commentar

* fixed door placement & fence connection

* fix linting

* fmt

* fix clippy

* removed useless borrow

* fix all clippy warnings

* bro i changed so much

* added const to fn

* Update block_state.rs

* added bunch of things

* fix

* lol

* fmt

* fix: player is able to place where it stands

* fix: spelling

* upd2

* upd 4

* remove Option types from blockstate

* resolve conflicts

* Update player.rs

* fix

* fmt

* remove uninit

* fix

* resolved conflicts

* fmt

* remove dupe code

---------

Co-authored-by: unschlagbar <adrian@kuhlmann@gmx.de>
2025-04-26 10:27:37 -10:00
Alvsch
48e2cf6b42 Fix position desync between clients (#742)
* fix teleport desync

* fix: move to fast desync
2025-04-24 14:38:03 +02:00
Alvsch
35d3aa49c0 use latest position for player hitbox (#746) 2025-04-17 19:54:27 +02:00
Alexander Medvedev
254982f745 Allow Up and Down direction for blocks
now we only calculate the direction if we need and also can calculate up and down which can be used for blocks like Observers or Pistons.
Fixes https://github.com/Pumpkin-MC/Pumpkin/issues/738
2025-04-14 17:02:09 +02:00
kralverde
91ef79325a Network Serialization Quality of Life and Safety Improvements (#701) 2025-04-07 07:59:00 -10:00
Alexander Medvedev
e0ff254858 Implement cactus 2025-03-25 15:05:35 +01:00
Hugo Planque
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
kralverde
b9d9bacf8c Abstract networking to streamline code and avoid creating a new buffer for (de)compression. (#607) 2025-03-20 06:23:25 -10:00
Alexander Medvedev
7a15a50030 Generate Biomes (#610)
* Populate biomes

* actually fix multi noise sampler

* actually they are all pass-through

* fix serde error

* prepare things

* implement surface rules

* fix max_y

* fix terrain gen

* make surface rules work

* fix wrong biome coords

* refactor height estimator to its own struct

* implement surface estimation for surface rules

* fix surface gen

* some carve work

* fix conflicts

* more biomes work

* fix biome map

* refactor biome lookups

* add unit tests

* change from_block to from_chunk

* not only lushcaves anymore

* add more unit tests

* add unit test

* fix multi noise

* Update proto_chunk.rs

* fix biome map access

* test badlands impl

* fix badlands

* fix some values

* make it compile

* Fix bug in get_enclosing_parameters (#641)

* add badlands pillar and icebergs

* fix clippy

* fix clippy in test

* Update README.md

---------

Co-authored-by: kralverde <github@email.kralverde.dev>
Co-authored-by: 4lve <72332750+4lve@users.noreply.github.com>
2025-03-19 17:02:52 +01:00
Epix
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
Alexander Medvedev
e055dd740c Check if player can destroy block using an tool
Prevents players to destroy blocks when holding a sword or trident in creative
2025-03-04 19:45:39 +01:00
Alexander Medvedev
be44ccc8df Don't require server when spawning a entity
Makes it much simpler
2025-03-02 16:05:31 +01:00
Alexander Medvedev
a60a3ba243 Add Experience Orb and drop it when breaking Blocks 2025-03-01 16:58:02 +01:00
Alexander Medvedev
fe400e4970 Make non living entities not attackable
Adds a cool abstraction to progress damage, Now implementing End Crystals should be very easy
2025-02-26 22:48:19 +01:00
Alexander Medvedev
b336a50955 Batch CSetEntityMetadata data
Allows us to send multiple meta in only one Packet
2025-02-25 23:21:59 +01:00
Alexander Medvedev
8aef30ee13 Make TNT Work (#590)
* make tnt work

* Spawn TNT at right position

* Fix tnt
2025-02-25 16:38:12 +01:00
Alexander Medvedev
995edfb3c2 Add Effects 2025-02-22 14:17:06 +01:00
Alexander Medvedev
1fb2be46d4 Update to Rust edition 2024 2025-02-20 18:42:20 +01:00
kralverde
7ec99a0411 Fix our NBT serde (#549)
* make deserializer streamable

* fix logic

* fix deserializing

* work on deserialization

* finish serialize

* replace everything with pumpkin_nbt

* fix more serialization cases

* finish conversion

* add comment

* remove all fast_nbt, test nbt arrays, add implement tuples/arrays

* add size hints for deserialization

* fix deserialization
2025-02-16 13:39:43 +01:00
Alexander Medvedev
06334ec658 Add Particle command 2025-02-11 20:43:16 +01:00
vyPal
af0573d9b8 Support Teleport to different world (#532)
* make entity world RwLock

* Add teleport function

* Mark client as not loaded before change dim

* clippy

* Post-merge issues

* FIx post merge issues

* Make world.remove_player fire event conditionally

* Remove extra StartWaitingChunks packet

* Add world.send_world_info()
2025-02-11 17:08:11 +01:00
Alexander Medvedev
5c5bc67b3a Improve damage type 2025-02-07 22:33:52 +01:00
Alexander Medvedev
8a5a0cdee8 Drop item when destroying blocks
Also make EntityType consts
2025-02-07 21:20:03 +01:00
Alexander Medvedev
2e2fe83720 Add Hunger 2025-02-07 00:22:52 +01:00
Alexander Medvedev
3d789f7450 Some Renames 2025-02-05 23:12:16 +01:00
Alexander Medvedev
1712e5f0ac Use bytes 1.10.0 and replace our try_get with their 2025-02-03 22:48:48 +01:00
drakeerv
09d6eb6da2 Add damage types & damage command (#526) 2025-02-02 11:22:49 +01:00
Alexander Medvedev
1729f58a6f Make Snowballs and Eggs work 2025-02-01 21:17:37 +01:00
suprohub
186e846858 Plugin event rewrite (#513)
* simplify all

* fmt

* Consider using derive macro

* Add new events

* Add events call

* minor fixes

* minor fixes

* fix

* optimize code

* big changes

* fix skill issue

* fix

* Consider not specify patch version

* make logger shared

* i want test one thing

* Add one useful function

* add little amouth of docs

* use config instead

* revert changes

* fmt

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-02-01 18:14:28 +01:00
Alexander Medvedev
466d4380cf Some Refactors 2025-02-01 17:53:41 +01:00
Alexander Medvedev
a1f08ebb55 Make item drops work 2025-02-01 14:13:13 +01:00
Alexander Medvedev
819e0c62ac Some more Item dropping work
And also some fixes
2025-01-31 23:21:24 +01:00
Alexander Medvedev
ef497fb435 Refactor World Entity System
Also support Item drops (WIP)
2025-01-31 21:45:20 +01:00
Alexander Medvedev
41fac573ba Fix some typos 2025-01-28 14:05:17 +01:00
Alexander Medvedev
deda78231a play sound on fall damage 2025-01-27 21:55:32 +01:00
Alexander Medvedev
2fdf0777f6 Add Summon Command
Also refactor some things:

- Remove cmd_ prefix from commands
- Remove arg_ prefix from arguments
2025-01-26 20:06:20 +01:00
Alexander Medvedev
709d222c23 add basic entity NBT storage 2025-01-19 19:30:32 +01:00
Alexander Medvedev
23dbb72bbe rename WorldPosition 2025-01-12 16:45:22 +01:00
Alexander Medvedev
aad1f91acb parse entity types at compile time 2025-01-11 17:59:36 +01:00
Alexander Medvedev
03cb80b216 parse scoreboard display slot at compile time 2025-01-11 16:52:09 +01:00
Alexander Medvedev
621bc31f48 parse entity pose at compile time 2025-01-11 16:20:31 +01:00
Alexander Medvedev
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
Alexander Medvedev
e15b2e06ae Add Path finding (#459)
* add initial path finding

* Make everything work

:D
2025-01-06 11:41:05 +01:00
Alexander Medvedev
f2cfad06bd Add Entity AI 2025-01-04 18:37:59 +01:00
Alexander Medvedev
fa07af7308 shorten compile times
but only by a bit :c
2025-01-02 15:47:11 +01:00
Kris
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
Alexander Medvedev
0633197b62 pumpkin-protocol: added codecs 2024-12-21 17:05:44 +01:00