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

Set block hardness

Discussion in 'Plugin Help' started by Daniktheboss, Jan 20, 2017.

  1. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Hello, i am breaking my head thinking of this. How to i set block hardness?
    $block = Block::get(7);
    $block->getHardness(1);
    no its wrong please help
     
  2. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    I haven't use this method either, can u try?
    PHP:
    // use pocketmine\item\Item;

    $block Item::get(7);
    $block->setHardness(2);
    Why not put your Code on GitHub and provide us with a Link so we all can have a look on whats happening...
     
  3. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    i use it on function onEnable...
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Block::get is still not a block.
    You must use
    PHP:
    /** @var Level $level */
    /** @var Vector3 $vector3 */
    $level->getBlock($vector3);
     
    Sandertv likes this.
  5. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    There is no real way to set hardness. You could do some hack extending and registering though.
     
  6. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    This method does not work. I pm dylan and he said that theres no way to set hardness. We need this implemented tho.
     
  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.