Skip to content

Refactor natural block dropping - #3532

Open
DellieDelta wants to merge 16 commits into
PixelGuys:masterfrom
DellieDelta:natural-blockdrop-refactor
Open

Refactor natural block dropping#3532
DellieDelta wants to merge 16 commits into
PixelGuys:masterfrom
DellieDelta:natural-blockdrop-refactor

Conversation

@DellieDelta

@DellieDelta DellieDelta commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Progress towards #2385

Related to #3533

Is about decay and the check_support_block callbacks

@DellieDelta
DellieDelta marked this pull request as draft August 20, 2026 16:12
IntegratedQuantum pushed a commit that referenced this pull request Aug 20, 2026
@DellieDelta
DellieDelta force-pushed the natural-blockdrop-refactor branch from abaca9c to b88cdfb Compare August 20, 2026 18:38
@DellieDelta
DellieDelta marked this pull request as ready for review August 20, 2026 18:50
@Wunka Wunka moved this to Easy to Review in PRs to review Aug 21, 2026
@DellieDelta
DellieDelta marked this pull request as draft August 22, 2026 09:34
IntegratedQuantum pushed a commit that referenced this pull request Aug 26, 2026
@DellieDelta
DellieDelta force-pushed the natural-blockdrop-refactor branch from b88cdfb to 3c49964 Compare August 26, 2026 19:40
@DellieDelta
DellieDelta marked this pull request as ready for review August 27, 2026 06:04
Comment thread src/server/BlockDrop.zig
@as(f32, @floatFromInt(pos[0])) + model.min[0] + main.random.nextFloat(&main.seed)*(model.max[0] - model.min[0]),
@as(f32, @floatFromInt(pos[1])) + model.min[1] + main.random.nextFloat(&main.seed)*(model.max[1] - model.min[1]),
@as(f32, @floatFromInt(pos[2])) + model.min[2] + main.random.nextFloat(&main.seed)*(model.max[2] - model.min[2]),
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe include this as another case into the Location?
I think it would be nicer to only have a single drop function, with everything else being configured through its parameters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh I hadn't made that connection, I'll try it out

@DellieDelta

Copy link
Copy Markdown
Contributor Author

Before I continue, I need your feedback on a direction I want to take this in. See the last commit

Now that we have allowed/forbidden tool tags on drops, we can get rid of the dropNaturally function too on the BlockDrop by letting decay also use Context

Instead of passing a list of block drops directly to the decay callback, we can instead rely completely on the drops defined on the block itself. That would mean you'd always treat decay as if you're breaking the block by hand. Currently, any block that can decay already works like that

It makes sense to me, but I'm wondering if you still see any value in allowing the caller to define custom drops in the callback

@IntegratedQuantum IntegratedQuantum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to me, but I'm wondering if you still see any value in allowing the caller to define custom drops in the callback

As far as I remember this was mainly a decision because we didn't have any other tools to restrict block drops.

In the future, if we ever ed this capability again, I think it would make more sense to add a mechanism that makes use of the existing tags instead.

Now that we have allowed/forbidden tool tags on drops, we can get rid of the dropNaturally function too on the BlockDrop by letting decay also use Context

Yes, please, but do note that it should still give each stack a new random poisition.

}
const model = params.block.mode().model(params.block).model();
const location = BlockDrop.Location{
.normalDir = main.vec.normalize(main.random.nextFloatVectorSigned(3, &main.seed)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally all item stacks should have a randomized direction, not one direction for all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Easy to Review

Development

Successfully merging this pull request may close these issues.

3 participants