Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5] How to set biome at specific chunk?


Recommended Posts

15 minutes ago, diesieben07 said:

You should really only do this server side if you can help it and then update the clients using the packet.

Ok, that makes sense

15 minutes ago, diesieben07 said:

Yes, but it's the brute-force approach because it re-sends the entire chunk data.

I understand that and still, how do I send this packet? I found info only about custom packets, not the vanilla ones

Link to comment
Share on other sites

Thank you for your replies!

3 hours ago, diesieben07 said:

Look at what PacketDistributor#trackingChunk does.

I've done the same thing that this method does, but the problem on screenshot (https://imgur.com/a/9qNBhxS) remains. Sometimes everything changes ok but the rest of the times the result is the same as in the screenshot. Breaking/placing block inside the chunk fixes the problem

    public void changeBiome() {
            // Now this piece of code runs only on server side
            final Chunk chunk = level.getChunkAt(worldPosition);
            Biome[] biomes = chunk.getBiomes().biomes;
            for (int i = 0, biomesLength = biomes.length; i < biomesLength; i++) {
                DynamicRegistries reg = level.registryAccess();
                MutableRegistry<Biome> a = reg.registry(Registry.BIOME_REGISTRY).get();
                Biome biome = a.get(Biomes.DESERT.location());
                biomes[i] = biome;
            // This line does basically the same that PacketDistributor#trackingChunk does
            ((ServerChunkProvider)level.getChunkSource()).chunkMap.getPlayers(chunk.getPos(), false)
                    .forEach(e -> e.connection.send(new SChunkDataPacket(chunk, 65535)));
        else {
            // Update chunk?

I guess that the only thing remains is to update the chunk on client, how can I do that?

Link to comment
Share on other sites

59 minutes ago, sasetz said:

I guess that the only thing remains is to update the chunk on client, how can I do that?

SChunkDataPacket does this when it is received on the client. I am not sure why it doesn't work for you. Please post a Git repo of your mod so I can test this.

Link to comment
Share on other sites

26 minutes ago, diesieben07 said:

I am sorry, but I don't know why it doesn't work. The client receives the chunk data packet and ithas the correct biomes in it. It then decides to re-render the chunk. I don't know why it renders with the wrong colors.

Well, still, thank you for your help! I will continue searching for what's happening, so if I find something, I'll post it here

So far I figured out that the update doesn't affect the whole chunk, several layers of grass or leaves can be different colors at the same time

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.