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

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

Closed
welcomehyunseo opened this issue Sep 11, 2022 · 3 comments
Closed

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

welcomehyunseo opened this issue Sep 11, 2022 · 3 comments
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@welcomehyunseo
Copy link

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.

@Tnze
Copy link
Owner

Tnze commented Sep 11, 2022

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 Tnze added question Further information is requested duplicate This issue or pull request already exists labels Sep 11, 2022
@Tnze
Copy link
Owner

Tnze commented Sep 11, 2022

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

@welcomehyunseo
Copy link
Author

welcomehyunseo commented Sep 11, 2022

Thanks

@Tnze Tnze closed this as completed Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants