Solved Block Break Animation

Discussion in 'Plugin Development' started by number1_Master, Feb 25, 2013.

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

    number1_Master

    Let me start with this: This thread is about Minecraft Packets, specifically Packet55BlockBreakAnimation.

    So, I've been experimenting with packets and I now want to add the block break animation (the animation in which cracks appear on the block as you break it). I started with so:
    Code:java
    1. Packet55BlockBreakAnimation packet = new Packet55BlockBreakAnimation();

    To my surprise, it did not take any parameters. I still continued
    Code:java
    1. ((CraftServer) player.getServer()).getHandle().sendPacketNearby(
    2. loc.getX(), loc.getY(), loc.getZ(), 120, ((CraftWorld) player.getWorld()).getHandle().dimension, packet);
    3.  
    4. // This has also been used.
    5. EntityPlayer ePlayer = (EntityPlayer) player;
    6. ePlayer.playerConnection.sendPacket(new Packet55BlockBreakAnimation());

    At this point, I assume my code is wrong. This is probably my third time fooling around with packets ever. I can't get the BlockBreakAnimation to work. Unlike older versions of Craftbukkit, the packet would take the parameters of the player's id, the block (x, y, z), and the damage level. In this case it is not.

    Please forgive me if the code is completely stupid or the post is not understandable. I'm very tired :p

    Thanks in advance!
     
  2. Offline

    mastermustard

    why not just take BlockBreakEvent than create an effect with playEffect/playSound or whatever else?

    sorry if im not fully understanding what you want to do
     
  3. Offline

    number1_Master

    You can't create the cracks on the block via the playerEffect method.
     
  4. Offline

    mastermustard

    ahh okay i thought you wanted to just have an effect go on block break, sorry my mistake
     
  5. Offline

    number1_Master

    Na, I already did that. I just cannot get the the crack animation to work, mainly because I've confused myself :p

    I'm sorry to bump this thread, but I would really appreciate any information regarding packets, specifically the BlockBreakAnimation packet ...

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

    Rprrr

  7. Offline

    number1_Master

    I'm referring to the block CRACK affect. When you start hitting stone with your first, for example, you will see cracks appearing.

    I would like to manage what stage of cracking it is at after extending the block destroy time, which I have done via a scheduler and getting the currentTimeMillis.

    Edit: Missed 2001, will try it.
    Edit 2: Whats the difference of that and http://wiki.vg/Protocol#Block_Break_Animation_.280x37.29

    Figured it out. loc.getX() and etc. were returning doubles, and those parameters required integers. Here is the final code for anyone looking for it in the future:
    Code:java
    1. Packet55BlockBreakAnimation packet = new Packet55BlockBreakAnimation(0, block.getX(), block.getY(), block.getZ(), damage);
    2. int dimension = ((CraftWorld) player.getWorld()).getHandle().dimension;
    3. ((CraftServer) player.getServer()).getHandle().sendPacketNearby(block.getX(), block.getY(), block.getZ(), 120, dimension, packet);


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

    Rprrr

    number1_Master
    Oops, sorry. I was wrong. Anyway, good thing that you figured it out. :)
     
  9. Offline

    lycano

    Even if this is solved number1_Master you should implement the Effect into craftbukkit and make a pull request or you will end up in the "break on update" hell as you would have to use CB.
     
  10. Offline

    number1_Master

    I'm not worry about this yet. At the moment, this is such a small plugin that all I would need to do is fix about 3 imports in 1 class.
     
  11. Offline

    ohtwo

    I'm curious to know, why are you trying to use the block crack effect?
     
  12. Offline

    number1_Master

    Since I am extending the time a block breaks via a scheduler, I have to change when the BlockBreakAnimation occurs. Although I plan on making a plugin which modifies the time it takes to break a block, in this current situation I wanted the crack affect to appear when breaking bedrock.
     
Thread Status:
Not open for further replies.

Share This Page