-
Notifications
You must be signed in to change notification settings - Fork 146
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
Conversation
There was a problem hiding this 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.
👍 |
bump |
rebump |
bumpy |
can we merge this? I'd like to be able to get rid of my dragonfly fork I'm currently using |
There was a problem hiding this 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
:)
@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) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!slices.Equal(s.skyLight, sub.skyLight) || len(s.storages) != len(sub.storages) { | |
len(s.storages) != len(sub.storages) { |
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 🙏)