Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Block method override

Comments in 'Plugin Development' started by Svile, May 16, 2016.

  1. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    Is possible , for example , to change the name of a block , overriding the method getName() ????
  2. Survingo
    Offline

    Survingo Active Member

    Joined:
    Dec 6, 2015
    Posts:
    221
    Via source code? Yes. But it's not recommended. MCPE auto translates the english Block's name into the player's language
    Better use
    Code:
    /give [PLAYER] [ID] [amount] {display:{Name:"§4Herobrine's Block"}}
    applqpak likes this.
  3. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    Blocks and items are two different things. i didn't asked this :/
  4. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Ehm have you seen "PLUGIN DEVELOPMENT"?
    Jazzwhistle likes this.
  5. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    so , no one knows how to override a block method without modifing the pocketmine source code ?

    i already tried creating a class that extends the block ...
  6. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
  7. Survingo
    Offline

    Survingo Active Member

    Joined:
    Dec 6, 2015
    Posts:
    221
    You have a better idea? Share it with us your very very better idea


    Okay, even if this is solved I do this for the people looking this up in the Future.

    Using rename, unlink.
    PHP:
    rename('pocketmine/block/BlockName.php''pocketmine/block/NewBlockName.php'); //Moves file to `../block` directory
    unlink('pocketmine/block/BlockName.php');                       //Delete old file
  8. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    -.-
    Primus and Survingo like this.
  9. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    pls stop posting useless things.
    for those who need to create a new custom block:

    https://github.com/Muirfield/bad-plugins/tree/master/Rails
  10. Survingo
    Offline

    Survingo Active Member

    Joined:
    Dec 6, 2015
    Posts:
    221
  11. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    think what you want . i don't care
  12. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    "File name" does not equal to "In Game Block Name".

    A real solution would be to create a new "Block" class assigning its ID and Name, or create a custom block class with the exact properties you want
  13. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    If you want to change the name, use setCustomName...
  14. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    was an example.

Share This Page

Advertisement