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

Added function to compare chunks #841

Closed
wants to merge 7 commits into from
Closed

Added function to compare chunks #841

wants to merge 7 commits into from

Conversation

ethaniccc
Copy link
Contributor

This allows for two chunks with two different pointers to still be compared for equality.
(pls merge so I don't have to update oomph's fork 🙏)

Copy link
Member

@Sandertv Sandertv left a comment

Choose a reason for hiding this comment

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

Feel free to combine some of these checks into a single statement. That shouldn't lead to a longer execution time.

@ethaniccc
Copy link
Contributor Author

👍

@ethaniccc
Copy link
Contributor Author

bump

@RestartFU
Copy link
Contributor

bump

rebump

@cqdetdev
Copy link
Contributor

bumpy

@RestartFU
Copy link
Contributor

can we merge this? I'd like to be able to get rid of my dragonfly fork I'm currently using

Copy link
Contributor

@RestartFU RestartFU left a comment

Choose a reason for hiding this comment

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

can you run go fmt :)

@didntpot
Copy link
Contributor

@ethaniccc :V

@@ -14,6 +16,25 @@ func NewSubChunk(air uint32) *SubChunk {
return &SubChunk{air: air}
}

// Equals returns if the sub chunk passed is equal to the current one.
func (sub *SubChunk) Equals(s *SubChunk) bool {
if s.air != sub.air || !slices.Equal(s.blockLight, sub.blockLight) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if s.air != sub.air || !slices.Equal(s.blockLight, sub.blockLight) ||
if s.air != sub.air ||

// Equals returns if the sub chunk passed is equal to the current one.
func (sub *SubChunk) Equals(s *SubChunk) bool {
if s.air != sub.air || !slices.Equal(s.blockLight, sub.blockLight) ||
!slices.Equal(s.skyLight, sub.skyLight) || len(s.storages) != len(sub.storages) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
!slices.Equal(s.skyLight, sub.skyLight) || len(s.storages) != len(sub.storages) {
len(s.storages) != len(sub.storages) {

@T14Raptor T14Raptor closed this Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants