Protocollib- spawn falling block packets

Discussion in 'Plugin Development' started by dibujaron, Dec 19, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    dibujaron

    Code:java
    1.  
    2. public void spawnBlock(Player p, int blockID, int data){
    3.  
    4. Packet17SpawnObjectVehicle fbs = new Packet17SpawnObjectVehicle();
    5.  
    6. fbs.setType(Packet17SpawnObjectVehicle.ObjectTypes.FALLING_BLOCK);
    7. fbs.setEntityID(12345);
    8. fbs.setObjectData(blockID | (data << 0xC));
    9. Location l = p.getLocation();
    10. fbs.setX(l.getX());
    11. fbs.setY(l.getY() + 5);
    12. fbs.setZ(l.getZ());
    13. fbs.setOptionalSpeedX(0.1);
    14. fbs.setOptionalSpeedY(0);
    15. fbs.setOptionalSpeedY(0);
    16.  
    17. try {
    18. protocolManager.sendServerPacket(p, fbs.getHandle());
    19. e.printStackTrace();
    20. }
    21. }


    Hey, thanks for stopping by this thread. I'm working with ProtocolLIB and trying to create a fake falling block for Player p with ID and data as shown. In my tests I was passing it 17:1, or a spruce log. I'm also using PacketWrapper for the Packet class there.

    And the problem is- this isn't working. It fails silently. I tried doing an explosion packet instead just to make sure everything else was working properly and it was. I'm stumped. Any help?

    Thanks!
     
  2. Offline

    sayaad

    Last time I /summon'd FallingSand, it despawned after one tick...
    I even tried assigning it a velocity:
    /summon FallingSand ~ ~ ~ {Motion:[0.0,-2.0,0.0]}
    Still despawned after one tick.

    Problem is that the "Time" tag which is the life of the entity is 0 by default.
    /summon FallingSand ~ ~ ~ {Motion:[0.0,-2.0,0.0],Time:40}
    Works fine.
     
  3. Offline

    dibujaron

    Why hello, hello. Long time no see :)

    Yes, but I need to have it as a fake entity, not a real one. It needs to exist only on the clientside. Summon creates it on the server as a real entity.
     
  4. Offline

    suchtie664

Thread Status:
Not open for further replies.

Share This Page