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 do this?

Comments in 'Plugin Development' started by MrPowerGamerBR, Jan 28, 2015.

  1. MrPowerGamerBR
    Offline

    MrPowerGamerBR New Member

    Joined:
    Jan 14, 2015
    Posts:
    6
    Minecraft User:
    MrPowerGamerBR
    Hello, I'm new to PocketMine-MP programming (but not new to Java/Bukkit programming) and I'm trying to do a simple plugin, but I don't know how I can do this:

    When a Player moves, and the block below is a sponge, send the player to the air.

    I know that I need to use the PlayerMoveEvent, but I don't know how to get a block on a location ($event->getTo() returns the location, not the block), also, how can I get the block below the location (Bukkit has .getRelative(BlcokFace.BELOW), but I didn't find anything like that on PocketMine-MP API).

    Also, how can I send the player up in the air (Not teleporting, but thrusting the player upwards)

    Thanks for helping!
  2. Enes
    Offline

    Enes New Member

    Joined:
    Mar 9, 2014
    Posts:
    9
    Minecraft User:
    tablet_sensation
    Link , where you have read the API please...
  3. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    You want to make a simple trampoline plugin?
  4. Enes
    Offline

    Enes New Member

    Joined:
    Mar 9, 2014
    Posts:
    9
    Minecraft User:
    tablet_sensation
    You can make a x y z code... I mean if the player in x=20 y=23 and z=5 teleport to "the air" ;)


    But i dont know the code... Still learning the api :p
  5. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    Please read @MrPowerGamerBR's post again. He doesn't want teleporting, he just wants thrusting into the air.
  6. Enes
    Offline

    Enes New Member

    Joined:
    Mar 9, 2014
    Posts:
    9
    Minecraft User:
    tablet_sensation
    And whats is so hard about that ?

    First tp Z= 10
    And then to Z=11
    Z=12
    Z=13...
    With a fast tick....
  7. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    Learn the PocketMine API...
    LDX likes this.
  8. MrPowerGamerBR
    Offline

    MrPowerGamerBR New Member

    Joined:
    Jan 14, 2015
    Posts:
    6
    Minecraft User:
    MrPowerGamerBR
    Yes, I wanted to make a simple trampoline plugin, I found a another trapoline plugin that another user made, so I just modified the code for my needs, and It's done!

    I try to learn the PocketMine-MP by looking at the code (I learned to make Bukkit plugins this way).
  9. Exxarion
    Offline

    Exxarion Active Member Plugin Developer

    Joined:
    Jan 5, 2014
    Posts:
    242
    Plugins:
    1
    Minecraft User:
    Notch
    @Darunia18 has made a trampoline plugin on his Github. Did you use this one? :p
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    $block $event->getLevel()->getBlock($event->getTo());
    if(
    $block->getId() === Block::SPONGE){
      
    $event->getPlayer()->setMotion($event->getPlayer()->getMotion()->add(0$degree));
    }
    Note that getBlock() every move will be very laggy.
    iksaku and LDX like this.
  11. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    I was beginning to think no one remembered Entity->setMotion().
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    EntityDamageByEntityEvent->setKnockback()
    #BlameMe
    iksaku likes this.
  13. Gamecrafter
    Offline

    Gamecrafter Notable Member Plugin Developer

    Joined:
    Nov 20, 2014
    Posts:
    981
    Plugins:
    9
    Technically speaking, the plugin developer made 90% of the plugin while you modified it? Make sure not to release this.
  14. MrPowerGamerBR
    Offline

    MrPowerGamerBR New Member

    Joined:
    Jan 14, 2015
    Posts:
    6
    Minecraft User:
    MrPowerGamerBR
    Of course :p It's only for my Server, so it is private.
  15. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    It's public... But with custom modifications

Share This Page

Advertisement