[Solved] Help with Block Break effect Packet

Discussion in 'Plugin Development' started by Malikk, Mar 31, 2012.

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

    Malikk

    Hey guys,

    Basically, all I'm trying to do is, when I use block.breakNaturally() also get it to play the sound and animation as if a player had broken it. However, I'm having a really hard time finding any documentation on what parameters each packet takes, and even which packet I should even be using...

    I want everyone within range to hear it, not just one player, so I assume
    Code:
    ((CraftServer)Bukkit.getServer()).getServer().serverConfigurationManager.sendPacketNearby(...);
    But even there, I'm not sure what the parameters are.

    Any help would be greatly appreciated.

    Thanks

    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  2. Documentation: http://mc.kev009.com/Protocol (I can highly recommend it)
    You want to use "Sound/Particle Effect (0x3D) " with effect id 2001. There might be a datawatcher-like thingy to use it in-code, I don't know. Otherwise just send Packet61WorldEvent, the parameters should be pretty straight-forward with the hlep of the above page.
     
    MnMaxon and Malikk like this.
  3. Offline

    Malikk

    Bone008
    Okay, thanks for the links, those are perfect. Definitely bookmarking those.

    So, my packet looks like
    Code:
    Packet61WorldEvent packet = new Packet61WorldEvent(0x3D, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 20);
    but I'm still not sure what the parameters for sendPacketNearby are.
    Code:
    .sendPacketNearby(0, 0, 0, 0, 0, packet);

    Edit:
    I assumed the Packet Id was the same as the packetData that the Packet61WorldEvent wants. But I'm not sure that's right.

    I've never used packets before, so bare with me

    Ah. Well, that was retarded. Okay, tested it out with sending it to a single player.

    and this is the winner
    Code:
    Packet61WorldEvent packet = new Packet61WorldEvent(2001, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 20);
    Any help with the parameters for sendPacketNearby would still be really helpful

    Figured it out.

    For anyone searching for the same thing;

    Code:
    sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 30, ((CraftWorld) loc.getWorld()).getHandle().dimension, packet);
    where 30 is the range and packet is whatever packet you're trying to send

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  4. Offline

    MnMaxon

    Thank you a lot, this is really helpful for me.
    Your way below is easier
     
  5. Offline

    fireblast709

    just use player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, blockID, radius);

    (btw: necropost much?)
     
Thread Status:
Not open for further replies.

Share This Page