1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

MobSpawners particle

Discussion in 'Development' started by DanielYTK, May 20, 2017.

  1. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    On my server, the players have many mobspawners on their plot me and this has really been a very big problem, I have suffered with lag's and with fps drop on the client side. I wanted to know if there is any way to remove the particles from MobSpawner, because I think that's the reason for the lag, thank you.
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    PMMP doesn't have mobspawners. But you can register mob spawners. Particles shouldn't be an issue unless there are at least 70 mob spawners in one chunk, for which you can limit it on BlockPlaceEvent, or just get over it and get a new device.
    PHP:
    /** @var BlockPlaceEvent $event */
    $block $event->getBlock();
    $chunk $block->getLevel()->geChunk($block->>> 4$block->>> 4);
    $spawnersInChunk 0;
    foreach(
    $chunk->getTiles() as $tile){
        if(
    $tile->namedtag["id"] == "MobSpawner"){
            if(++
    $spawnersInChunk 70){
                
    //Too many mob spawners in one chunk.

                /*$block = $tile->getBlock();
                $block->getLevel()->setBlockIdAt($block->x, $block->y, $block->z, Block::AIR);
                $tile->close();*/

                
    $event->setCancelled();
                break;
            }
        }
    }
    Of course, 70 is not a magic number. This would differ based on your game settings and device.
     
    Last edited: May 20, 2017
    jasonwynn10 and DanielYTK like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.