Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inaccurate block stacks #879

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Faun471
Copy link
Contributor

@Faun471 Faun471 commented Jul 19, 2024

Stacked Blocks always have one more than the actual amount, since we count the placed block as well as the amount of blocks inside the "stack"

@Faun471
Copy link
Contributor Author

Faun471 commented Jul 19, 2024

I made a lot of changes with how the code looks; I can change it back to how it looked before for consistency idk

}

private void processBlock(int x, int y, int z, @NotNull Chunk chunk, @NotNull ChunkSnapshot chunkSnapshot, @NotNull Map<XMaterial, Integer> teamBlocks) {
Block block = chunk.getBlock(x, y, z);
Copy link
Member

Choose a reason for hiding this comment

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

Is this thread safe? Remember this is running async

teamBlocks.merge(material, amount, Integer::sum);
}

public boolean isBlockStacked(Block block) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed? getStackAmount defaults to 1 if its not present anyway?

Stacked Blocks always have one more than the actual amount, since we count the placed block as well as the amount of blocks inside the "stack"
@dlsf dlsf force-pushed the fix-inaccurate-block-stacks branch from 5d8f694 to ce50469 Compare September 4, 2024 21:37
@dlsf dlsf added the bug Something isn't working label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants