Commit Graph

51 Commits

Author SHA1 Message Date
Alexander Medvedev
7e3a1c0972 Fix rust 1.89 warns 2025-08-11 20:45:55 +02:00
Alexander Medvedev
fd8d89a219 Fix https://github.com/Pumpkin-MC/Pumpkin/issues/1075 2025-07-29 12:19:05 +02:00
vyPal
f463b5bc81 allow Custom Plugin APIs (#1080)
* Wrap Context in Arc

* Add support for plugin to expose custom APIs

* Add functionality to allow plugins to load in parallel

* Remove PluginManager from RwLock
2025-07-27 17:34:41 +02:00
teknostom
ee361f35cb Add macro for expanding tags to PumpkinBlock (#1071)
* add macro for expanding tags

* fmt

* Remove log
2025-07-26 19:56:17 +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
Alexander Medvedev
e0c91b3edc Initial Bedrock support
You can't join the World, But the base is ready
2025-06-29 00:33:44 +02:00
Alexander Medvedev
8ebc9ee494 Refactor block default state 2025-06-22 21:28:14 +02:00
Clicks
39359e35ff Improve errors from proc macros (#900)
* proc_macro_error2

* cargo fmt
2025-06-17 14:50:24 +02:00
vyPal
88dac44913 Small changes to plugin API (#841)
* Change method/module visibility to be accessible from plugin API

* Allow plugins to register custom plugin loaders with the PluginManager

* Unload all plugins when shutting down server

* Fix formatting
2025-06-07 12:36:16 +02: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
Alexander Medvedev
7611427f92 rework block registration
this should now take less memory and enabled better compiler optimizations, also the piston facing got fixed
2025-04-14 11:39:58 +02:00
4lve
0dd176e8e2 add Block Entities (#737)
* Start implemetnign block entities

* fix

* Move block entites

* bruh wtf

* fix

* Add seralizers for compund

* don't panic on unknown block enity types

* Move block entites to pumpkin-world

* begin implementation

* Chunk packet works

* fix signs

* fix clippy

* merge

* Fix signs

* merge

* fix

* merge

* fix

* remove println

* move folder

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-04-13 16:22:12 +02:00
Alexander Medvedev
aedb29f3fc Only store state id in RawBlockState
This theoretically cuts the internal memory usage of chunk data in half since we no longer save the block id
2025-04-12 12:57:09 +02: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
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
4lve
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
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
kralverde
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
Alexander Medvedev
26b69eae33 Minior packet changes 2025-02-23 13:35:22 +01:00
Alexander Medvedev
1fb2be46d4 Update to Rust edition 2024 2025-02-20 18:42:20 +01:00
MrMelther
daa67c2dfa Reworking block properties (#529)
* Added 11 blocks properties

Added the following properties:
Axis
Open
Age
Attachment
Signal Fire
6 connection directions

* Clippy my beloved 💕

* Reworked block properties

Changed block properties to make them more extensible and easier to handle.

* Little too much of Clippy

* Lever works!!! 🎉

Made the lever work, implementing modifiers to the “on_place” per block, plus the “on_interact” function to handle the state when interacting with a block that has it.

* Kinda implemented bool as value

* A little bit of Clippy :)
2025-02-09 18:45:18 +01:00
Alexander Medvedev
8592d095f3 Parse Items at Compile time 2025-02-08 19:23:59 +01:00
Kris
237b335a17 Add Support for Sign's (#490)
* Updated revised areas

* Removed enum added macro to search for block entity id

* Added sign update for all clients & clean up

* updated update_sign

* Updated code

* typo fix and format

* Finish and correct merge

* Remove hardcoded block entity value

* Move to own nbt crate

---------

Co-authored-by: whiteout314 <almagro.carlos@proton.me>
2025-02-03 12:45:15 +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
suprohub
49c697b431 Plugin api events rewrite (#510)
* simplify all

* fmt
2025-01-28 20:30:34 +01:00
Alexander Medvedev
45a591b27b parse Sounds into enum at compile time 2025-01-10 14:47:34 +01:00
Alexander Medvedev
c711d1511c parse Particle into enum at compile time 2025-01-10 14:39:25 +01:00
Alexander Medvedev
1208e67f36 parse screen into enum at compile time 2025-01-10 14:31:43 +01:00
Alexander Medvedev
03e81a1436 transfer packet id parsing to build time
This also allows now to create custom packets with a custom packet id which is not in the packets.json
2025-01-10 13:42:39 +01:00
Alvsch
a04b23f633 Added compile time BlockState (#347)
* added block_state! macro

* Update block_state! macro
2024-12-07 13:10:37 +01:00
Nico Göbel
b82a4e130b Add: Interactive blocks (#333)
* WIP interactive blocks

* Added jukebox and crafting table

* Making feature more dynamic allowing every block action to be registered here

* Renamed interactive_block_manager to block_manager

* Simplifying register functions

* Added on placed

* Fix master merge

* Added pumpkin_block macro

* Removed junk

* Added the option to block placing in on_use_with_item

* Fixed inventory lock

* Adding on_broken and implementing it for the jukebox

* Fixed merge
2024-12-07 13:00:03 +01:00
Snowiiii
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
Alvsch
4348b56fbe Fix packet side in extractor (#294)
* fix packet side
2024-11-17 19:51:46 +01:00
Snowiiii
711e16528a Simplify Screens, Sounds and Particles Extractor
Particles: 6.6KB -> 3.5KB
Screens: 1.4KB -> 732B
Sounds: 118KB -> 72.2KB
2024-11-14 19:00:38 +01:00
Snowiiii
ac31d1c83b Improve Packet Extractor
Optimize packets.json
- Reduce lines from 1394 -> 256
- Reduces File size 23KB-> 6.9KB
2024-11-14 18:52:47 +01:00
Snowiiii
8db277f63e Minior Changes 2024-11-03 22:36:00 +01:00
Snowiiii
1842e8e6b1 Parse Serverbound Packet IDs from JSON as well
Before only Clientbound Packet IDs where parsed from JSON, Now Serverbound Packet IDs are parsed from JSON as well. This makes porting to new minecraft version much easier
2024-11-03 12:25:10 +01:00
Snowiiii
8f90b29cfe Extractor: Parse and use screens.json 2024-11-03 11:25:15 +01:00
Snowiiii
a6f3b3f748 Clientbound Packets: use ids from JSON 2024-10-27 14:18:18 +01:00
Alexander Medvedev
b17ade7b06 Add own Extractor (#201)
* Add custom extractor

* Add namespaces to blocks

* Fix: Errors
2024-10-27 12:21:55 +01:00
Alvsch
7de3e0e995 Improved pvp (#173)
* Added CSoundEffect packet

* Added sound macro

added a macro that turns sound namespaces to the sounds id

* added CEntitySoundEffect

* updated id to i32

* Added sound effects to pvp

* Added sweeping and particles

* Added I-Frames to living entity

* Refactored combat

split up the combat handling into multiple functions and a new combat module

* use new packet macro

* updated json files

* fixed attacking

* use builtin clamp
2024-10-24 17:49:23 +02:00
Alexander Medvedev
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
lukas0008
78d6069786 Clippy 2024-10-19 20:53:06 +02:00
lukas0008
7300bda967 Make block state macro comptime-again 2024-10-19 20:48:19 +02:00
kralverde
b7b975a064 rebase block_id 2024-09-28 17:39:11 -04:00
lukas0008
8112f4a6d9 Make block_id macro work in pumpkin-world 2024-09-19 20:24:15 +02:00
lukas0008
d2f700ac1f Cargo fmt 2024-09-18 17:21:05 +02:00
lukas0008
79c6730386 Make block_id macro 2024-09-18 17:11:45 +02:00