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

How can I replace iron fence with Air

Comments in 'Plugin Development' started by DunxandMinecraft, Aug 7, 2015.

  1. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    I am craeting a waiting room and I need a set of iron fence after an amount of time. Would I need to do this with the setBlock
  2. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    example by blockplacevent

    $block = $event->getBlock()->getLevel()->getBlock(new Vector3($event->getBlock()->x,$event->getBlock()->y,$event->getBlock()->z));

    then u can take the id "->getId()" or something else...

    and overwrite them with setBlock
  3. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    WHAT? Iron fence?
  4. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    So I have the iron fence in the map then it goes and replaced by air? And would I just put that in a public function of the plugin.
  5. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Yeah, you know that iron thing. LOL
  6. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    PHP:
    Item::get(Item::IRON_BAR)->getBlock ();
    I don't sure, but maybe this? :)
  7. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    if the iron fence is in the map and the code have to find it...uff it will be laaag...but if u want say if player set iron fence its fast
  8. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    What do you mean? Could you supply the code to do so.
    I will try this in the code of the plugin.
  9. deot
    Offline

    deot Active Member Plugin Developer

    Joined:
    Apr 22, 2015
    Posts:
    219
    Plugins:
    1
    Minecraft User:
    deot
    So, is my code working? :)
  10. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    Iron Bars
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Just use $event->getBlock() instead of making a new Vector3 >.<
    Just use Block::get(Block::IRON_BAR) >.<
    hoyinm14mc likes this.
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why not use WorldEditArt though? It has an API that you might want to use.
  13. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    I tried to get the plugin to load but I got something wrong in the namespace of the plugin.
    What do you mean? And, no offence I don't really like that plugin. Sorry
  14. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    dont get it to work befor, i think i have to try it again, after some anoying minuites tried this and it runs
  15. Asparanc
    Offline

    Asparanc Active Member

    Joined:
    Feb 20, 2015
    Posts:
    210
    Minecraft User:
    Asparanc
    PHP:
    $level $this->getServer()->getLevelByName("nameoftheworld");
    $level->setBlock(new Vector3($x$y$z), Block::get($id$metadata));
    Try this.
    DunxandMinecraft likes this.
  16. iDirtPlayzMC
    Offline

    iDirtPlayzMC Active Member

    Joined:
    Apr 10, 2015
    Posts:
    264
    Minecraft User:
    iZenith_xPr
    lol
  17. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Thx, I'm gonna add this code
  18. Asparanc
    Offline

    Asparanc Active Member

    Joined:
    Feb 20, 2015
    Posts:
    210
    Minecraft User:
    Asparanc
    No problems :)
  19. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    I am doi
    I am doing it multiple times. Would I just repeat the code for all the coords
  20. Asparanc
    Offline

    Asparanc Active Member

    Joined:
    Feb 20, 2015
    Posts:
    210
    Minecraft User:
    Asparanc
    If it for an area use for() function

Share This Page

Advertisement