Refactor block dropping when breaking block with a tool - #3533
Refactor block dropping when breaking block with a tool#3533IntegratedQuantum merged 19 commits into
Conversation
IntegratedQuantum
left a comment
There was a problem hiding this comment.
I don't think this is the right place for this functionality. blocks.zig is already a big file and so far it has mostly definitions of block properties and loading/access thereof, but little functionality (and all functions on Block are retrieving properties, none are actually doing things).
In the issue I proposed to move them to the server world, which is also maybe a bit too big right now.
So maybe the BlockDrop struct deserves its own file (and in server, since blockdrops are not done on the client). And all the helper structs and functions (including #3532) could be defined there.
|
I agree. I'll make a new PR for moving |
369b410 to
c54395f
Compare
| const dropAmount = self.oldBlock.mode().itemDropsOnChange(self.oldBlock, self.newBlock); | ||
| if (dropAmount == 0) return; | ||
|
|
||
| if (self.item) |item| { |
There was a problem hiding this comment.
This now only drops anything if it was broken by an item (i.e. no apples)
| return true; | ||
| } | ||
|
|
||
| pub fn tryDropWhenBrokenWithItem(self: @This(), item: Item, pos: Vec3d, dir: Vec3f, velocity: f32) void { |
There was a problem hiding this comment.
I think this name is rather awkward, also in my option the item should be checked at the callsite instead.
Related to #3532
Progress towards #2385