* refactor: less manual BlockMetadata impls
* refactor: added BlockId type
BlockId is a wrapper for u16: it is valid for any u16 that is the id of a Block.
- Changed the Block.id field type to BlockId
- added named BlockId constants
- BlockMetadata::ids() now returns Box<[BlockId]>
- adjusted pumpkin-macros to use BlockId constants
- fixed some methods that were comparing blockstate ids or item ids (u16) against block ids (previously u16)
TODO: check if unsafe blocks can be removed; The compiler might understand that BlockId is always a valid index into mappings::TYPE_FROM_RAW_ID
* refactor: added BlockStateId type
A BlockStateId is a safe wrapper around the numerical index of a BlockState in pumpkin-data. They help avoiding validity checks (outside of IO and, currently, plugins), and make it easier for other contributors to reason about what they're comparing; BlockStateIds, BlockIds or Item ids (still u16).
pumpkin-data::BlockStateId replaces RawBlockState and BlockStateId from pumpkin-world.
- added the BlockStateId wrapper type
- made (almost; plugins) every function interacting with block states or block state ids use the wrapper type
- changed codegen logic to create/work with BlockStateIds
- made ChunkPalette parsing check BlockStateId validity (pumpkin-world::chunk::format::ChunkSectionBlockStates)
TODO: check if unsafe blocks can be removed; The compiler might understand that BlockStateId is always a valid index into mappings::BLOCK_ID_FROM_STATE_ID and mappings::STATE_FROM_STATE_ID
* refactor: imports
changed every use pumpkin_world::BlockStateId to pumpkin_data::BlockStateId
* refactor: Block- & BlockStateId
finishing touches;
- rebased on latest mater
- ensure there are no bound checks on Block(State)Id conversions, making them extremely cheap
- this required unsafe std::hint::assert_unchecked annotations because the compiler is (occasionally) stupid
- on debug builds the bound checks still exist because of ub_checks (see rust unstable book for the feature of the same name)
- added Safety notes to hopefully prevent anyone from enabling the creation of invalid Block(State)Ids in the future
- fixed a benchmark
* updated documentations and applied a minor fix to resource_pack.rs config (suggested and autofixed by rustrover).
* fmt
Signed-off-by: Illyrius <fitimq@live.nl>
* init
Signed-off-by: Illyrius <fitimq@live.nl>
* fix unnecessary spaces
Its works, but block state ids are currently not mapped, meaning that when using the current default world gen the client mostly will disconnect due to a not found block state id, vanilla version compatible worlds should work
* 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
* 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
* 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
* 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>
* 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 :)
* 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>
* 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>
* 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