PrismarineJS / prismarine-viewer

Web based viewer for servers and bots
https://prismarinejs.github.io/prismarine-viewer/
MIT License
251 stars 71 forks source link

Ghost entities from logged out players #174

Open drmzio opened 3 years ago

drmzio commented 3 years ago

Bot has been running for ~24 hours on a Heroku Dyno on MC server play.oc.tc and it appears that there are "ghost" entities visible in the viewer. Possible bug? https://mineflayer-occ-bot.herokuapp.com/

Image 2021-03-26 at 12 06 12 PM

Fyi: The server frequently rotates between maps and it confuses the viewer (renders nothing). Is there a way to do something like a "hard reload" through the API?

Here's the source code for the bot: https://github.com/drmzio/mineflayer-occ-bot

drmzio commented 3 years ago

So far, I've tried destroying the viewer and re-creating it at every spawn using the code below.

const createViewer = () => {
  // Destroy the current viewer if exists.
  if (bot.viewer) {
    bot.viewer.close();
    bot.viewer = undefined;
  }

  mineflayerViewer(bot, { port: process.env.PORT || 3000 });
};
bot.on('spawn', () => {
  createViewer();
});

But the issue still persists with the "ghost" entities.