1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Break faster in some blocks

Discussion in 'Development' started by KHAV, Jul 15, 2018.

  1. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    Is it possible to make the player break a block faster than the normally?, For example: He can break the Obsidian with his hand in 2-3 seconds.
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Apparently it's not easy, according to dktapps.
     
  3. Aviv

    Aviv Baby Zombie

    Messages:
    156
    Whoops didnt see that link :facepalm:
     
  4. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    So from what i understood, Should i make a new block and register it?
     
    corytortoise likes this.
  5. Aviv

    Aviv Baby Zombie

    Messages:
    156
    Yes, and make a task which breaks the block after the set interval(in your case: 2-3 seconds, 40-60 ticks)
     
  6. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    I will try, And tell you and corytortoise then what happened.
     
    corytortoise likes this.
  7. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    @Aviv and @corytortoise I did a new block and the break time is working, but If i will run a task where i should run it? Is there a specific event ?
     
  8. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    does the block break at 2 seconds? or does it break as the same time as normal obsidian
     
  9. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    I think it would be PlayerInteractEvent, but you'd have to check $event->getAction() == PlayerInteractEvent::LEFT_CLICK_BLOCK, but I don't know how you'd check to make sure the player is still breaking the block the entire time.
     
  10. Aviv

    Aviv Baby Zombie

    Messages:
    156
    Use
    PHP:
    Block::getBreakTime(Item $item)
    in PlayerInteractEvent where
     
    corytortoise likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.