Skip to content

Commit

Permalink
minecraft/protocol: Read and write sound positions correctly (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dasciam authored Aug 1, 2024
1 parent 29a1116 commit 0988e2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion minecraft/protocol/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (r *Reader) SubChunkPos(x *SubChunkPos) {
// SoundPos reads an mgl32.Vec3 that serves as a position for a sound.
func (r *Reader) SoundPos(x *mgl32.Vec3) {
var b BlockPos
r.BlockPos(&b)
r.UBlockPos(&b)
*x = mgl32.Vec3{float32(b[0]) / 8, float32(b[1]) / 8, float32(b[2]) / 8}
}

Expand Down
2 changes: 1 addition & 1 deletion minecraft/protocol/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (w *Writer) SubChunkPos(x *SubChunkPos) {
// SoundPos writes an mgl32.Vec3 that serves as a position for a sound.
func (w *Writer) SoundPos(x *mgl32.Vec3) {
b := BlockPos{int32((*x)[0] * 8), int32((*x)[1] * 8), int32((*x)[2] * 8)}
w.BlockPos(&b)
w.UBlockPos(&b)
}

// RGB writes a color.RGBA x as 3 float32s to the underlying buffer.
Expand Down

0 comments on commit 0988e2a

Please sign in to comment.