1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Bug World.refreshChunk() makes entities un-interractable

Discussion in 'Bugs & Feature Requests' started by tssge, Jun 7, 2013.

  1. Hello,

    It seems that using World.refreshChunk() makes entities inside the chunk un-interractable, for example Villagers cannot be traded, nor zombies can be killed. You have to leave the area first for the chunks to unload and then come back. When they get resended, eveything works again.

    How to reproduce:
    Code (Text):
    int view = Bukkit.getViewDistance();
    Chunk currentChunk = p.getWorld().getChunkAt(p.getLocation().getBlockX() >> 4, p.getLocation().getBlockZ() >> 4);
    for (int dx = -view; dx <= view; dx++) {
      for (int dz = -view; dz <= view; dz++) {
            p.getWorld().refreshChunk(currentChunk.getX() + dx, currentChunk.getZ() + dz);
    This code refreshes the chunks around a player. I use this code as a temporary workaround for this texturepack bug. (Texturepack bug happens, because the client is unable to handle greater than 16x16 server texturepacks correctly)

    Any workaround or possible solution? Maybe re-sending the entities after chunks or something?

    #1 tssge, Jun 7, 2013
    Last edited: Jun 7, 2013
    • Informative Informative x 1
  2. md_5

    Administrator Developer

    Isn't this method depreciated? Regardless it's going to be very hard to make it work.
  3. Eclipse didn't warn me about deprecation. Any possible workaround or similar method for this?
  4. md_5

    Administrator Developer

    You could teleport the player to a predefined spot in the middle of nowehere and then move them back again
  5. joehot200


    Would you not have to unload and then load the chunk again before teleporting the player back? It may not be a client-sided error.
  6. In latest version (1.8.1) this bug is now "updated". Now after refreshing the chunk mobs temporary disapears and returns back afters some time (or if you relogins).

    I don't think that teleporting player is a good solution, I hope there must be a way to refresh chunk without glitches.

    I tried these ways:
    1. save than unload/load chunk
    2. Sent packet PacketPlayOutMapChunk and PacketPlayOutMapChunkBulk — same effect as world.refreshChunk()

    May be there's a way to "update" entities state too after refreshing the chunk? Something like, chuk.refreshEntites() will be great, but... :)
    I tried to sent movement packet but this did not made mob visible...
  7. 1.8.3 - nothing changed.
    world.refreshChunk not working :(
  8. Found solution for spigot 1.8.3.

    Code (Text):
    ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)chunk).getHandle(), true, 65535));
    • Useful Useful x 1
  9. just what i was needing, my error was the 3rd field (65535), i was using a 0 instead..

    works fine for biome modifications, except the entitys that are "bugged", but that is not important.
    • Like Like x 1