PandaSpigot icon indicating copy to clipboard operation
PandaSpigot copied to clipboard

Ghost blocks/bugged chunks

Open andreasdc opened this issue 3 years ago • 9 comments

When you set player's view distance with api to lower than what client have, you see ghost blocks/chunks, especially when walking away from them. I did some investigating and this bug is related to block changes outside of player's view distance. What can we do about it?

andreasdc avatar Jun 15 '22 00:06 andreasdc

I don't see where this project provides a "view distance api" your talking about.

So i don't see how this project can fix something that is not even provided?

mechoriet avatar Jun 16 '22 14:06 mechoriet

I don't see where this project provides a "view distance api" your talking about.

So i don't see how this project can fix something that is not even provided?

Don't you have viewDistance in EntityPlayer? public int viewDistance; // PaperSpigot - Player view distance API

andreasdc avatar Jun 16 '22 17:06 andreasdc

with this simple plugin,

public final class Testplugin extends JavaPlugin {

    @Override
    public void onEnable() {
        getCommand("test").setExecutor(this);
        // Plugin startup logic
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(sender instanceof Player) {
            Player player = (Player) sender;
            player.spigot().setViewDistance(Integer.parseInt(args[0]));
        }
        return false;
    }
}

after trying server/client to view-distance to 10 and tried 3 to 6 to 10 to 4

also random to 32 chunks then client to 32 and then back to 10 view-distance server it kind of unloaded slow client side server was fast

but haven't found any "ghost" chunks

even with a second client breaking block outside the other 3 viewdistance client I haven't observed your behavior

mechoriet avatar Jun 16 '22 19:06 mechoriet

with this simple plugin,

public final class Testplugin extends JavaPlugin {

    @Override
    public void onEnable() {
        getCommand("test").setExecutor(this);
        // Plugin startup logic
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(sender instanceof Player) {
            Player player = (Player) sender;
            player.spigot().setViewDistance(Integer.parseInt(args[0]));
        }
        return false;
    }
}

after trying server/client to view-distance to 10 and tried 3 to 6 to 10 to 4

also random to 32 chunks then client to 32 and then back to 10 view-distance server it kind of unloaded slow client side server was fast

but haven't found any "ghost" chunks

even with a second client breaking block outside the other 3 viewdistance client I haven't observed your behavior

Try sending block change packet outside of view distance.

  1. Have client-side render of 10.
  2. Have server-side view distance to 6.
  3. Have player's view distance to 4.
  4. When you receive block change packet from outside of player's view distance and run away this chunk, when you go back to it it will have ghost blocks. You can repeat that to have even more ghost blocks.

andreasdc avatar Jun 16 '22 19:06 andreasdc

Or I do something wrong with your steps. Or I don't get the same result then you.

video of the steps I did: https://www.youtube.com/watch?v=ice5FMWJ7Ug

also tried it by flying away even further same as video above with the changing chunks just outside the player view distance but not outside the client distance

mechoriet avatar Jun 16 '22 23:06 mechoriet

You are placing blocks normally not sending block change packets manually, also it has to be done pretty much at the same time. That's how I was bugging it.

andreasdc avatar Jun 17 '22 00:06 andreasdc

You are placing blocks normally not sending block change packets manually, also it has to be done pretty much at the same time. That's how I was bugging it.

~~If it was a floating block with a empty chunk and the block was the block that was touched~~ ~~by the packet then I found it and I also believe I found a solution for it that got patched in paper 1.12~~

~~ https://github.com/mechoriet/PandaSpigot/tree/pr/PacketPlayOutBlockChange-void-chunks ~~

~~Looks like this fixes that no floating block or empty void chunks on the edges of the view-distance~~

mechoriet avatar Jun 17 '22 02:06 mechoriet

I don't understand, but if this is the fix that's not it. https://github.com/mechoriet/PandaSpigot/blob/pr/PacketPlayOutBlockChange-void-chunks/patches/server/0064-Fix-block-break-desync.patch

andreasdc avatar Jun 17 '22 02:06 andreasdc

Bump

andreasdc avatar Nov 07 '22 00:11 andreasdc