go-mc icon indicating copy to clipboard operation
go-mc copied to clipboard

How do I set a block to a specific x, y, z?

Open welcomehyunseo opened this issue 1 year ago • 3 comments

Thank you for your project. I am preparing to build a server with 1.14.4. I need to send chunk data packets, but I know the player is moving. But it frequently fails to send chunk data packets.

How do I set a block to a specific x, y, z? And how to send the packet?

The reason I ask this question is because the setBlock function in level.chunk takes only index as a parameter.

func (s *Section) SetBlock(i int, v BlocksState) {
if block.IsAir(s.States.Get(i)) {
s.BlockCount--
}
if v != 0 {
s.BlockCount++
}
s.States.Set(i, v)
}

image

https://wiki.vg/index.php?title=Protocol&oldid=15346#Chunk_Data

I already understand block state id.

Please help me. I've been looking for it for several weeks, but it's a very difficult trip.

welcomehyunseo avatar Sep 11 '22 08:09 welcomehyunseo

Dup: #169

ps: the index is between [0, 16*16*16). And the priority of x, y and z has changed in a version which I forget.

Tnze avatar Sep 11 '22 08:09 Tnze

Current implementation should be not to support 1.14 out of box. Best wishes for you.

Tnze avatar Sep 11 '22 08:09 Tnze

Thanks

welcomehyunseo avatar Sep 11 '22 08:09 welcomehyunseo