Refactor such that libcraft contains all generated files (almost).#461
Conversation
Added libcraft-inventory
|
My bad hygiene when doing commits has bitten me in the ass. So it's a very messy commit history, but currently the Things that we did: |
Appease the clippy gods.
cargo fmt
Fixed generator to satisfy clippy.
Fixed a bunch of clippy errors.
`cargo fmt` wants new lines at the end of files.
| damage: Some(damage), | ||
| }) => ItemStackBuilder::with_item(item) | ||
| .count(count as u32) | ||
| .damage((*damage).try_into().unwrap()) |
There was a problem hiding this comment.
Is unwrapping here okay? Should we be returning a Result or can this never panic?
There was a problem hiding this comment.
Nice catch, this is an issue. I am going to change this.
There was a problem hiding this comment.
I made damage on ItemStack be a i32, reflecting the fact that vanilla minecraft allows negative damage amounts, making the anvil damage and itemstack damage congruent.
|
|
||
| pub struct ItemStackBuilder { | ||
| item: Item, | ||
| count: NonZeroU32, |
There was a problem hiding this comment.
Why is this a U32 when count is a u8?
There was a problem hiding this comment.
It might be the case that ItemStacks should allow for negative stack sizes. However,
i believe this is outside the scope of this refactor. That was how ItemStack were modelled when we started. This "issue" should be revisited on a separate pull request.
Co-authored-by: Amber <amberkowalski03@gmail.com>
Fix merge issues.
Moved generated code into libcraft.
Status
Description
I have moved the code from feather/generated into libcraft/generated and made everything depend on that version instead. I have not moved feather/blocks into libcraft, but might do that in a different pull request.
Related issues
#459
What's missing in this pull request:
ItemStack in libcraft was different in libcraft then in the original generated module. I have no idea why. The original version allowed for ItemStacks containing zero items, but the new version does not. This broke a lot of small things, but especially feather/common/window.rs. I tried to quickly adapt it to the new ItemStack methods in libcraft, but i have not gotten it to work. It compiles, but the test don't pass .
Checklist
cargo fmt,cargo clippy --all-targets,cargo build --releaseandcargo testand fixed any generated errors!