Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[New API]How to add a falling block?

Comments in 'Plugin Development' started by steveng, Jul 16, 2014.

  1. steveng
    Offline

    steveng New Member Plugin Developer

    Joined:
    Feb 5, 2014
    Posts:
    29
    Plugins:
    1
    How to add a entity falling block like this
    PHP:
    $data = array(
        
    "x" $x 0.5,
        
    "y" $y 0.5,
        
    "z" $z 0.5,
        
    "Tile" 123,
    );
    $e $this->api->entity->add($data);
    usleep(10000);
    $this->api->entity->spawnToAll($e);
    in new API?
  2. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    it is better to use raw packets instead
  3. steveng
    Offline

    steveng New Member Plugin Developer

    Joined:
    Feb 5, 2014
    Posts:
    29
    Plugins:
    1
    Could you give me a little example?:)
  4. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    AddEntityPacket
    $eid = is a special number for each entity you spawn , you may not use the same eid for two entities and you could use Entity::$entityCount++ and it well generate a new eid on every time you send the packet
    $type = its the id of enetity
    $x = where you are going to spawn it in x
    $y = where you are going to spawn it in y
    $z= where you are going to spawn it in z
    $did= i am not sure but if you put 0 then you don't need speedX and speedY and speedZ
    $speedX= motionX
    $speedY=motionY
    $speedZ=motionZ
    i hope i helped

    as @iksaku said : use add Entity Packets
    Last edited: Jul 16, 2014
    steveng likes this.
  5. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    @swagboy47 Raw packets are only sent to the players but the server will not handle them :p it's better to add Entity Packets ;)
    iJoshuaHD likes this.
  6. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    Dutok likes this.
  7. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    swagboy47 likes this.
  8. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    what do you mean ?
  9. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    I think so
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It isn't better to use raw packets. Raw packets will make it visible to only one player. Raw packets is just a means to hold the place when there is no entities API.
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It is better to add the entity to the level directly
  12. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    isn't that what he wanted ?
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I mean, using PocketMine API means no packet handling. You're not experienced for that enough to handle the strange things if you make mistakes.
  14. steveng
    Offline

    steveng New Member Plugin Developer

    Joined:
    Feb 5, 2014
    Posts:
    29
    Plugins:
    1
    How to use addEntity() to add a falling block though?
  15. steveng
    Offline

    steveng New Member Plugin Developer

    Joined:
    Feb 5, 2014
    Posts:
    29
    Plugins:
    1
    Thanks,to broadcast this packet?
    Last edited: Jul 16, 2014
  16. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    why you used "?" ?
  17. steveng
    Offline

    steveng New Member Plugin Developer

    Joined:
    Feb 5, 2014
    Posts:
    29
    Plugins:
    1
    :pHow about removing it?
  18. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    As I said, let the PocketMine core do the dirty job of sending packets. Just use the PocketMine API. It may not be present ATM, but it will coke soon.
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It isn't if you want it handled with proper physics.
  20. steveng
    Offline

    steveng New Member Plugin Developer

    Joined:
    Feb 5, 2014
    Posts:
    29
    Plugins:
    1
    So,
    $l = $this->getServer->getLevel(“world”);
    $l->addEntity(new FallingBlock(?));

Share This Page

Advertisement