Delete water bucket animation

Discussion in 'Plugin Development' started by w0lves, Oct 28, 2020.

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

    w0lves

    Hello again, im trying to make a infinite water bucket but i had one problem that i don't know how to solve.


    Plugin version: 1.8.8

    Problem: I'm using "PlayingInteractEvent". I do event.setCanceled(true) and place water myself looking for the block clicked and the face, that's easy but here is the problem, when i cancel the event, the bucket don't place water but it still doing the animation about Empty Bucket, and i need to click again to see again the water bucket.

    This is where i get the error: Doing event.setCanceled(true) give me back the water bucket BUT after clicking again, if i dont do another click i'll see an empty bucket (although it's not an empty bucket)

    Code:
    Code is not needed. (i think, if u need it just say it)

    Tested:
    - Use "BucketEmptyEvent" instead of "PlayingInteractEvent", nothing changed.
    - Use event.getItem() and giving him all the propierties of the previous bucket, but it doesn't change it.

    Maybe there's another way to do it... if someone know how i would be greatful if u could explain me.

    After post it i thought that maybe an easy solution could be just using the bucket with Left Click instead of Right Click...

    I don't like it much cause i liked to see the bucket animation but at least it's working.

    If someone know how to do it with the animation just reply!

    I'll mark as solved the post on a few days if no one gives a sugges, cause i already found a solution, not a very good one but at least works :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 28, 2020
  2. Offline

    Kars

    The water placement 'emptying' the bucket visually is handled client side. You can't stop that from happening server side, meaning the animation will happen and you can not stop it.

    A workaround would be to renew the bucket in the player's inventory to show a filled bucket instead of the visually (wrongfully) empty one like so:
    1. Listen for water place event and do what you have to do.
    2. Schedule a task 1 tick in the future -> remove the player's in-hand water bucket and place it back immediately.
     
Thread Status:
Not open for further replies.

Share This Page