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

EnderChest Particles

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

  1. SergeyIvanov

    SergeyIvanov Witch

    Messages:
    59
    GitHub:
    sergeyivanov14
    Hi, how to create particles like the ender chest? PortalParticle That go in the center of the block.
     

    Attached Files:

  2. Lowkey

    Lowkey Slime

    Messages:
    94
    Have you attempted any code yourself?
     
  3. SergeyIvanov

    SergeyIvanov Witch

    Messages:
    59
    GitHub:
    sergeyivanov14
    No, because I don't know.
     
  4. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    I doubt you actually have to code the particles to 'move' themselves. I think spawning random particles around the block will automatically make them move to the ender chest. That's my guess because particles aren't controlled server side.
     
    jasonwynn10 and SalmonDE like this.
  5. Lowkey

    Lowkey Slime

    Messages:
    94
    To create portals around a block, simply get the XYZ and spawn them. There is various code for making a circle/patterns etc.
    Use a task if you want them to keep respawning
     
  6. Amon28

    Amon28 Slime

    Messages:
    76
    GitHub:
    amon28
    The nether chest plug-in can do that also you can study the code for it
     
  7. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Using lcg_value() as done in LBParticles would answer the question, but it would be better if there was a way to spawn an invisible, yet visible (visible as in the particles would be visible) ender chest.
    Try this
    PHP:
    public function spawnEnderChestParticles(Position $pos){
        
    $pk = new BlockEntityDataPacket();
        
    $floored $pos->floor();
        
    $pk->$floored->x;
        
    $pk->$floored->y;
        
    $pk->$floored->z;
        
    $players $pos->getLevel()->getChunkPlayers($floored->>> 4$floored->>> 4);
        if(!empty(
    $players)){
            
    $nbt = new NBT(NBT::LITTLE_ENDIAN);
            
    $nbt->setData(new CompoundTag("", [
                new 
    StringTag("id""EnderChest"),
                new 
    IntTag("x"$floored->x),
                new 
    IntTag("y"$floored->y),
                new 
    IntTag("z"$floored->z)
            ]));
            
    $pk->namedtag $nbt->write(true);
            
    $pos->getLevel()->getServer()->broadcastPacket($pk$players);
        }
    }
     
    jasonwynn10 likes this.
  8. falk

    falk Slime Poggit Reviewer

    Messages:
    75
    GitHub:
    falkirks
    Keep in mind LBParticles doesn't appear to be licensed permissively, so take care when copying code from there.
     
  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.